standard_audit 0.4.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +34 -0
- data/{MIT-LICENSE → LICENSE} +3 -1
- data/README.md +43 -0
- data/lib/generators/standard_audit/install/install_generator.rb +67 -1
- data/lib/generators/standard_audit/install/templates/initializer.rb.erb +7 -4
- data/lib/standard_audit/checks/retention.rb +58 -0
- data/lib/standard_audit/configuration.rb +16 -19
- data/lib/standard_audit/rspec.rb +29 -0
- data/lib/standard_audit/version.rb +1 -1
- data/lib/standard_audit.rb +1 -0
- metadata +27 -12
- data/lib/standard_audit/presets/standard_id.rb +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84f59bffd4df4a9174ba0a88645a4c7d5818eddf862b5badfb55c3880fb5849d
|
|
4
|
+
data.tar.gz: 7747fdff93658f34f3ba3a9bfa70ca40fdc581125d182c996319a161f5c30809
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 03f2f84e0418106b8899b9aaff009e95fdbb116f9eb98c37308d2b4ae41df3cfbfe9d9b1615bdd4beb4391d983989cb658e4195451cb56214a75e4cf46ba4375
|
|
7
|
+
data.tar.gz: 6b2e84e5bcd6e6e933535a6ae9e654deb3502e69b575d613044c7b02de843e2a8886c43a0c82bd8cb6313ff012510d36a52f290ca36dd778634c4b3c70cefb80
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.6.0] - 2026-06-24
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `config.retention_days` now defaults from the `STANDARD_AUDIT_RETENTION_DAYS` environment variable, so a deployment can opt into a retention window without a code change. Unset/blank/zero/negative/non-numeric resolves to `nil` (infinite retention — the compliance-safe default that never auto-deletes). Host apps can still override `config.retention_days` in their initializer.
|
|
15
|
+
- `StandardAudit::Checks::Retention` — a StandardHealth-compatible (duck-typed, no hard dependency) readiness check that flags unbounded retention on **production** deployments. Register it non-critical in `config/initializers/standard_health.rb`:
|
|
16
|
+
```ruby
|
|
17
|
+
c.register_check :audit_retention, StandardAudit::Checks::Retention, critical: false
|
|
18
|
+
```
|
|
19
|
+
When `APP_ENVIRONMENT == "production"` (falling back to `Rails.env.production?` so staging is not flagged) and `retention_days` is nil, it returns `:warn`, rolling `GET /health/ready` to `:degraded` — still HTTP 200, so it surfaces the advisory without failing the probe or blocking a deploy.
|
|
20
|
+
|
|
21
|
+
## [0.5.0] - 2026-04-29
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- CI and release workflows migrated to the shared `rarebit-one/.github` reusable workflows (`reusable-gem-ci.yml@v1`, `reusable-gem-release.yml@v1`); `.github/workflows/ci.yml` and `release.yml` are now thin shims.
|
|
26
|
+
- The `standard_audit:install` generator is now idempotent. Re-running it skips the migration when a `*_create_audit_logs.rb` file already exists in `db/migrate/`, and skips the initializer when `config/initializers/standard_audit.rb` already exists. New flags: `--skip-migration`, `--skip-initializer`, and `--force` (overwrite the existing initializer; defaults to skip without an interactive prompt).
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
|
|
30
|
+
- **BREAKING:** Removed `Configuration#use_preset` and the `lib/standard_audit/presets/` directory. The preset pattern (`config.use_preset(:standard_id)`) created a direct dependency from `standard_audit` on a specific publisher gem, which inverted the intended dependency direction — `standard_audit` should be a generic event consumer with no knowledge of any particular publisher. Host apps should subscribe to event patterns directly:
|
|
31
|
+
```ruby
|
|
32
|
+
StandardAudit.configure do |c|
|
|
33
|
+
c.subscribe_to "standard_id.authentication.*"
|
|
34
|
+
c.subscribe_to "standard_id.session.created"
|
|
35
|
+
c.subscribe_to "standard_id.session.revoked"
|
|
36
|
+
c.subscribe_to "standard_id.session.expired"
|
|
37
|
+
c.subscribe_to "standard_id.account.*"
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
Each publisher gem documents its event namespace.
|
|
41
|
+
- **BREAKING:** Dropped support for Ruby < 4.0. `required_ruby_version` is now `>= 4.0`. Hosts must upgrade to Ruby 4.0+ before bundling this version. CI tests all four published 4.0.x patches.
|
|
42
|
+
- **BREAKING:** Dropped support for Rails < 8.0. `activerecord`, `activejob`, and `activesupport` constraints are now `>= 8.0` (was `>= 7.1`). Hosts on Rails 7.x must upgrade to Rails 8.0+ before bundling this version. Aligns with the org-wide policy of supporting Rails 8 and up.
|
|
43
|
+
|
|
10
44
|
## [0.4.0] - 2026-04-19
|
|
11
45
|
|
|
12
46
|
### Added
|
data/{MIT-LICENSE → LICENSE}
RENAMED
data/README.md
CHANGED
|
@@ -23,6 +23,8 @@ This creates:
|
|
|
23
23
|
- A migration for the `audit_logs` table (UUID primary keys, JSON metadata)
|
|
24
24
|
- An initializer at `config/initializers/standard_audit.rb`
|
|
25
25
|
|
|
26
|
+
The generator is idempotent — re-running it skips the migration when a `*_create_audit_logs.rb` already exists in `db/migrate/`, and skips the initializer when `config/initializers/standard_audit.rb` already exists. Pass `--skip-migration` or `--skip-initializer` to opt out of individual steps, or `--force` to overwrite the existing initializer.
|
|
27
|
+
|
|
26
28
|
## Quick Start
|
|
27
29
|
|
|
28
30
|
### 1. Subscribe to events
|
|
@@ -207,6 +209,8 @@ StandardAudit.configure do |config|
|
|
|
207
209
|
config.anonymizable_metadata_keys = %i[email name ip_address]
|
|
208
210
|
|
|
209
211
|
# -- Retention (schedule StandardAudit::CleanupJob to enforce) --
|
|
212
|
+
# Defaults from STANDARD_AUDIT_RETENTION_DAYS (see Retention below); set here
|
|
213
|
+
# to override per app. Leave unset for infinite retention.
|
|
210
214
|
config.retention_days = 90
|
|
211
215
|
end
|
|
212
216
|
```
|
|
@@ -337,6 +341,45 @@ File.write("export.json", JSON.pretty_generate(data))
|
|
|
337
341
|
|
|
338
342
|
Returns a hash with `subject`, `exported_at`, `total_records`, and a `records` array.
|
|
339
343
|
|
|
344
|
+
## Retention
|
|
345
|
+
|
|
346
|
+
`config.retention_days` controls how long audit logs are kept. It is only
|
|
347
|
+
enforced when you actually run cleanup (the `StandardAudit::CleanupJob` or the
|
|
348
|
+
`standard_audit:cleanup` rake task) — setting it alone deletes nothing.
|
|
349
|
+
|
|
350
|
+
It defaults from the `STANDARD_AUDIT_RETENTION_DAYS` environment variable, so a
|
|
351
|
+
deployment can opt into a retention window without a code change:
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
STANDARD_AUDIT_RETENTION_DAYS=365 # keep 365 days
|
|
355
|
+
# unset / blank / 0 / negative / non-numeric => nil => infinite retention
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
Infinite retention (the default) is the compliance-safe behavior: nothing is
|
|
359
|
+
ever auto-deleted. For financial/legal domains that is usually what you want;
|
|
360
|
+
enabling a finite window is a deliberate decision.
|
|
361
|
+
|
|
362
|
+
### Production retention warning (StandardHealth)
|
|
363
|
+
|
|
364
|
+
`StandardAudit::Checks::Retention` is a [StandardHealth](https://github.com/rarebit-one/standard_health)-compatible
|
|
365
|
+
check that flags unbounded retention **on production deployments** as an
|
|
366
|
+
advisory. Register it (non-critical) in `config/initializers/standard_health.rb`:
|
|
367
|
+
|
|
368
|
+
```ruby
|
|
369
|
+
StandardHealth.configure do |c|
|
|
370
|
+
c.register_check :audit_retention,
|
|
371
|
+
StandardAudit::Checks::Retention,
|
|
372
|
+
critical: false
|
|
373
|
+
end
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
When `APP_ENVIRONMENT == "production"` (falling back to `Rails.env.production?`
|
|
377
|
+
when that var is unset — so staging is not flagged) and `retention_days` is nil,
|
|
378
|
+
the check returns `:warn`. That rolls `GET /health/ready` up to `:degraded`,
|
|
379
|
+
which is **still HTTP 200** — it surfaces the advisory in the readiness JSON
|
|
380
|
+
without failing the probe or blocking a deploy. The check is duck-typed and has
|
|
381
|
+
no hard dependency on `standard_health`.
|
|
382
|
+
|
|
340
383
|
## Rake Tasks
|
|
341
384
|
|
|
342
385
|
```bash
|
|
@@ -1,19 +1,85 @@
|
|
|
1
|
+
require "rails/generators"
|
|
2
|
+
|
|
1
3
|
module StandardAudit
|
|
2
4
|
module Generators
|
|
5
|
+
# Installs StandardAudit in a host Rails application.
|
|
6
|
+
#
|
|
7
|
+
# Creates the migration for the `audit_logs` table and writes the
|
|
8
|
+
# initializer at `config/initializers/standard_audit.rb`.
|
|
9
|
+
#
|
|
10
|
+
# Idempotent: re-running the generator will skip pieces it has already
|
|
11
|
+
# installed. Pass `--skip-*` flags to opt out of individual steps and
|
|
12
|
+
# `--force` to overwrite an existing initializer.
|
|
3
13
|
class InstallGenerator < Rails::Generators::Base
|
|
4
14
|
include Rails::Generators::Migration
|
|
5
15
|
source_root File.expand_path("templates", __dir__)
|
|
6
16
|
|
|
17
|
+
desc <<~DESC
|
|
18
|
+
Installs StandardAudit. By default this:
|
|
19
|
+
* copies a CreateAuditLogs migration into db/migrate/
|
|
20
|
+
* writes config/initializers/standard_audit.rb
|
|
21
|
+
|
|
22
|
+
Use --skip-* flags to opt out of individual steps when re-running on an
|
|
23
|
+
existing install. The generator is idempotent — already-installed
|
|
24
|
+
pieces are skipped with a clear message. Pass --force to overwrite an
|
|
25
|
+
existing initializer.
|
|
26
|
+
DESC
|
|
27
|
+
|
|
28
|
+
class_option :skip_migration, type: :boolean, default: false,
|
|
29
|
+
desc: "Do not copy the CreateAuditLogs migration into db/migrate"
|
|
30
|
+
class_option :skip_initializer, type: :boolean, default: false,
|
|
31
|
+
desc: "Do not write config/initializers/standard_audit.rb"
|
|
32
|
+
class_option :force, type: :boolean, default: false,
|
|
33
|
+
desc: "Overwrite config/initializers/standard_audit.rb if it already exists"
|
|
34
|
+
|
|
7
35
|
def self.next_migration_number(dirname)
|
|
8
36
|
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
9
37
|
end
|
|
10
38
|
|
|
11
39
|
def copy_migration
|
|
40
|
+
if options[:skip_migration]
|
|
41
|
+
say_status("skip", "db/migrate/*_create_audit_logs.rb (--skip-migration)", :yellow)
|
|
42
|
+
return
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if existing_migration
|
|
46
|
+
say_status(
|
|
47
|
+
"identical",
|
|
48
|
+
"AuditLog migration already present (#{relative_migration_path(existing_migration)}), skipping",
|
|
49
|
+
:blue
|
|
50
|
+
)
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
|
|
12
54
|
migration_template "create_audit_logs.rb.erb", "db/migrate/create_audit_logs.rb"
|
|
13
55
|
end
|
|
14
56
|
|
|
15
57
|
def copy_initializer
|
|
16
|
-
|
|
58
|
+
initializer_path = "config/initializers/standard_audit.rb"
|
|
59
|
+
|
|
60
|
+
if options[:skip_initializer]
|
|
61
|
+
say_status("skip", "#{initializer_path} (--skip-initializer)", :yellow)
|
|
62
|
+
return
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
if File.exist?(File.join(destination_root, initializer_path)) && !options[:force]
|
|
66
|
+
say_status("identical", "#{initializer_path} (already exists; pass --force to overwrite)", :blue)
|
|
67
|
+
return
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
template "initializer.rb.erb", initializer_path, force: options[:force]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
no_commands do
|
|
74
|
+
def existing_migration
|
|
75
|
+
Dir.glob(File.join(destination_root, "db/migrate/*_create_audit_logs.rb")).first
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def relative_migration_path(absolute_path)
|
|
79
|
+
Pathname.new(absolute_path).relative_path_from(Pathname.new(destination_root)).to_s
|
|
80
|
+
rescue ArgumentError
|
|
81
|
+
absolute_path
|
|
82
|
+
end
|
|
17
83
|
end
|
|
18
84
|
end
|
|
19
85
|
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
StandardAudit.configure do |config|
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
#
|
|
2
|
+
# Subscribe to ActiveSupport::Notifications / Rails.event patterns.
|
|
3
|
+
# Each gem documents its own event namespace; subscribe to whichever
|
|
4
|
+
# patterns you want audited:
|
|
5
|
+
# config.subscribe_to "standard_id.authentication.*"
|
|
6
|
+
# config.subscribe_to "standard_id.session.created"
|
|
7
|
+
# config.subscribe_to "standard_id.session.revoked"
|
|
8
|
+
# config.subscribe_to "standard_circuit.circuit.*"
|
|
6
9
|
# config.subscribe_to "audit.**"
|
|
7
10
|
|
|
8
11
|
# Actor extractor from notification payload
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
module StandardAudit
|
|
2
|
+
module Checks
|
|
3
|
+
# A StandardHealth-compatible readiness check that warns when audit_logs
|
|
4
|
+
# retention is unbounded on a production deployment.
|
|
5
|
+
#
|
|
6
|
+
# It is intentionally duck-typed (no hard dependency on standard_health):
|
|
7
|
+
# it exposes the `#initialize(name:, critical:)` + `#run` contract the
|
|
8
|
+
# StandardHealth aggregator calls, so it loads even where standard_health
|
|
9
|
+
# is absent.
|
|
10
|
+
#
|
|
11
|
+
# Register it (NON-critical) in config/initializers/standard_health.rb:
|
|
12
|
+
#
|
|
13
|
+
# c.register_check :audit_retention,
|
|
14
|
+
# StandardAudit::Checks::Retention,
|
|
15
|
+
# critical: false
|
|
16
|
+
#
|
|
17
|
+
# A :warn result rolls /health/ready up to :degraded, which is still
|
|
18
|
+
# HTTP 200 — it surfaces the advisory in the readiness JSON WITHOUT failing
|
|
19
|
+
# the probe or blocking a deploy. Only a *critical* check failure returns
|
|
20
|
+
# 503, and this check is never critical.
|
|
21
|
+
#
|
|
22
|
+
# "Production" is ENV["APP_ENVIRONMENT"] == "production" when that var is
|
|
23
|
+
# set (so staging — which also runs RAILS_ENV=production — is not flagged);
|
|
24
|
+
# otherwise it falls back to Rails.env.production?.
|
|
25
|
+
class Retention
|
|
26
|
+
def initialize(name: :audit_retention, critical: false)
|
|
27
|
+
@name = name
|
|
28
|
+
@critical = critical
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def run
|
|
32
|
+
unless production?
|
|
33
|
+
return { status: :ok, detail: "retention advisory only runs on production deployments" }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
days = StandardAudit.config.retention_days
|
|
37
|
+
return { status: :ok, retention_days: days } if days
|
|
38
|
+
|
|
39
|
+
{
|
|
40
|
+
status: :warn,
|
|
41
|
+
message: "audit_logs retention is unbounded on production. Set " \
|
|
42
|
+
"STANDARD_AUDIT_RETENTION_DAYS (or config.retention_days) and schedule " \
|
|
43
|
+
"StandardAudit::CleanupJob, or treat indefinite retention as a deliberate " \
|
|
44
|
+
"compliance decision."
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def production?
|
|
51
|
+
app_env = ENV["APP_ENVIRONMENT"].to_s
|
|
52
|
+
return app_env == "production" unless app_env.empty?
|
|
53
|
+
|
|
54
|
+
defined?(Rails) && Rails.respond_to?(:env) && Rails.env.production?
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -10,7 +10,6 @@ module StandardAudit
|
|
|
10
10
|
|
|
11
11
|
def initialize
|
|
12
12
|
@subscriptions = []
|
|
13
|
-
@applied_presets = []
|
|
14
13
|
@async = false
|
|
15
14
|
@queue_name = :default
|
|
16
15
|
@enabled = true
|
|
@@ -46,7 +45,22 @@ module StandardAudit
|
|
|
46
45
|
]
|
|
47
46
|
@metadata_builder = nil
|
|
48
47
|
@anonymizable_metadata_keys = %i[email name ip_address]
|
|
49
|
-
|
|
48
|
+
|
|
49
|
+
# Retention defaults from ENV so it can be set per-environment without a
|
|
50
|
+
# code change. Unset/blank/non-positive => nil (infinite retention, the
|
|
51
|
+
# compliance-safe default that never auto-deletes). A host app can still
|
|
52
|
+
# override with `config.retention_days = N` in its initializer.
|
|
53
|
+
@retention_days = self.class.retention_days_from_env
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Parses STANDARD_AUDIT_RETENTION_DAYS into a positive Integer, or nil when
|
|
57
|
+
# unset/blank/zero/negative/non-numeric (=> infinite retention).
|
|
58
|
+
def self.retention_days_from_env
|
|
59
|
+
raw = ENV["STANDARD_AUDIT_RETENTION_DAYS"]
|
|
60
|
+
return nil if raw.nil? || raw.strip.empty?
|
|
61
|
+
|
|
62
|
+
days = Integer(raw, exception: false)
|
|
63
|
+
days&.positive? ? days : nil
|
|
50
64
|
end
|
|
51
65
|
|
|
52
66
|
def subscribe_to(pattern)
|
|
@@ -56,22 +70,5 @@ module StandardAudit
|
|
|
56
70
|
def subscriptions
|
|
57
71
|
@subscriptions.dup.freeze
|
|
58
72
|
end
|
|
59
|
-
|
|
60
|
-
def use_preset(name)
|
|
61
|
-
key = name.to_sym
|
|
62
|
-
return self if @applied_presets.include?(key)
|
|
63
|
-
|
|
64
|
-
preset = case key
|
|
65
|
-
when :standard_id
|
|
66
|
-
require "standard_audit/presets/standard_id"
|
|
67
|
-
StandardAudit::Presets::StandardId
|
|
68
|
-
else
|
|
69
|
-
raise ArgumentError, "Unknown preset: #{name}. Available presets: :standard_id"
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
preset.apply(self)
|
|
73
|
-
@applied_presets << key
|
|
74
|
-
self
|
|
75
|
-
end
|
|
76
73
|
end
|
|
77
74
|
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "standard_audit"
|
|
2
|
+
|
|
3
|
+
# StandardAudit state reset between examples.
|
|
4
|
+
#
|
|
5
|
+
# - Clears the thread-local batch buffer so a spec that exits inside a
|
|
6
|
+
# `StandardAudit.batch { ... }` block (e.g. via an unhandled error or
|
|
7
|
+
# abort) cannot leak buffered records into the next example.
|
|
8
|
+
# - Resets the Configuration via `StandardAudit.reset_configuration!` so
|
|
9
|
+
# that mutations to `StandardAudit.config` (subscriptions, sensitive
|
|
10
|
+
# keys, async flag, custom resolvers, etc.) do not bleed across specs.
|
|
11
|
+
# Consumers that customise configuration must re-call
|
|
12
|
+
# `StandardAudit.configure { |c| ... }` from a `before` hook in their
|
|
13
|
+
# own suite if they need a non-default baseline.
|
|
14
|
+
#
|
|
15
|
+
# The memoized `Subscriber` and `EventSubscriber` instances are *not*
|
|
16
|
+
# torn down here — they are wired up at engine boot via initializers and
|
|
17
|
+
# rebuilding them per-example would unsubscribe from
|
|
18
|
+
# `ActiveSupport::Notifications` / `Rails.event` for the rest of the run.
|
|
19
|
+
# Specs that need to assert on subscriber behaviour should manage that
|
|
20
|
+
# locally.
|
|
21
|
+
#
|
|
22
|
+
# Intentionally `before(:example)` rather than `after(:example)` so the
|
|
23
|
+
# reset always runs even when a previous example aborted in an after hook.
|
|
24
|
+
RSpec.configure do |config|
|
|
25
|
+
config.before(:example) do
|
|
26
|
+
Thread.current[:standard_audit_batch] = nil
|
|
27
|
+
StandardAudit.reset_configuration!
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/standard_audit.rb
CHANGED
|
@@ -5,6 +5,7 @@ require "standard_audit/subscriber"
|
|
|
5
5
|
require "standard_audit/event_subscriber"
|
|
6
6
|
require "standard_audit/auditable"
|
|
7
7
|
require "standard_audit/audit_scope"
|
|
8
|
+
require "standard_audit/checks/retention"
|
|
8
9
|
|
|
9
10
|
module StandardAudit
|
|
10
11
|
# Metadata keys owned internally by StandardAudit. Never filtered by
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: standard_audit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jaryl Sim
|
|
@@ -15,42 +15,42 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '8.0'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '8.0'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: activejob
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '8.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '
|
|
39
|
+
version: '8.0'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: activesupport
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '8.0'
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '
|
|
53
|
+
version: '8.0'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: globalid
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,9 +65,23 @@ dependencies:
|
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '1.0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: simplecov
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0.22'
|
|
75
|
+
type: :development
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0.22'
|
|
68
82
|
description: StandardAudit is a standalone Rails gem for database-backed audit logging.
|
|
69
|
-
On Rails 8.1+ it subscribes to Rails.event; on
|
|
70
|
-
|
|
83
|
+
On Rails 8.1+ it subscribes to Rails.event; on Rails 8.0 it falls back to ActiveSupport::Notifications.
|
|
84
|
+
Generic, flexible, and works with any Rails application.
|
|
71
85
|
email:
|
|
72
86
|
- code@jaryl.dev
|
|
73
87
|
executables: []
|
|
@@ -75,7 +89,7 @@ extensions: []
|
|
|
75
89
|
extra_rdoc_files: []
|
|
76
90
|
files:
|
|
77
91
|
- CHANGELOG.md
|
|
78
|
-
-
|
|
92
|
+
- LICENSE
|
|
79
93
|
- README.md
|
|
80
94
|
- Rakefile
|
|
81
95
|
- app/jobs/standard_audit/cleanup_job.rb
|
|
@@ -91,10 +105,11 @@ files:
|
|
|
91
105
|
- lib/standard_audit.rb
|
|
92
106
|
- lib/standard_audit/audit_scope.rb
|
|
93
107
|
- lib/standard_audit/auditable.rb
|
|
108
|
+
- lib/standard_audit/checks/retention.rb
|
|
94
109
|
- lib/standard_audit/configuration.rb
|
|
95
110
|
- lib/standard_audit/engine.rb
|
|
96
111
|
- lib/standard_audit/event_subscriber.rb
|
|
97
|
-
- lib/standard_audit/
|
|
112
|
+
- lib/standard_audit/rspec.rb
|
|
98
113
|
- lib/standard_audit/subscriber.rb
|
|
99
114
|
- lib/standard_audit/version.rb
|
|
100
115
|
- lib/tasks/standard_audit_tasks.rake
|
|
@@ -113,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
113
128
|
requirements:
|
|
114
129
|
- - ">="
|
|
115
130
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '
|
|
131
|
+
version: '4.0'
|
|
117
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
133
|
requirements:
|
|
119
134
|
- - ">="
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module StandardAudit
|
|
2
|
-
module Presets
|
|
3
|
-
module StandardId
|
|
4
|
-
# Regex wildcards capture all events in a namespace. Session uses
|
|
5
|
-
# explicit strings to exclude noisy events like session.validated
|
|
6
|
-
# that fire on every authenticated request.
|
|
7
|
-
SUBSCRIPTIONS = [
|
|
8
|
-
/\Astandard_id\.authentication\./,
|
|
9
|
-
"standard_id.session.created",
|
|
10
|
-
"standard_id.session.revoked",
|
|
11
|
-
"standard_id.session.expired",
|
|
12
|
-
/\Astandard_id\.account\./,
|
|
13
|
-
/\Astandard_id\.social\./,
|
|
14
|
-
/\Astandard_id\.passwordless\./
|
|
15
|
-
].freeze
|
|
16
|
-
|
|
17
|
-
def self.apply(config)
|
|
18
|
-
SUBSCRIPTIONS.each { |pattern| config.subscribe_to(pattern) }
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|