feat: druid-opa-authorizer extension for Open Policy Agent authorization#19670
Open
JWuCines wants to merge 13 commits into
Open
feat: druid-opa-authorizer extension for Open Policy Agent authorization#19670JWuCines wants to merge 13 commits into
JWuCines wants to merge 13 commits into
Conversation
Member
|
We originally developed this authorizer at @stackabletech and are happy to "donate" it. Just commenting to make clear that this definitely has our blessing (not that it's needed due to the license anyway). |
FrankChen021
reviewed
Jul 9, 2026
FrankChen021
left a comment
Member
There was a problem hiding this comment.
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
Reviewed 34 of 34 changed files.
Found one availability issue in the new OPA authorizer: OPA authorization calls are synchronous and currently unbounded, so a hung policy endpoint can tie up Druid request threads instead of failing closed promptly.
This is an automated review by Codex GPT-5.5
257f45f to
7ddeea6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
druid-opa-authorizer extension for Open Policy Agent authorization
Description
This PR integrates the druid-opa-authorizer extension into the Apache Druid repository. The extension delegates authorization decisions to an Open Policy Agent (OPA) server, allowing users to define fine-grained access control policies using Rego rules.
Added the OPA Authorizer extension
The core authorizer sends a JSON payload containing the
AuthenticationResult,Action, andResourceto a configurable OPA endpoint and interprets the booleanresultfrom the OPA response. Key design decisions:java.net.http.HttpClientfor OPA communication (no additional HTTP dependencies needed).ObjectMapperconfigured withFAIL_ON_UNKNOWN_PROPERTIES = falsefor forward compatibility with new OPA response fields (e.g.,decision_id).AuthenticationResultcontext to handle non-serializable LDAPSearchResultobjects, converting byte array attributes to Base64 strings.NamingEnumerationresources when iterating LDAP attributes.Added embedded Docker tests
Two embedded test configurations using Testcontainers:
Added documentation and examples
docs/development/extensions-contrib/druid-opa-authorizer.mdcovering configuration, Rego rule authoring, local setup with basic auth, and LDAP integration.example/directory.Release note
Added a new community extension
druid-opa-authorizerthat enables authorization through Open Policy Agent (OPA). Users can write Rego policies to control access to Druid resources based on user identity, action, and resource type. The extension supports both basic authentication and LDAP authentication workflows.Key changed/added classes in this PR
OpaAuthorizer— Core authorizer that communicates with the OPA serverOpaDruidModule— Druid module that registers theopaauthorizer typeOpaInput/OpaMessage/OpaResource/OpaResponse— JSON serialization types for OPA communicationOpaBasicAuthResource/OpaLdapAuthResource— Embedded test Docker resourcesOpaBasicAuthConfigurationDockerTest/OpaLdapAuthConfigurationDockerTest— Embedded integration testsThis PR has: