legion-rbac 0.3.4 → 0.3.5
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 +5 -0
- data/README.md +6 -0
- data/lib/legion/rbac/permission.rb +4 -4
- data/lib/legion/rbac/policy_engine.rb +1 -1
- data/lib/legion/rbac/routes.rb +1 -1
- data/lib/legion/rbac/version.rb +1 -1
- data/lib/legion/rbac.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c62ae3d8b8ed4b7285f13ecc1e5d90d79f343cf98a4d56a342af761aba03185
|
|
4
|
+
data.tar.gz: f705bad75d3d459e82463c50d3110df25e847d36f2e092e88e10ae545ba67cac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c7d12ee4a0eaac6ea80132816a429dac7621253a4d720ef69dceaedcf1a00b63af70f0004b4c3e1bbec3f48ff9c8e8eb34eee8f0365e3abbd6a96b94c86727c4
|
|
7
|
+
data.tar.gz: 7f62612de461d2339ea9d70c9de87d5b8cc601622986a51ae3dfa02a22ac78d709b46dbc4ff5ad7cd78d8418f6ee2defa9912d9d2cc187ddb48a8f0541305fbf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.5] - 2026-10-30
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Deliver authorization decisions and policy-change audit events through the Core event bus keyword payload contract instead of losing events to a rescued argument error.
|
|
7
|
+
|
|
3
8
|
## [0.3.4] - 2026-05-09
|
|
4
9
|
|
|
5
10
|
### Removed
|
data/README.md
CHANGED
|
@@ -90,6 +90,12 @@ result = Legion::Rbac::PolicyEngine.evaluate(principal: principal, action: :read
|
|
|
90
90
|
# => { allowed: true, reason: "...", would_deny: false }
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
### Audit Events
|
|
94
|
+
|
|
95
|
+
When the optional Core `Legion::Events` bus is loaded and `rbac.emit_events` is enabled, subscribers receive `rbac.granted` and `rbac.denied` decisions with principal, resource/capability, enforcement and request-correlation context. Dry-run denials still emit `rbac.denied` with `would_deny: true`; authorization remains nonblocking.
|
|
96
|
+
|
|
97
|
+
Successful policy mutations emit `rbac.policy_changed` with the actor, target record and request correlation. RBAC 0.3.5 uses Core's keyword payload contract, so these notifications reach ordinary `Legion::Events.on` subscribers rather than being lost to an argument error. Event-delivery failures are logged without changing the authorization decision.
|
|
98
|
+
|
|
93
99
|
### CLI
|
|
94
100
|
|
|
95
101
|
```bash
|
|
@@ -34,8 +34,8 @@ module Legion
|
|
|
34
34
|
def self.pattern_to_regex(pattern)
|
|
35
35
|
parts = pattern.split('/').map do |segment|
|
|
36
36
|
case segment
|
|
37
|
-
when '*'
|
|
38
|
-
when '+'
|
|
37
|
+
when '*' then '.*'
|
|
38
|
+
when '+' then '[^/]+'
|
|
39
39
|
else Regexp.escape(segment)
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -80,8 +80,8 @@ module Legion
|
|
|
80
80
|
def self.pattern_to_regex(pattern)
|
|
81
81
|
parts = pattern.split('/').map do |segment|
|
|
82
82
|
case segment
|
|
83
|
-
when '*'
|
|
84
|
-
when '+'
|
|
83
|
+
when '*' then '.*'
|
|
84
|
+
when '+' then '[^/]+'
|
|
85
85
|
else Regexp.escape(segment)
|
|
86
86
|
end
|
|
87
87
|
end
|
|
@@ -393,7 +393,7 @@ module Legion
|
|
|
393
393
|
enforce: context[:enforce],
|
|
394
394
|
reason: result[:reason]
|
|
395
395
|
}.merge(context[:event_context]).compact
|
|
396
|
-
Legion::Events.emit(event_name, payload)
|
|
396
|
+
Legion::Events.emit(event_name, **payload)
|
|
397
397
|
rescue StandardError => e
|
|
398
398
|
handle_exception(e, level: :warn, operation: 'rbac.policy_engine.emit_decision_event', event: event_name)
|
|
399
399
|
end
|
data/lib/legion/rbac/routes.rb
CHANGED
data/lib/legion/rbac/version.rb
CHANGED
data/lib/legion/rbac.rb
CHANGED
|
@@ -87,10 +87,10 @@ module Legion
|
|
|
87
87
|
|
|
88
88
|
def events_enabled?
|
|
89
89
|
return false unless defined?(Legion::Events)
|
|
90
|
-
return false unless defined?(Legion::Settings)
|
|
91
90
|
|
|
92
91
|
Legion::Settings[:rbac]&.fetch(:emit_events, true) != false
|
|
93
|
-
rescue StandardError
|
|
92
|
+
rescue StandardError => e
|
|
93
|
+
handle_exception(e, level: :warn, operation: 'rbac.events_enabled')
|
|
94
94
|
false
|
|
95
95
|
end
|
|
96
96
|
|