legion-rbac 0.3.0 → 0.3.2
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 +12 -0
- data/CLAUDE.md +4 -1
- data/README.md +1 -1
- data/lib/legion/rbac/settings.rb +1 -0
- data/lib/legion/rbac/store.rb +3 -1
- data/lib/legion/rbac/version.rb +1 -1
- data/lib/legion/rbac.rb +20 -4
- 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: 6971b76fa8052ff121e686629a6abcf800d6819afbffe4fc0adcf146f9b00b1d
|
|
4
|
+
data.tar.gz: 97c808593590d1416dc799b3711fa0353d86f55307c16b71cde4ab5e704a093c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6ef4dce9750b6de9544a49f12df5311f3a312a35ee46c89465f724b5ea0d02822bd9a8c23954665df498985a143913c4012f83401e8b0b12f776fd71e624eb2
|
|
7
|
+
data.tar.gz: 97bb68fae5dc33ac682461a12ef626ec8e5e392250ef11391381a9ad3212f587385648dcda982f6bcf2d9fc2bb601cdde9d699b58924da8bf4f7c73950164f54
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.2] - 2026-04-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `client_id: nil` default added to Entra settings block for explicit Azure AD app registration tracking
|
|
7
|
+
|
|
8
|
+
## [0.3.1] - 2026-04-03
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- `authorize!` and `authorize_execution!` now early-return when `rbac.enabled: false`, preventing NameError on missing RBAC models
|
|
12
|
+
- `authorize!` and `authorize_execution!` respect `rbac.enforce: false` — logs denials but does not raise AccessDenied
|
|
13
|
+
- `Store.db_available?` now also checks that `RbacRoleAssignment` model constant is defined before attempting DB queries
|
|
14
|
+
|
|
3
15
|
## [0.3.0] - 2026-04-02
|
|
4
16
|
|
|
5
17
|
### Changed
|
data/CLAUDE.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Parent**: `/Users/miverso2/rubymine/legion/CLAUDE.md`
|
|
4
4
|
**GitHub**: https://github.com/LegionIO/legion-rbac
|
|
5
|
-
**Version**: 0.2
|
|
5
|
+
**Version**: 0.3.2
|
|
6
6
|
|
|
7
7
|
Optional RBAC gem for LegionIO. Vault-style flat policy model with deny-always-wins semantics.
|
|
8
8
|
|
|
@@ -29,6 +29,9 @@ lib/legion/rbac/policy_engine.rb # Core evaluator
|
|
|
29
29
|
lib/legion/rbac/team_scope.rb # Cross-team access validation
|
|
30
30
|
lib/legion/rbac/store.rb # Dual-mode data access
|
|
31
31
|
lib/legion/rbac/middleware.rb # Rack middleware
|
|
32
|
+
lib/legion/rbac/routes.rb # Sinatra REST API routes for RBAC management
|
|
33
|
+
lib/legion/rbac/capability_registry.rb # Per-extension capability declarations and querying
|
|
34
|
+
lib/legion/rbac/capability_audit.rb # Source code scanning for dangerous patterns; enforces declared capabilities
|
|
32
35
|
lib/legion/rbac/entra_claims_mapper.rb # Entra ID claims -> Legion roles
|
|
33
36
|
lib/legion/rbac/kerberos_claims_mapper.rb # Kerberos principal + AD groups -> Legion roles
|
|
34
37
|
```
|
data/README.md
CHANGED
data/lib/legion/rbac/settings.rb
CHANGED
data/lib/legion/rbac/store.rb
CHANGED
|
@@ -9,7 +9,9 @@ module Legion
|
|
|
9
9
|
|
|
10
10
|
class << self
|
|
11
11
|
def db_available?
|
|
12
|
-
available = defined?(Legion::Data)
|
|
12
|
+
available = (defined?(Legion::Data) &&
|
|
13
|
+
Legion::Settings[:data]&.dig(:connected) == true &&
|
|
14
|
+
defined?(Legion::Data::Model::RbacRoleAssignment)) || false
|
|
13
15
|
log.debug("RBAC store db_available=#{available}")
|
|
14
16
|
available
|
|
15
17
|
end
|
data/lib/legion/rbac/version.rb
CHANGED
data/lib/legion/rbac.rb
CHANGED
|
@@ -78,6 +78,12 @@ module Legion
|
|
|
78
78
|
Legion::Settings[:rbac]&.fetch(:enabled, true) != false
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
+
def enforcing?
|
|
82
|
+
return true unless defined?(Legion::Settings)
|
|
83
|
+
|
|
84
|
+
Legion::Settings[:rbac]&.fetch(:enforce, true) != false
|
|
85
|
+
end
|
|
86
|
+
|
|
81
87
|
def events_enabled?
|
|
82
88
|
return false unless defined?(Legion::Events)
|
|
83
89
|
return false unless defined?(Legion::Settings)
|
|
@@ -88,15 +94,22 @@ module Legion
|
|
|
88
94
|
end
|
|
89
95
|
|
|
90
96
|
def authorize!(principal:, action:, resource:, **)
|
|
97
|
+
return { allowed: true, reason: 'rbac disabled' } unless enabled?
|
|
98
|
+
|
|
91
99
|
result = PolicyEngine.evaluate(principal: principal, action: action, resource: resource, **)
|
|
92
100
|
log.info("RBAC authorize principal=#{principal.id} action=#{action} resource=#{resource} allowed=#{result[:allowed]}")
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
|
|
102
|
+
unless result[:allowed]
|
|
103
|
+
log.warn("RBAC authorize denied principal=#{principal.id} reason=#{result[:reason]}")
|
|
104
|
+
raise AccessDenied, result if enforcing?
|
|
105
|
+
end
|
|
95
106
|
|
|
96
107
|
result
|
|
97
108
|
end
|
|
98
109
|
|
|
99
110
|
def authorize_execution!(principal:, runner_class:, function:, target_team: nil, **)
|
|
111
|
+
return { allowed: true, reason: 'rbac disabled' } unless enabled?
|
|
112
|
+
|
|
100
113
|
runner_path = build_runner_path(runner_class, function)
|
|
101
114
|
log.info(
|
|
102
115
|
"RBAC authorize_execution principal=#{principal.id} runner=#{runner_path} " \
|
|
@@ -109,8 +122,11 @@ module Legion
|
|
|
109
122
|
target_team: target_team,
|
|
110
123
|
**
|
|
111
124
|
)
|
|
112
|
-
|
|
113
|
-
|
|
125
|
+
|
|
126
|
+
unless result[:allowed]
|
|
127
|
+
log.warn("RBAC authorize_execution denied principal=#{principal.id} reason=#{result[:reason]}")
|
|
128
|
+
raise AccessDenied, result if enforcing?
|
|
129
|
+
end
|
|
114
130
|
|
|
115
131
|
result
|
|
116
132
|
end
|