-
Notifications
You must be signed in to change notification settings - Fork 39
feat(authz): Namespaced policy in decisioning #3226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
elizabethhealy
merged 31 commits into
main
from
dspx-2753-namespaced-policy-decisioning
Apr 20, 2026
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
7094768
adr
elizabethhealy 51273df
namespaced policy in decisions
elizabethhealy 5d1dfd1
add cukes
elizabethhealy 3441f0d
more cukes scenarios
elizabethhealy 194bf75
Merge branch 'main' into dspx-2753-namespaced-policy-decisioning
elizabethhealy 3ca7554
lint, attempt to fix bdd
elizabethhealy 26740fd
use require
elizabethhealy 6278ba4
code rabbit suggestions
elizabethhealy d26824c
remove file
elizabethhealy 3af77a2
direct entitlement handling
elizabethhealy fc917bf
linting, rename function
elizabethhealy d2fed66
update ok
elizabethhealy 2d17070
update features, change attr naming
elizabethhealy e03b0e5
add comments, fix attr rule
elizabethhealy 7ef6a6e
coderabbit suggestions
elizabethhealy eb7dd89
handle namespaced rr fqn indexing
elizabethhealy 4743bc1
rename flag, address comment
elizabethhealy ca09e51
suggestions
elizabethhealy 49eec3f
lint
elizabethhealy fb9554b
Merge branch 'main' into dspx-2753-namespaced-policy-decisioning
elizabethhealy 5078bd2
remove trace log for action id/name mismatch
elizabethhealy f1bfac9
RR entities and resource should be namespaced if flag on
elizabethhealy 5eb0db3
better cukes setup with template add specific deny scenarios
elizabethhealy ef57189
add un-namespaced sm to feature
elizabethhealy 57b785c
populate namespace for action for decisioning check
elizabethhealy 1384ee5
move into validators, use fqns instead of id, remove scoped
elizabethhealy 79e3a29
Merge branch 'main' into dspx-2753-namespaced-policy-decisioning
elizabethhealy f026dbe
extend integration test
elizabethhealy 7612d4e
linting
elizabethhealy c89d3e4
lint
elizabethhealy 6eb73e0
lint
elizabethhealy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
adr/decisions/2026-03-30-namespaced-subject-mappings-decisioning.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| --- | ||
| status: 'proposed' | ||
| date: '2026-03-30' | ||
| tags: | ||
| - policy | ||
| - authorization | ||
| - namespaced-policy | ||
| driver: '@elizabethhealy' | ||
| --- | ||
|
|
||
| # Namespaced Subject Mapping Decisioning in PDP | ||
|
|
||
| ## Context and Problem Statement | ||
|
|
||
| Policy objects are moving toward strict namespace ownership, but access decisioning still treats actions as unscoped names in several evaluation paths. Subject mappings are also transitioning from legacy unnamespaced records to namespace-owned records. This creates ambiguity when a request action name exists in multiple namespaces and when a single resource includes attributes from multiple namespaces. | ||
|
|
||
| We need a decisioning model that is namespace-correct, fail-closed, and compatible with staged rollout using the `EnforceNamespacedEntitlements` feature flag. | ||
|
|
||
| ## Decision Drivers | ||
|
|
||
| - Preserve existing multi-namespace resource semantics (`AND` behavior) while adding namespace correctness. | ||
| - Prevent cross-namespace action matches when namespaced policy mode is enabled. | ||
| - Keep rollout safe via feature-flagged behavior split. | ||
| - Avoid startup coupling by keeping standard-action checks lazy at evaluation time. | ||
|
|
||
| ## Decision Outcome | ||
|
|
||
| Chosen option: **Resolve request action identity within each evaluation namespace context**. | ||
|
|
||
| For `GetDecisionRequest`/`GetDecisionMultiResourceRequest`, request validation still requires `action.name` (current proto contract). During evaluation, matching is always applied per namespace context (derived from the rule/value being evaluated), not globally. | ||
|
|
||
| Request-action matching precedence is explicit (given the request action object): | ||
|
|
||
| 1. `action.id` (exact identity, when present) | ||
| 2. `action.name + action.namespace` (scoped identity, when namespace is present) | ||
| 3. `action.name` only (contextual identity) | ||
|
|
||
| When identity is explicit (`id` or `name+namespace`), decisioning does not fall back to looser name-only matching. It fails closed only if that explicit identity is unresolved or mismatched for the evaluated namespace context. | ||
|
|
||
| Feature-flag mode split: | ||
|
|
||
| - `EnforceNamespacedEntitlements=false`: preserve existing legacy behavior (no new namespace filtering semantics introduced by this change). | ||
| - `EnforceNamespacedEntitlements=true`: enforce namespaced subject mapping evaluation (unnamespaced SMs are ignored) and require action namespace equality for each evaluated namespace. | ||
|
|
||
| Direct entitlements in strict mode: | ||
|
|
||
| - Direct entitlements are still modeled as action names per attribute-value FQN. | ||
| - During PDP evaluation, each direct-entitlement action is hydrated with the namespace of its attributed value context. | ||
| - This makes direct entitlements participate in the same namespace-aware action matching rules as subject-mapping-derived entitlements. | ||
| - Direct-entitlement actions are merged with subject-mapping actions per value FQN (not replacing them). | ||
|
|
||
| Subject mapping namespace enforcement (strict mode): | ||
|
|
||
| - Subject mapping namespace must match the namespace of the referenced attribute value. | ||
| - Subject mapping namespace must match the namespace of the referenced subject condition set. | ||
| - Name-based action matching is evaluated in the same namespace context as the SM/value under evaluation. | ||
|
|
||
| For multi-namespace resources, existing `AND` semantics remain unchanged: all required namespace-scoped checks must pass, and missing action support in any required namespace denies access. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - 🟩 **Good**, because action evaluation becomes deterministic and namespace-safe. | ||
| - 🟩 **Good**, because feature-flagged split allows staged migration without mixed-mode ambiguity. | ||
| - 🟩 **Good**, because fail-closed behavior prevents accidental entitlement via cross-namespace action reuse. | ||
| - 🟥 **Bad**, because policy admins must ensure required actions exist in each relevant namespace. | ||
| - 🟥 **Bad**, because debugging becomes harder without explicit namespace-aware logs. | ||
|
|
||
| ## Validation | ||
|
|
||
| Validation is done through PDP and decisioning tests covering: | ||
|
|
||
| - mode split (`EnforceNamespacedEntitlements=false` vs `true`) for subject mapping inclusion, | ||
| - strict-mode subject mapping namespace scoping (unnamespaced SMs skipped), | ||
| - namespace-aware action matching in rule evaluation paths, | ||
| - multi-namespace resource behavior where one missing namespace action causes deny, | ||
| - regression checks to confirm existing `AND` behavior is preserved. | ||
|
|
||
| ## Implementation Notes | ||
|
|
||
| - Thread `EnforceNamespacedEntitlements` into PDP runtime configuration. | ||
| - Filter subject mappings at PDP construction by mode (namespaced vs unnamespaced). | ||
| - Enforce subject mapping namespace consistency during create/update operations. | ||
| - Centralize action matching in a namespace-aware helper used by all rule/action checks. | ||
| - Derive required namespace per evaluated value/rule context. | ||
| - Keep standard/custom action existence checks lazy at evaluation time. | ||
| - Add debug logs including requested action, required namespace, candidate namespace, and rule/value context. | ||
|
elizabethhealy marked this conversation as resolved.
|
||
|
|
||
| ## Rollout | ||
|
|
||
| 1. Land logic behind `EnforceNamespacedEntitlements`. | ||
| 2. Keep default mode as legacy (`false`) until policy data migration is complete. | ||
| 3. Validate namespaced policy data readiness. | ||
| 4. Flip `EnforceNamespacedEntitlements=true` and monitor mismatch/deny behavior. | ||
| 5. Remove legacy branch once namespaced mode is stable. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.