Skip to content

Implement Apache Ranger Authorization Plugin for Apache Polaris (#274)#3928

Open
sneethiraj wants to merge 66 commits intoapache:mainfrom
sneethiraj:main
Open

Implement Apache Ranger Authorization Plugin for Apache Polaris (#274)#3928
sneethiraj wants to merge 66 commits intoapache:mainfrom
sneethiraj:main

Conversation

@sneethiraj
Copy link
Member

RFC : https://docs.google.com/document/d/10UIpPMeWVU3VA0goGz_y8OAbXhIDigah/edit?usp=sharing&ouid=103452742845206345322&rtpof=true&sd=true

This RFC proposes integrating Apache Ranger as an external authorization plugin for Apache Polaris by implementing the PolarisAuthorizer SPI. By leveraging Ranger’s mature ecosystem, Polaris can provide enterprises with centralized policy management, fine-grained resource-based access control (RBAC/ABAC), and comprehensive audit logging without replacing its internal authorization model. This integration addresses key enterprise challenges by providing a uniform, centralized security and governance platform for policy management and data access auditing.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

sneethiraj and others added 27 commits February 24, 2026 20:56
added unit tests to verify operations on ROOT and CATALOG
renamed ranger-plugin.properties to ranger-authorizer.properties
…d fixed some validations on permissions for targets/secondaries
…or secondaries - but, secondary objects are being passed on.
replaced multiple authz requests with a single request

# force the locale, just in case the system's using another default locale
quarkus.default-locale=en_US

Copy link
Contributor

Choose a reason for hiding this comment

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

ni: spurious change.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version = "3.2.3" }
cel-bom = { module = "org.projectnessie.cel:cel-bom", version = "0.6.0" }
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } # required by the polaris-java plugin
commons-collections = { module = "commons-collections:commons-collections", version = "3.2.2" }
Copy link
Contributor

Choose a reason for hiding this comment

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

These two new dependencies seem unused.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

exclude("org.apache.hadoop", "hadoop-client-api")
exclude("org.apache.hadoop", "hadoop-client-runtime")
}
implementation(libs.commons.lang3)
Copy link
Contributor

Choose a reason for hiding this comment

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

commons-lang seems unused.

Choose a reason for hiding this comment

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

commons.lang3 is used in RangerPolarisAuthorizerFactory and RangerUtils.

Comment on lines +33 to +35
implementation(libs.graalvm.js.js.scriptengine)
implementation(libs.graalvm.polyglot.js)
implementation(libs.graalvm.polyglot.polyglot)
Copy link
Contributor

Choose a reason for hiding this comment

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

All GraalVM dependencies seem unused, did you mean to use runtimeOnly instead?

Choose a reason for hiding this comment

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

Yes, that is correct; will change dependency to runtimeOnly. Thank you.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

@@ -0,0 +1,26 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems unused.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

@@ -0,0 +1,25 @@
#
Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems unused.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

import org.apache.polaris.core.persistence.ResolvedPolarisEntity;
import org.junit.jupiter.api.Test;

public class TestRangerPolarisAuthorizer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: the naming convention in Polaris is: RangerPolarisAuthorizerTest. Same for RangerPolarisAuthorizerFactoryTest.

Choose a reason for hiding this comment

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

Addressed in e6482c0.

import org.apache.polaris.core.entity.CatalogEntity;

public class RangerTestUtils {
public static RangerPolarisAuthorizerConfig createConfig() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you considered writing @QuarkusTests rather than pure unit tests instead? The advantage is that you don't need to create all the fixtures, and you would be testing the "real thing".

Choose a reason for hiding this comment

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

I haven't tried @QuarkusTest yet; can this be taken up in a follow-up PR? I would prefer to retain current light-weight unit tests though.


@Test
public void testAuthzRoot() throws Exception {
runTests(authorizer, "/authz_tests/tests_authz_root.json");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: what is the advantage of writing your test cases as JSON, just to have them mapped to Java beans with Jackson? Isn't it simpler to just write your test cases in Java, maybe with parameterized tests? Especially given the significant amount of boilerplate code related to Jackson deserialization that needs to be introduced.

Choose a reason for hiding this comment

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

I think capturing test input/output in Json format makes it easier to focus on test details, without any scaffolding distractions while doing the same in Java.

Copy link
Contributor

Choose a reason for hiding this comment

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

Quite frankly, something like this would be way more readable imho:

  @ParameterizedTest
  @CsvSource({
    "CREATE_CATALOG   , admin1 , ROOT:root_container , true",
    "LIST_CATALOGS    , admin1 , ROOT:root_container , true",
    "CREATE_PRINCIPAL , admin1 , ROOT:root_container , true",
    "LIST_PRINCIPALS  , admin1 , ROOT:root_container , true",
    "CREATE_CATALOG   , user1  , ROOT:root_container , false",
    "LIST_CATALOGS    , user1  , ROOT:root_container , true",
    "CREATE_PRINCIPAL , user1  , ROOT:root_container , false",
    "LIST_PRINCIPALS  , user1  , ROOT:root_container , true",
    "CREATE_CATALOG   , user2  , ROOT:root_container , false",
    "LIST_CATALOGS    , user2  , ROOT:root_container , false",
    "CREATE_PRINCIPAL , user2  , ROOT:root_container , false",
    "LIST_PRINCIPALS  , user2  , ROOT:root_container , false",
  })
  void testAuthzRoot(
      PolarisAuthorizableOperation authzOp,
      String principalName,
      String target,
      boolean isAllowed) {
    assertAuthz(authzOp, principalName, target, null, isAllowed);
  }

Choose a reason for hiding this comment

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

@adutra - ok, thanks for the sample. Unless this is a blocker, I would prefer to retain current unit tests.

@mneethiraj
Copy link

@adutra, @dimas-b, @flyingImer, @flyrain - thank you all so much for the thoroughness in reviewing the PR and suggestions. Are there any blocker items to address before this PR approved and merged?

@flyrain
Copy link
Contributor

flyrain commented Mar 19, 2026

Thanks @mneethiraj for working on it. LGTM overall. I'd suggest to file issues for followups and fix the CI failures.

Copy link
Contributor

@adnanhemani adnanhemani left a comment

Choose a reason for hiding this comment

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

Thanks all for the thorough reviews. I just took a look and everything looks about right except the few outstanding comments, which I believe are all for follow up items.

There's a failure in the CI, relating to Licenses and Notices. Once that's taken care of, I'd be ready to approve!

Thank you for this great work, @sneethiraj!

@mneethiraj
Copy link

Thanks @mneethiraj for working on it. LGTM overall. I'd suggest to file issues for followups and fix the CI failures.

Thanks @flyrain. I updated the LICENSE file to address failures in polaris-server:generateLicenseReport. Now, CI fails with the following.

{
    "dependenciesWithoutAllowedLicenses": [
        {
            "moduleName": "org.graalvm.shadowed:icu4j",
            "moduleLicense": "Unicode/ICU License",
            "moduleVersion": "25.0.2"
        }
    ]
}

@flyrain, @adutra, @dimas-b - can you please review and confirm that this license is indeed not allowed? If its not allowed, the only option seems to exclude this library. It seems excluding this library can result in failures in locale-specific handling of custom expressions in Ranger policies. Though this issue may not impact most use cases of Ranger policies, needs to be investigated further and documented.

@flyrain
Copy link
Contributor

flyrain commented Mar 19, 2026

Unicode license is OK to include, https://www.apache.org/legal/resolved.html#category-a. We need to update the license checker.

@sneethiraj
Copy link
Member Author

Thanks @adnanhemani for your efforts to review and provide valuable comments!

@mneethiraj
Copy link

Unicode license is OK to include, https://www.apache.org/legal/resolved.html#category-a. We need to update the license checker.

Thanks @flyrain. Apart from above failure from ./gradlew :polaris-server:checkLicense, there are no more CI issues for this PR. This CI failure would be addressed once the licensr checker is updated to allow Unicode/ICU License. @dimas-b, @jbonofre - will you be able to help with this please? Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants