add kas registry authorizer#3566
Conversation
Summary of ChangesHello, 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 enhances the platform's authorization capabilities by introducing a mechanism for scoped authorization resolvers. It specifically targets the Key Access Server (KAS) Registry service, enabling it to register custom resolvers that evaluate requests against KAS-specific dimensions. Additionally, it improves the authentication layer by allowing OAuth client IDs to be used as subjects in authorization policies, providing more granular control over service-to-service interactions. Highlights
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 AssistThe 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
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 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 policy rules are now refined, With client IDs and KAS aligned. Authorization flows with grace, Securing every digital space. Footnotes
|
|
Important Review skippedDraft detected. 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 |
There was a problem hiding this comment.
Code Review
This pull request introduces support for treating configured OAuth client ID claims as first-class subjects in Casbin authorization, allowing direct policy authorization for service clients. It also implements authorization resolvers for the Key Access Server (KAS) registry service to resolve resource dimensions (such as KAS ID, name, and URI) for policy evaluation. Feedback is provided regarding a potential nil pointer dereference or database query error in getKeyAccessServerAuthzResolver if both the ID and identifier are missing from the request, suggesting an explicit nil check.
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.
| if err := s.addResolvedKASDimensions(ctx, res, msg.GetIdentifier()); err != nil { | ||
| return resolverCtx, err | ||
| } |
There was a problem hiding this comment.
If both msg.GetId() is empty and msg.GetIdentifier() is nil (which can happen if the request is missing both fields), msg.GetIdentifier() will return nil. Passing nil as the identifier to addResolvedKASDimensions (and subsequently to dbClient.GetKeyAccessServer) can lead to a database query error or a potential nil pointer dereference/panic depending on the database client's implementation.
We should explicitly check if msg.GetIdentifier() is nil and return an error early.
if msg.GetIdentifier() == nil {
return resolverCtx, errors.New("no key access server identifier provided")
}
if err := s.addResolvedKASDimensions(ctx, res, msg.GetIdentifier()); err != nil {
return resolverCtx, err
}
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
NANOTDF Benchmark Results:
|
Proposed Changes
Checklist
Testing Instructions