feat(authz): dynamic value mapping and direct entitlement e2e coverage#3774
Conversation
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>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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
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>
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
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
New Features
Bug Fixes