standard_audit 0.13.1 → 0.13.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ca3b859a3eb6993caa5c57a9a43621f67a44871c5ee3f05b2ea5d5ca79860b4
4
- data.tar.gz: 7a85141df78963fa16c7b223da7a7d48270c368538815f26d8e097a09487c0ff
3
+ metadata.gz: 77f38f95622eab13dc70d4376ad9694a3bbb03d3d54f5f2c43f63012e041ea23
4
+ data.tar.gz: 5d68228d9da02a23808db8cc2588dc358df1dc7f7a82d86da4447d98038f6411
5
5
  SHA512:
6
- metadata.gz: b74d1bbbd38c3580fb36f4db24f40f7fd01c9f6f807035e3aee8e0a3979692f0c4dc8175cdb53799291d578fdf0e8ca80add04e6df1b09b819425717088abea1
7
- data.tar.gz: 32dd1f53798d592fe517966dd4677abf42ce5ab7dd650176f56dfcd873025a43a3a81a048e276da37fdf90954cc68d3746fb9355e9c1e40559d123c87ab605af
6
+ metadata.gz: c5ca114c4894594f1e0de803d0d0e207bd308f887e130237af3d967a4ed33bc476ac72f28b1cff8b83af5f2d5c56e158542a917c560680c96e3f686ec339c6ec
7
+ data.tar.gz: 991e7cbfd6c21c73f54bc1bc1ed64aa1df8faaa2a6d44dfdf75222ab79911eb462de275ca086d74ef72108db70bad6df1f8c9f65fab9ec7ea115c0bb5bb99f1e
data/CHANGELOG.md CHANGED
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.13.3] - 2026-10-21
11
+
12
+ ### Fixed
13
+
14
+ - The default `scope_extractor` returns the payload's `scope:` only when it is a
15
+ record (responds to `to_global_id`). standard_id publishes `scope:` as a
16
+ Symbol or String (the OAuth scope or auth plane), and the old default passed it
17
+ to `to_global_id`, so those events failed to write (`NoMethodError`,
18
+ fundbright-web FUNDBRIGHT-WEB-41). A non-record scope now falls through to
19
+ `current_scope_resolver`, like an absent one. A custom `scope_extractor` and an
20
+ explicit `scope:` on `StandardAudit.record` are unchanged.
21
+
22
+ ## [0.13.2] - 2026-10-02
23
+
24
+ ### Fixed
25
+
26
+ - The canonical checksum works on json 3. `Checksum.json_round_trip` passed
27
+ `create_additions: false` to `JSON.parse`; json 3 removed that keyword, so
28
+ from the canonical cutover (2026-10-01T00:00:00Z) every audit row with a
29
+ Hash or Array field raised `ArgumentError: unknown keyword:
30
+ create_additions` before it was saved. Hosts on json 3 lost those rows
31
+ (luminality-web, LUMINALITY-WEB-1N). Hosts on json 2.x were unaffected,
32
+ and the digest is unchanged: JSON.parse never creates additions by default.
33
+
10
34
  ## [0.13.1] - 2026-09-25
11
35
 
12
36
  Fixes the checksum so it survives PostgreSQL `jsonb`
data/README.md CHANGED
@@ -508,7 +508,7 @@ StandardAudit.configure(baseline: true) do |config|
508
508
  # Defaults shown below.
509
509
  config.actor_extractor = ->(payload) { payload[:actor] }
510
510
  config.target_extractor = ->(payload) { payload[:target] }
511
- config.scope_extractor = ->(payload) { payload[:scope] }
511
+ config.scope_extractor = ->(payload) { payload[:scope] } # default keeps it only if it responds to to_global_id
512
512
 
513
513
  # -- Current Attribute Resolvers --
514
514
  # Fallbacks used when payload values are nil.
@@ -141,8 +141,11 @@ module StandardAudit
141
141
  # What a JSON column hands back for `value`: encoded exactly as
142
142
  # ActiveRecord's JSON type encodes on write, then parsed. Key ORDER is
143
143
  # the one thing this does not settle — canonical_json does.
144
+ #
145
+ # No `create_additions:` option: JSON.parse never creates additions by
146
+ # default, and json 3 removed the keyword (passing it raises).
144
147
  def json_round_trip(value)
145
- JSON.parse(ActiveSupport::JSON.encode(value), max_nesting: false, create_additions: false)
148
+ JSON.parse(ActiveSupport::JSON.encode(value), max_nesting: false)
146
149
  end
147
150
 
148
151
  # Deterministic JSON: object keys sorted bytewise at every depth, no
@@ -24,7 +24,15 @@ module StandardAudit
24
24
 
25
25
  @actor_extractor = ->(payload) { payload[:actor] }
26
26
  @target_extractor = ->(payload) { payload[:target] }
27
- @scope_extractor = ->(payload) { payload[:scope] }
27
+ # Only a record can be a scope (it is stored by GlobalID). Payloads also
28
+ # use `scope:` for other things: standard_id publishes the OAuth scope
29
+ # or auth plane there as a Symbol/String, which would raise NoMethodError
30
+ # on `to_global_id` at write time. Anything else falls through to
31
+ # `current_scope_resolver`.
32
+ @scope_extractor = ->(payload) {
33
+ scope = payload[:scope]
34
+ scope if scope.respond_to?(:to_global_id)
35
+ }
28
36
 
29
37
  # Tries StandardId's `Current.account` first, then the Rails-generator
30
38
  # convention `Current.user`. Each is respond_to?-guarded, so an app that
@@ -1,3 +1,3 @@
1
1
  module StandardAudit
2
- VERSION = "0.13.1"
2
+ VERSION = "0.13.3"
3
3
  end
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.13.1
4
+ version: 0.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jaryl Sim