feat(authz): dynamic value mapping and direct entitlement e2e coverage - #3774
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThis PR adds configurable direct-entitlement extraction to claims entity resolution and introduces dynamic value mapping support across CLI commands, handlers, BDD steps, platform templates, documentation, and tests. ChangesDirect entitlement resolution
Dynamic value mapping workflows
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant ClaimsSubject
participant EntityResolution
participant AuthorizationV2
ClaimsSubject->>EntityResolution: submit claims with direct_entitlements
EntityResolution->>AuthorizationV2: provide normalized DirectEntitlements
AuthorizationV2-->>ClaimsSubject: evaluate permit or deny
sequenceDiagram
participant Operator
participant otdfctl
participant Handler
participant PolicyService
Operator->>otdfctl: submit dynamic value mapping command
otdfctl->>Handler: resolve attribute and validate operator
Handler->>PolicyService: create, list, update, or delete mapping
PolicyService-->>Operator: return mapping result
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@service/entityresolution/claims/v2/entity_resolution_test.go`:
- Around line 96-154: Add unit-test coverage in the claims entity-resolution
tests for malformed direct-entitlement payloads handled by
parseDirectEntitlementsFromClaims, parseDirectEntitlementFQN, and
parseDirectEntitlementActions. Cover a non-array direct_entitlements value, a
missing attribute_value_fqn, and missing or invalid actions; assert
EntityResolution returns an error with connect.CodeInvalidArgument for each
case.
In `@tests-bdd/features/dynamic-value-mappings.feature`:
- Around line 51-63: Extend the “Static pre-gate must also pass for entitlement”
scenario with a subject whose department matches the dynamic mapping but whose
attributes fail the alpha condition set, then encrypt a value and assert that
subject’s decryption is denied. Keep Alice’s successful decryption assertion
unchanged and use the existing subject/token setup patterns.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 393a6f22-25e6-470c-b65e-9e9ab78bf2ad
📒 Files selected for processing (9)
service/entityresolution/claims/v2/entity_resolution.goservice/entityresolution/claims/v2/entity_resolution_test.gotests-bdd/cukes/resources/platform.direct_entitlements.templatetests-bdd/cukes/resources/platform.dynamic_value_mappings.templatetests-bdd/cukes/steps_directentitlements.gotests-bdd/cukes/steps_dynamicvaluemappings.gotests-bdd/features/direct-entitlements.featuretests-bdd/features/dynamic-value-mappings.featuretests-bdd/platform_test.go
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@otdfctl/docs/man/policy/dynamic-value-mappings/create.md`:
- Line 61: Fenced examples lack the required blank line before their opening
fences. In otdfctl/docs/man/policy/dynamic-value-mappings/create.md at lines
61-61 and 66-66, delete.md at lines 24-24 and 29-29, and get.md at lines 22-22
and 27-27, insert a blank line immediately before each fence without changing
the example contents.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 511f57b1-f459-41c7-a7ed-2de96b65ea09
⛔ Files ignored due to path filters (1)
tests-bdd/go.sumis excluded by!**/*.sum
📒 Files selected for processing (11)
otdfctl/cmd/policy/dynamicValueMappings.gootdfctl/docs/man/policy/dynamic-value-mappings/create.mdotdfctl/docs/man/policy/dynamic-value-mappings/delete.mdotdfctl/docs/man/policy/dynamic-value-mappings/get.mdotdfctl/docs/man/policy/dynamic-value-mappings/list.mdotdfctl/e2e/dynamic-value-mapping.batsotdfctl/pkg/handlers/dynamicvaluemappings.goservice/entityresolution/claims/v2/entity_resolution.goservice/entityresolution/claims/v2/entity_resolution_test.gotests-bdd/features/dynamic-value-mappings.featuretests-bdd/go.mod
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
…pings Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
…ondition-set flags, flag grouping, docs) Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
c919cbb to
cb2f422
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@otdfctl/pkg/handlers/dynamicvaluemappings.go`:
- Around line 20-25: Add colocated table-driven tests in
otdfctl/pkg/handlers/dynamicvaluemappings_test.go for
getAttributeDefinitionIDAndFQN, covering valid UUID, FQN, and empty-string
inputs. Add tests in otdfctl/cmd/policy/dynamicValueMappings_test.go for
parseDynamicValueMappingActions covering UUID-versus-name branching, and
parseDynamicValueMappingOperator covering accepted and rejected operators,
including NOT_IN and UNSPECIFIED.
In `@service/entityresolution/claims/v2/entity_resolution.go`:
- Around line 34-36: Remove the unsupported default struct tag from
Config.AllowDirectEntitlements, keeping the mapstructure and json annotations
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 9ec76ba2-bd09-4926-b4ff-2ca295f90499
⛔ Files ignored due to path filters (1)
tests-bdd/go.sumis excluded by!**/*.sum
📒 Files selected for processing (17)
otdfctl/cmd/policy/dynamicValueMappings.gootdfctl/docs/man/policy/dynamic-value-mappings/create.mdotdfctl/docs/man/policy/dynamic-value-mappings/delete.mdotdfctl/docs/man/policy/dynamic-value-mappings/get.mdotdfctl/docs/man/policy/dynamic-value-mappings/list.mdotdfctl/e2e/dynamic-value-mapping.batsotdfctl/pkg/handlers/dynamicvaluemappings.goservice/entityresolution/claims/v2/entity_resolution.goservice/entityresolution/claims/v2/entity_resolution_test.gotests-bdd/cukes/resources/platform.direct_entitlements.templatetests-bdd/cukes/resources/platform.dynamic_value_mappings.templatetests-bdd/cukes/steps_directentitlements.gotests-bdd/cukes/steps_dynamicvaluemappings.gotests-bdd/features/direct-entitlements.featuretests-bdd/features/dynamic-value-mappings.featuretests-bdd/go.modtests-bdd/platform_test.go
…default tag Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
… log Signed-off-by: Krish Suchak <suchak.krish@gmail.com>
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
elizabethhealy
left a comment
There was a problem hiding this comment.
lgtm pending jp's response
🤖 I have created a release *beep* *boop* --- ## [0.24.0](opentdf/platform@service/v0.23.0...service/v0.24.0) (2026-07-30) ### Features * **authz:** dynamic value mapping and direct entitlement e2e coverage ([opentdf#3774](opentdf#3774)) ([49c80a0](opentdf@49c80a0)) ### Bug Fixes * **ers:** Add postgres_object output transformation for JSON/JSONB results ([opentdf#3800](opentdf#3800)) ([4618439](opentdf@4618439)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0) (2026-08-04) ### ⚠ BREAKING CHANGES * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ### Features * **authz:** dynamic value mapping and direct entitlement e2e coverage ([opentdf#3774](opentdf#3774)) ([49c80a0](opentdf@49c80a0)) * **cli:** add an sdkfactory for optional override in otdfctl for extension ([opentdf#3793](opentdf#3793)) ([c2f2afe](opentdf@c2f2afe)) * **cli:** add dynamic value mapping CRUD commands and e2e tests ([opentdf#3768](opentdf#3768)) ([aecd265](opentdf@aecd265)) * **cli:** expose handler hook for injecting SDK options ([opentdf#3755](opentdf#3755)) ([76305b0](opentdf@76305b0)) * **cli:** Unsafe update key cli ([opentdf#3733](opentdf#3733)) ([65d888e](opentdf@65d888e)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to 0.39.0 in /otdfctl ([opentdf#3765](opentdf#3765)) ([a3346f8](opentdf@a3346f8)) * **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0 in /otdfctl ([opentdf#3773](opentdf#3773)) ([490c990](opentdf@490c990)) * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ([0d3c0a0](opentdf@0d3c0a0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com> Co-authored-by: Elizabeth Healy <35498075+elizabethhealy@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.36.0](opentdf/platform@otdfctl/v0.35.0...otdfctl/v0.36.0) (2026-08-04) ### ⚠ BREAKING CHANGES * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ### Features * **authz:** dynamic value mapping and direct entitlement e2e coverage ([opentdf#3774](opentdf#3774)) ([49c80a0](opentdf@49c80a0)) * **cli:** add an sdkfactory for optional override in otdfctl for extension ([opentdf#3793](opentdf#3793)) ([c2f2afe](opentdf@c2f2afe)) * **cli:** add dynamic value mapping CRUD commands and e2e tests ([opentdf#3768](opentdf#3768)) ([aecd265](opentdf@aecd265)) * **cli:** expose handler hook for injecting SDK options ([opentdf#3755](opentdf#3755)) ([76305b0](opentdf@76305b0)) * **cli:** Unsafe update key cli ([opentdf#3733](opentdf#3733)) ([65d888e](opentdf@65d888e)) ### Bug Fixes * **deps:** bump github.com/opentdf/platform/protocol/go from 0.36.0 to 0.39.0 in /otdfctl ([opentdf#3765](opentdf#3765)) ([a3346f8](opentdf@a3346f8)) * **deps:** bump github.com/opentdf/platform/sdk from 0.25.0 to 0.27.0 in /otdfctl ([opentdf#3773](opentdf#3773)) ([490c990](opentdf@490c990)) * **policy:** GetPC does not respect manager field. ([opentdf#3752](opentdf#3752)) ([0d3c0a0](opentdf@0d3c0a0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Proposed Changes
direct_entitlementsfrom entity claims intoEntityRepresentation.DirectEntitlements, gated by the experimentalallow_direct_entitlementsflag (service/entityresolution/claims/v2). Ported from the earlier direct-entitlement work.allow_dynamic_value_mappingsenabled, acreate a dynamic value mappingSDK step, and scenarios coveringIN,IN_CONTAINS, a static pre-gate subject condition set, and ALL_OF multi-value (allow + deny).GetDecisionPERMIT/DENY (the same AuthorizationV2 PDP path KAS rewrap uses, claims ERS): a new platform template withallow_direct_entitlementsenabled, claims-entity steps, and scenarios covering action match/mismatch, a value not pre-provisioned in policy, and a subject-mapping + direct-entitlement combination.Checklist
Testing Instructions
cd service && go test ./entityresolution/claims/...docker build -t platform-cukes .cd tests-bdd && PLATFORM_IMAGE=platform-cukes:latest go test -tags cukes -v -run TestFeatures . --godog.tags="@dynamic-value-mappings,@direct-entitlements"Summary by CodeRabbit
direct_entitlements(behind a configuration flag).direct_entitlementsnow produce clearer invalid-argument errors; FQN/action values are normalized.otdfctlman pages/examples to match updated dynamic value mappings CLI flags.