synerma-audits1984 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +77 -0
- data/Rakefile +19 -0
- data/app/assets/config/audits1984_manifest.js +2 -0
- data/app/assets/stylesheets/audits1984/application.css +15 -0
- data/app/assets/stylesheets/audits1984/bulma.min.css +1 -0
- data/app/assets/stylesheets/audits1984/forms.css +3 -0
- data/app/assets/stylesheets/audits1984/sessions.css +5 -0
- data/app/controllers/audits1984/application_controller.rb +25 -0
- data/app/controllers/audits1984/audits_controller.rb +43 -0
- data/app/controllers/audits1984/filtered_sessions_controller.rb +15 -0
- data/app/controllers/audits1984/filtered_sessions_scoped.rb +14 -0
- data/app/controllers/audits1984/sessions_controller.rb +16 -0
- data/app/helpers/audits1984/application_helper.rb +38 -0
- data/app/javascript/audits1984/application.js +2 -0
- data/app/jobs/audits1984/application_job.rb +4 -0
- data/app/mailers/audits1984/application_mailer.rb +6 -0
- data/app/models/audits1984/application_record.rb +5 -0
- data/app/models/audits1984/audit.rb +10 -0
- data/app/models/audits1984/current.rb +3 -0
- data/app/models/audits1984/filtered_sessions.rb +30 -0
- data/app/models/audits1984/session/auditable.rb +13 -0
- data/app/models/audits1984/session/iterable.rb +23 -0
- data/app/views/audits1984/sessions/_audit_form.html.erb +26 -0
- data/app/views/audits1984/sessions/_executed_code.html.erb +26 -0
- data/app/views/audits1984/sessions/_filter.html.erb +34 -0
- data/app/views/audits1984/sessions/_header.html.erb +14 -0
- data/app/views/audits1984/sessions/_session.html.erb +25 -0
- data/app/views/audits1984/sessions/_summary.html.erb +5 -0
- data/app/views/audits1984/sessions/index.html.erb +6 -0
- data/app/views/audits1984/sessions/show.html.erb +10 -0
- data/app/views/layouts/audits1984/_flash.html.erb +10 -0
- data/app/views/layouts/audits1984/application.html.erb +24 -0
- data/config/importmap.rb +2 -0
- data/config/routes.rb +9 -0
- data/db/migrate/20210810092639_create_auditing_tables.rb +12 -0
- data/lib/audits1984/engine.rb +46 -0
- data/lib/audits1984/version.rb +3 -0
- data/lib/audits1984.rb +13 -0
- data/lib/tasks/audits1984_tasks.rake +4 -0
- metadata +324 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc29ee5bd3404776bfd9fc32fd581fe6b1035e1130bf58ca9176a648a404b5c1
|
4
|
+
data.tar.gz: 279391b5b1d119def3dc2739002fae42da184b692dc764da71e31f6316e35e8d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b680aa9f0edfd963c359cd73b8750dc5cf27bd1963675bb32e37affa4f2b5abb9e72ab22017764bf2d058f9dc6697bd0323e37de6b626dfc5a3e65e8fcdadb87
|
7
|
+
data.tar.gz: 6ea64974350e13bf0b480fbcd9f5ceeb00fd4fc635b4f91eded48e9b6f9a35841d89dd7f2143de75f063aaf37739fa4f1d18faa69adecb7ec755f039f3863a4d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2021 Jorge Manrubia
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
[](https://github.com/basecamp/audits1984/actions?query=branch%3Amaster)
|
2
|
+
|
3
|
+
# Audits1984
|
4
|
+
|
5
|
+
A simple auditing tool for [`console1984`](https://github.com/basecamp/console1984).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add it to your `Gemfile`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'audits1984'
|
13
|
+
```
|
14
|
+
|
15
|
+
Create tables to store audits in the database:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
rails audits1984:install:migrations
|
19
|
+
rails db:migrate
|
20
|
+
```
|
21
|
+
|
22
|
+
Mount the engine in your `routes.rb`:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
mount Audits1984::Engine => "/console"
|
26
|
+
```
|
27
|
+
|
28
|
+
### API-only apps or apps using `vite_rails` and other asset pipelines outside Rails
|
29
|
+
|
30
|
+
If you want to use this gem with an [API-only Rails app](https://guides.rubyonrails.org/api_app.html) or an app that's using `vite_ruby`/`vite_rails`, or some other custom asset pipeline different from Sprockets and Propshaft, you need just one more thing: configure an asset pipeline so you can serve the JavaScript and CSS included in this gem. We recommend to use [`Propshaft`](https://github.com/rails/propshaft). You simply need to add this line to your application's Gemfile:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem "propshaft"
|
34
|
+
```
|
35
|
+
|
36
|
+
Then execute
|
37
|
+
```bash
|
38
|
+
$ bundle install
|
39
|
+
```
|
40
|
+
|
41
|
+
And you should be ready to go.
|
42
|
+
|
43
|
+
### Authenticate auditors
|
44
|
+
|
45
|
+
By default, the library controllers will inherit from the host application's `ApplicationController`. To authenticate auditors, you need to implement a method `#find_current_auditor` in your `ApplicationController`. This method must return a record representing the auditing user. It can be any model but it has to respond to `#name`.
|
46
|
+
|
47
|
+
For example, Imagine all the staff in your company can audit console sessions:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
def find_current_auditor
|
51
|
+
Current.user if Current.user&.staff?
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
## Usage
|
56
|
+
|
57
|
+
The main screen lists the registered console sessions. It includes a form to filter sessions by date, and also to only show that contains sensitive accesses.
|
58
|
+
|
59
|
+

|
60
|
+
|
61
|
+
You can click on a session to see its commands and choose whether it was an appropiate console usage or not.
|
62
|
+
|
63
|
+

|
64
|
+
|
65
|
+
After making a decision on the session, you will be redirected to the next pending session, based on the filter configured in the main screen.
|
66
|
+
|
67
|
+
That is. I said it was simple.
|
68
|
+
|
69
|
+
## Configuration
|
70
|
+
|
71
|
+
These config options are namespaced in `config.audits1984`:
|
72
|
+
|
73
|
+
| Name | Description |
|
74
|
+
| --------------------- | ------------------------------------------------------------ |
|
75
|
+
| auditor_class | The name of the auditor class. By default it's `::User.` |
|
76
|
+
| auditor_name_attribute | The attribute on the auditor class that returns the auditor's name. By default it's `:name`. |
|
77
|
+
| base_controller_class | The host application base class that will be the parent of `audit1984` controllers. By default it's `::ApplicationController`. |
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
5
|
+
|
6
|
+
load "rails/tasks/statistics.rake"
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
9
|
+
|
10
|
+
require "rake/testtask"
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = false
|
16
|
+
t.warning = false
|
17
|
+
end
|
18
|
+
|
19
|
+
task default: :test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|