Skip to content

feat(authz): dynamic value mapping and direct entitlement e2e coverage#3774

Open
alkalescent wants to merge 7 commits into
DSPX-4096-otdfctl-dynamic-value-mappingsfrom
DSPX-4097-e2e-dynamic-direct-entitlements
Open

feat(authz): dynamic value mapping and direct entitlement e2e coverage#3774
alkalescent wants to merge 7 commits into
DSPX-4096-otdfctl-dynamic-value-mappingsfrom
DSPX-4097-e2e-dynamic-direct-entitlements

Conversation

@alkalescent

@alkalescent alkalescent commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

  • Add claims-ERS support for direct entitlements: parse direct_entitlements from entity claims into EntityRepresentation.DirectEntitlements, gated by the experimental allow_direct_entitlements flag (service/entityresolution/claims/v2). Ported from the earlier direct-entitlement work.
  • Add BDD e2e coverage for dynamic value mappings via full TDF encrypt/decrypt (keycloak ERS): a new platform template with allow_dynamic_value_mappings enabled, a create a dynamic value mapping SDK step, and scenarios covering IN, IN_CONTAINS, a static pre-gate subject condition set, and ALL_OF multi-value (allow + deny).
  • Add BDD e2e coverage for direct entitlements via GetDecision PERMIT/DENY (the same AuthorizationV2 PDP path KAS rewrap uses, claims ERS): a new platform template with allow_direct_entitlements enabled, claims-entity steps, and scenarios covering action match/mismatch, a value not pre-provisioned in policy, and a subject-mapping + direct-entitlement combination.

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

  • cd service && go test ./entityresolution/claims/...
  • Build the BDD platform image and run the two features:
    • 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"
    • Verified locally: 9 scenarios (9 passed), 106 steps (106 passed).

Stacked on the otdfctl dynamic-value-mapping CLI branch; base is set accordingly so the diff is limited to this work.

Summary by CodeRabbit

  • New Features

    • Added configurable direct entitlement extraction from claims during entity resolution.
    • Supports entitlement actions and attribute values in multiple input formats.
    • Added end-to-end authorization scenarios for matching, mismatched, synthetic, and combined entitlements.
    • Added dynamic value mapping scenarios for encryption and decryption decisions.
  • Bug Fixes

    • Invalid entitlement data now returns clear validation errors instead of being silently accepted.

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>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 40d4d58e-c279-4315-8637-c3220804dcb6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch DSPX-4097-e2e-dynamic-direct-entitlements

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 211.217685ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 113.304371ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 430.708875ms
Throughput 232.18 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 46.505130164s
Average Latency 463.397524ms
Throughput 107.52 requests/second

@alkalescent
alkalescent marked this pull request as ready for review July 22, 2026 19:10
@alkalescent
alkalescent requested a review from a team as a code owner July 22, 2026 19:10
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b8b2f9 and 14293cc.

📒 Files selected for processing (9)
  • service/entityresolution/claims/v2/entity_resolution.go
  • service/entityresolution/claims/v2/entity_resolution_test.go
  • tests-bdd/cukes/resources/platform.direct_entitlements.template
  • tests-bdd/cukes/resources/platform.dynamic_value_mappings.template
  • tests-bdd/cukes/steps_directentitlements.go
  • tests-bdd/cukes/steps_dynamicvaluemappings.go
  • tests-bdd/features/direct-entitlements.feature
  • tests-bdd/features/dynamic-value-mappings.feature
  • tests-bdd/platform_test.go

Comment thread service/entityresolution/claims/v2/entity_resolution_test.go
Comment thread tests-bdd/features/dynamic-value-mappings.feature
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>
@alkalescent
alkalescent requested a review from a team as a code owner July 22, 2026 21:44
@github-actions

Copy link
Copy Markdown
Contributor
Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 201.052727ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 108.086459ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 431.735696ms
Throughput 231.62 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 46.022422851s
Average Latency 458.506308ms
Throughput 108.64 requests/second

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

  • examples
  • otdfctl
  • sdk
  • service
  • lib/fixtures
  • tests-bdd

See the workflow run for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant