Skip to content

feat(core): Fix some authz issues.#3574

Merged
c-r33d merged 2 commits into
DSPX-2190-enrich-casbinfrom
DSPX-2190-step1-security-readiness
Jun 5, 2026
Merged

feat(core): Fix some authz issues.#3574
c-r33d merged 2 commits into
DSPX-2190-enrich-casbinfrom
DSPX-2190-step1-security-readiness

Conversation

@c-r33d
Copy link
Copy Markdown
Contributor

@c-r33d c-r33d commented Jun 5, 2026

Summary

Step 1 production-readiness security changes for PR #2999.

This wires the authz resolver registry into the server authenticator path so v2 authorization can resolve request-specific resource dimensions during interceptor authorization. It also adds default
Casbin v2 grouping statements for the built-in admin and standard roles, without reintroducing deprecated RoleMap behavior.

Changes

  • Pass AuthzResolverRegistry from server startup into auth.NewAuthenticator
  • Share the same resolver registry between service registration and auth enforcement
  • Add built-in v2 Casbin grouping statements:
    • role:opentdf-admin -> role:admin
    • role:opentdf-standard -> role:standard
  • Add unit coverage proving:
    • registered authz resolvers are invoked by v2 authorization
    • resolved resource context is passed into authorization
    • default v2 policy allows opentdf-admin through grouping statements

Verification

Ran:

go test ./service/internal/auth/... ./service/internal/server/... ./service/pkg/server/...

Also ran targeted tests for resolver invocation and default role grouping behavior.

Notes

Customer policy override behavior is preserved. A customer can still replace the built-in Casbin policy with server.auth.policy.csv and omit the default opentdf-admin role mapping if they do not want
that role.

@c-r33d c-r33d requested a review from a team as a code owner June 5, 2026 13:47
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 5, 2026

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: 52baa004-8696-4d37-a0bd-9c6e6d1c4777

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-2190-step1-security-readiness

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 and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements security enhancements for production readiness by centralizing the authorization resolver registry. By wiring this registry into the server startup and authentication flow, the system can now dynamically resolve resource dimensions during interceptor authorization. Additionally, it establishes default role mappings for standard and admin users, ensuring consistent access control without relying on deprecated patterns.

Highlights

  • Authz Resolver Integration: Integrated the AuthzResolverRegistry into the server authenticator path to enable v2 authorization to resolve request-specific resource dimensions.
  • Default Casbin Roles: Added default Casbin v2 grouping statements for 'opentdf-admin' and 'opentdf-standard' roles to simplify authorization management.
  • Test Coverage: Expanded unit tests to verify resolver invocation, resource context passing, and correct enforcement of default role groupings.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


The roles are mapped with care and grace, To keep the auth in proper place. With resolvers set and registry clear, The path to access is now quite near.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the authorization system by initializing the global authorization resolver registry earlier in the server startup sequence, passing it to the authentication interceptor, and adding corresponding policy role mappings and tests. Feedback on the changes suggests replacing s.T().Context() with context.Background() in the new interceptor tests to ensure backward compatibility with Go versions prior to 1.24 and maintain consistency across the test suite.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread service/internal/auth/interceptor_authz_test.go
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 223.070138ms
Throughput 448.29 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 24.322211422s
Average Latency 242.281829ms
Throughput 205.57 requests/second

NANOTDF Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 16.471973445s
Average Latency 164.127878ms
Throughput 303.55 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

@c-r33d c-r33d force-pushed the DSPX-2190-step1-security-readiness branch from f6f0d88 to 8889298 Compare June 5, 2026 18:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Dependency Review

The following issues were found:

  • ❌ 1 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 175 package(s) with unknown licenses.
  • ⚠️ 11 packages with OpenSSF Scorecard issues.

View full job summary

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 494.619407ms
Throughput 202.18 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.03618577s
Average Latency 428.872336ms
Throughput 116.18 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

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

Benchmark authorization.v2.GetMultiResourceDecision Results:

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

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 465.033872ms
Throughput 215.04 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 43.140187844s
Average Latency 429.529531ms
Throughput 115.90 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

⚠️ Govulncheck found vulnerabilities ⚠️

The following modules have known vulnerabilities:

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

See the workflow run for details.

@c-r33d c-r33d merged commit 31afdb8 into DSPX-2190-enrich-casbin Jun 5, 2026
34 of 35 checks passed
@c-r33d c-r33d deleted the DSPX-2190-step1-security-readiness branch June 5, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants