-
Notifications
You must be signed in to change notification settings - Fork 332
Feature: Expose resetCredentials via a new reset api to allow root user to reset credentials for an existing principal with custom values #2197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dimas-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, @fivetran-arunsuri !
As far as I understand, principal secrets rotation is implemented only for JDBC persistence... I think EclipseLink (being deprecated) is ok to exclude from this feature, but the tree map (in-memory) persistence should probably have an implementation too (to support full API with in-memory servers).
Could you also add integration tests exercising both the happy path and authorization errors?
service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java
Outdated
Show resolved
Hide resolved
service/common/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java
Show resolved
Hide resolved
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/entity/PolarisPrincipalSecrets.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/entity/PolarisPrincipalSecrets.java
Outdated
Show resolved
Hide resolved
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
|
@fivetran-arunsuri : please check CI errors. |
@dimas-b I’ve added the in-memory TreeMap implementation as well as the corresponding integration tests. However, I’m currently having trouble running the integration tests locally. I couldn’t find much detail around this in the README either. Could you please guide me on how to set them up or point me to any relevant documentation? The error I am seeing is as follows: Caused by: java.lang.ExceptionInInitializerError |
@dimas-b Also , I don't have access to run the ci checks by myself |
|
@dimas-b 've addressed most of the comments on the PR and would appreciate your suggestions on a few remaining points. Looking forward to your review and hoping to get this merged soon. Thanks! |
b94fe83 to
0f194a1
Compare
This looks like a class path issue to me. I'd guess you attempted to run the test(s) via IDE's own unit test runner. I'd suggest to use the gradle-based test runner. The overhead is really small, but the classpath is certain to be set according to module dependencies. Side note: CI has some failures too. |
|
I have fixed the CI failures |
...e/polaris/extension/persistence/impl/eclipselink/PolarisEclipseLinkMetaStoreSessionImpl.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisSecretsManager.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/entity/PolarisPrincipalSecrets.java
Outdated
Show resolved
Hide resolved
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizerImpl.java
Outdated
Show resolved
Hide resolved
|
@dimas-b Sorry for the delay, I was tied up with some high-priority incidents. Could you please take a look? I’m planning to merge this week |
|
@dimas-b Please let me know if more changes are needed in this flow? |
|
Bumping up for a re review |
dimas-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delay. I have some more comments, though.
polaris-core/src/main/java/org/apache/polaris/core/auth/PolarisAuthorizerImpl.java
Outdated
Show resolved
Hide resolved
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java
Outdated
Show resolved
Hide resolved
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
polaris-core/src/main/java/org/apache/polaris/core/persistence/IntegrationPersistence.java
Outdated
Show resolved
Hide resolved
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java
Outdated
Show resolved
Hide resolved
...-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java
Show resolved
Hide resolved
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java
Show resolved
Hide resolved
|
@dimas-b I’ve addressed most comments. Could you clarify the remaining points so we can ensure everything is ready for merge |
|
@fivetran-arunsuri : please resolve merge conflicts, otherwise CI will not run 🤷 |
f0ab521 to
56e8b8c
Compare
|
Fixed merge conflicts |
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
...bc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcBasePersistenceImpl.java
Outdated
Show resolved
Hide resolved
runtime/service/src/main/java/org/apache/polaris/service/admin/PolarisAdminService.java
Show resolved
Hide resolved
...-core/src/main/java/org/apache/polaris/core/persistence/AtomicOperationMetaStoreManager.java
Outdated
Show resolved
Hide resolved
|
@dimas-b Please take a look at the current approach |
|
@dennishuo: FYI |
e6a0407
d83df43 to
e6a0407
Compare
|
@dimas-b @eric-maynard I rebased my branch, which removed your approval. Could you please take another look? If everything looks good, let’s move ahead with the merge — this feature is currently blocking our migration. |
flyrain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @fivetran-arunsuri , thanks a lot for working on it. Sorry for the late review. Appreciated if you can answer a few questions:
- What's the use case of reset a client id of a principal? I understand that other systems like Keycloak support that. But Polaris doesn't have to mimic them.
- Can we reuse the credential rotate endpoint(
/principals/{principalName}/rotate) instead of having a new endpoint? We can still enforce only root can rotate other principal's credentials. It's also acceptable to add an optional field to allow client to input credentials.
My reading of the current Polaris Management API spec is that the "rotate" endpoint has quite different functionality from "reset". Implementing the feature proposed in this PR via the old "reset" endpoint could technically be done (I guess), but I think it will overload the old "reset" functionality too much and make its logic complicated unnecessarily. I believe adding a new endpoint is preferable (as implemented in this PR). |
I didn't find a use case mentioned in the mail thread to reset the client id. Correct me if I'm wrong, @fivetran-arunsuri. There is no old
How is that quite different? For credential refresh, the |
Sorry, typo on my part. I meant "old rotate".
The "rotate" endpoint keeps old credentials effective (they become secondary). The "rotate" endpoint implies that the client ID never changes. If we're to allow completely replacing both the client ID and all associated secrets, that's no longer "rotation", IMHO. |
|
The new endpoint makes sense to me if we need update client id. Are there use cases for client id update now? |
|
Hi @flyrain, Based on the usecase explained in the email thread and as @dimas-b explained earlier.
This isn’t about mimicking Keycloak or expanding Polaris into a full IdP. The primary driver is our migration path from Polaris 0.9 → 1.0. Since we’ll be running both catalog servers in parallel during the cutover, we need to reuse the same clientId / clientSecret across both instances. This ensures:
Without the ability to inject known credentials, we’d either have to rotate secrets across all clients (not feasible at scale) or risk schema/hash inconsistencies when trying to copy raw tables Also this automatically answers your second question, As Rotate API keeps the clientId as same |
|
This change is mainly to help users migrate from 0.9 (EclipseLink) → 1.0 (JDBC) with schema changes, without risky manual DB manipulation by registering existing sets of users keeping creds as same. I believe it could be quite useful for adoption. Currently the functionality is only restricted to root user |
|
@flyrain Pasting what we discussed in DM around the reset vs rotate: I see your point about client_id semantics and the flexibility of reusing the rotate endpoint.
Finally, this direction was already discussed and agreed in the Dev email thread to support a separate endpoint, so keeping both aligns with that decision—rather than using the same API as createPrincipal by passing custom creds, as I initially proposed. Would you be open to keeping both endpoints? Can we go ahead with the PR? |
|
Thanks @fivetran-arunsuri! I'm fine with new reset endpoint for the clarity of intent from a client perspective. |
Fix undetected merge conflict after apache#2197
Using `git log -p apache-polaris-1.1.0-incubating..553cb06 -- CHANGELOG.md` to find changes missed in the previous CHANGELOG update (apache#2635)
* Integration tests for Catalog Federation (apache#2344) Adds a Junit5 integration test for catalog federation. * Fix merge conflict in CatalogFederationIntegrationTest (apache#2420) apache#2344 added a new test for catalog federation, but it looks like an undetected conflict with concurrent changes related to authentication have broken the test in main. * chore(deps): update registry.access.redhat.com/ubi9/openjdk-21-runtime docker tag to v1.23-6.1755674729 (apache#2416) * 2334 (apache#2427) * Fix TableIdentifier in TaskFileIOSupplier (apache#2304) we cant just convert a `TaskEntity` to a `IcebergTableLikeEntity` as the `getTableIdentifier()` method will not return a correct value by using the name of the task and its parent namespace (which is empty?). task handlers instead need to pass in the `TableIdentifier` that they already inferred via `TaskEntity.readData`. * Fix NPE in CreateCatalog (apache#2435) * Doc fix: Access control page update (apache#2424) * 2418 * 2418 * fix(deps): update dependency software.amazon.awssdk:bom to v2.32.29 (apache#2443) * Optimize PolicyCatalog.listPolicies (apache#2370) this is a follow-up to apache#2290 the optimization is to use `listEntities` instead of `loadEntities` when there is `policyType` filter to apply * Add PolarisDiagnostics field to BaseMetaStoreManager (apache#2381) * Add PolarisDiagnostics field to BaseMetaStoreManager the ultimate goal is removing the `PolarisCallContext` parameter from every `PolarisMetaStoreManager` interface method, so we make steps towards reducing its usage first. * Add feature flag to disallow custom S3 endpoints (apache#2442) * Add new realm-level flag: `ALLOW_SETTING_S3_ENDPOINTS` (default: true) * Enforce in `PolarisServiceImpl.validateStorageConfig()` Fixes apache#2436 * Deprecate ActiveRolesProvider for removal (apache#2404) * Client: fix openapi verbose output, remove doc generate, and skip test generations (apache#2439) * Fix various issue in client code generation * Use logger instead of print * Add back exclude on __pycache__ as CI is not via Makefile * Add back exclude on __pycache__ as CI is not via Makefile * Add user principal tag in metrics (apache#2445) * Added API change to enable tag * Added test * Added production readiness check * fix(deps): update dependency io.opentelemetry.semconv:opentelemetry-semconv to v1.36.0 (apache#2454) * fix(deps): update dependency com.google.cloud:google-cloud-storage-bom to v2.56.0 (apache#2447) * fix(deps): update dependency gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext to v1.3 (apache#2428) * Build: Make jandex dependency used for index generation managed (apache#2431) Also allows specifying the jandex index version for the build. This is a preparation step contributing to apache#2204, once a jandex fix for reproducible builds is available. Co-authored-by: Alexandre Dutra <adutra@apache.org> * Built: improve reproducible archive files (apache#2432) As part of the effort for apache#2204, this change fixes a few aspects around reproducible builds: Some Gradle projects produce archive files, but don't get the necessary Gradle archive-tasks settings applied: one not-published project but also the tarball&zip of the distribution. This change moves the logic to the new build-plugin `polaris-reproducible`. Another change is to have some Quarkus generated jar files adhere to the same conventions, which are constant timestamps for the zip entries and a deterministic order of the entries. That's sadly not a full fix, as the classes that are generated or instumented by Quarkus differ in each build. Contributes to apache#2204 * Remove commons-lang3 dependency (apache#2456) outside of tests we can replace the functionality with jdk11 and guava. also stop using `org.assertj.core.util` as its a non-public api. * add refresh credentials property to loadTableResult (apache#2341) * add refresh credentials property to loadTableResult * IcebergCatalogAdapterTest: Added test to ensure refresh credentials endpoint is included * delegate refresh credential endpoint configuration to storage integration * GCP: Add refresh credential properties * fix(deps): update dependency io.opentelemetry.semconv:opentelemetry-semconv to v1.37.0 (apache#2458) * Add Delegator to all API Implementations (apache#2434) Per the Dev ML, implements the Delegator pattern to add Events instrumentation to all Polaris APIs. * Prefer java.util.Base64 over commons-codec (apache#2463) `java.util.Base64` is available since java8 and we are already using it in a few other spots. in a follow-up we might be able to get rid of our `commons-codec` dependency completely. * Service: Move tests to the right package (apache#2469) * Update versions in runtime LICENSE and NOTICE (apache#2468) * fix(deps): update dependency com.adobe.testing:s3mock-testcontainers to v4.8.0 (apache#2475) * fix(deps): update dependency com.gradleup.shadow:shadow-gradle-plugin to v9.1.0 (apache#2476) * Service: Remove hadoop-common from polaris-runtime-service (apache#2462) * Service: Always validate allowed locations from Storage Config (apache#2473) * Add Community Sync Meeting 20250828 (apache#2477) * Update dependency software.amazon.awssdk:bom to v2.33.0 (apache#2483) * Remove PolarisCallContext.getDiagServices (apache#2415) * Remove PolarisCallContext.getDiagServices usage * Remove diagnostics from PolarisCallContext * Feature: Expose resetCredentials via a new reset api to allow root user to reset credentials for an existing principal with custom values (apache#2197) * Add type-check to PolarisEntity subclass ctors (apache#2302) currently one can freely "cast" any `PolarisEntity` to a more specific type via their constructors. this can lead to subtle bugs like we fixed in a29f800 by adding type checks we discover a few more places where we need to be more careful about how we construct new or handle existing entities. note that we can add a check for `PolarisEntitySubType` in a followup, but it requires more fixes currently. * Fix CI (apache#2489) Fix undetected merge conflict after apache#2197 + apache#2415 + apache#2434 * Use local diagnostics in TransactionWorkspaceMetaStoreManager * Add resetCredentials to PolarisPrincipalsEventServiceDelegator * Core: Prevent AIOOBE for negative codes in PolarisEntityType, PolarisPrivilege, ReturnStatus (apache#2490) * feat(idgen): Start Implementation of NoSQL with the ID Generation Framework (apache#2131) Create an ID Generation Framework. Related to apache#650 & apache#844 Co-authored-by: Robert Stupp <snazy@snazy.de> Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@gmail.com> * perf(refactor): optimizing JdbcBasePersistenceImpl.listEntities (apache#2465) - Reduced Column Selection: Only 6 columns instead of 16 - Eliminated Object Creation Overhead: Direct conversion to EntityNameLookupRecord without intermediate PolarisBaseEntity * Add Polaris Events to Persistence (apache#1844) * AWS CloudWatch Event Sink Implementation (apache#1965) * Fix failing CI (apache#2498) * Update actions/stale digest to 3a9db7e (apache#2499) * Core: Prevent AIOOBE for negative policy codes in PredefinedPolicyType (apache#2486) * Service: Add location tests for views (apache#2496) * Update docker.io/jaegertracing/all-in-one Docker tag to v1.73.0 (apache#2500) * Update dependency io.netty:netty-codec-http2 to v4.2.5.Final (apache#2495) * Update actions/setup-python action to v6 (apache#2502) * Update the Release Guide about the Helm Chart package (apache#2179) * Update the Release Guide about the Helm Chart package * Update release-guide.md Co-authored-by: Pierre Laporte <pierre@pingtimeout.fr> * Add missing commit message * Whitespace * Use Helm GPG plugin to sign the Helm chart * Fix directories during Helm chart copy to SVN * Add Helm index to SVN * Use long name for svn checkout * Ensure the Helm index is updated after the chart is moved to SVN dist release * Do not publish any Docker image before the vote succeeds * Typos * Revert "Do not publish any Docker image before the vote succeeds" This reverts commit 5617e65. * Don't mention Helm values.yaml in the release guide as it doesn't contain version details --------- Co-authored-by: Pierre Laporte <pierre@pingtimeout.fr> * Update dependency com.azure:azure-sdk-bom to v1.2.38 (apache#2503) * Update registry.access.redhat.com/ubi9/openjdk-21-runtime Docker tag to v1.23-6.1756793420 (apache#2504) * Remove commons-codec dependency (apache#2474) follow-up to f8ad77a we can simply use guava instead and eliminate the extra dependency * CLI: Remove SCRIPT_DIR and default config location to user home (apache#2448) * Remove readInternalProperties helpers (apache#2506) the functionality is already provided by the `PrincipalEntity` * Add Events for Generic Table APIs (apache#2481) This PR adds the Events instrumentation for the Generic Tables Service APIs, surrounding the default delegated call to the business logic APIs. * Disable custom namespace locations (apache#2422) When we create a namespace or alter its location, we must confirm that this location is within the parent location. This PR introduces introduces a check similar to the one we have for tables, where custom locations are prohibited by default. This functionality is gated behind a new behavior change flag `ALLOW_NAMESPACE_CUSTOM_LOCATION`. In addition to allowing us to revert to the old behavior, this flag allows some tests relying on arbitrarily-located namespaces to pass (such as those from upstream Iceberg). Fixes: apache#2417 * fix for IcebergAllowedLocationTest (apache#2511) * Remove unused config from SparkSessionBuilder (apache#2512) Tests pass without it. * Add Events for Policy Service APIs (apache#2479) * Remove PolarisTestMetaStoreManager.jsonNode helper (apache#2513) * Update dependency software.amazon.awssdk:bom to v2.33.4 (apache#2517) * Update dependency com.nimbusds:nimbus-jose-jwt to v10.5 (apache#2514) * Update dependency io.opentelemetry:opentelemetry-bom to v1.54.0 (apache#2515) * Update dependency io.micrometer:micrometer-bom to v1.15.4 (apache#2519) * Port missed OSS change * NoSQL: adopt to updated test packages * NoSQL: adapt to removed PolarisDiagnostics param * NoSQL: fix libs.versions.toml * NoSQL: include jandex plugin related changes from OSS * NoSQL: changes for delete/set principal client-ID+secret * Last merged commit c6176dc --------- Co-authored-by: Pooja Nilangekar <poojan@umd.edu> Co-authored-by: Eric Maynard <eric.maynard+oss@snowflake.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Yong Zheng <yongzheng0809@gmail.com> Co-authored-by: Christopher Lambert <xn137@gmx.de> Co-authored-by: Honah (Jonas) J. <honahx@apache.org> Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@gmail.com> Co-authored-by: Alexandre Dutra <adutra@apache.org> Co-authored-by: fivetran-kostaszoumpatianos <kostas.zoumpatianos@fivetran.com> Co-authored-by: Jason <jasonf20@gmail.com> Co-authored-by: Adnan Hemani <adnan.h@berkeley.edu> Co-authored-by: Yufei Gu <yufei@apache.org> Co-authored-by: JB Onofré <jbonofre@apache.org> Co-authored-by: fivetran-arunsuri <103934371+fivetran-arunsuri@users.noreply.github.com> Co-authored-by: Adam Christian <105929021+adam-christian-software@users.noreply.github.com> Co-authored-by: Artur Rakhmatulin <artur.rakhmatulin@gmail.com> Co-authored-by: Pierre Laporte <pierre@pingtimeout.fr>
* Suppress deprecation warnings in `PolarisSparkCatalog.createTable()` (apache#2631) Background: apache#2394 Since we have to override the deprecated `createTable` method, we suppress deprecation warnings produced by `javac`. Suppressing `RedundantSuppression` is needed for IntelliJ, which appears to consider this a normal situation and does not issue a deprecation warning. * Service: Add Events for PolarisServiceImpl APIs (apache#2482) * CHANGELOG: Freeze change log for 1.1 and clear out unreleased version (apache#2635) * Re-add CHANGELOG.md entry for apache#2197 (apache#2638) Using `git log -p apache-polaris-1.1.0-incubating..553cb06 -- CHANGELOG.md` to find changes missed in the previous CHANGELOG update (apache#2635) * Azure: Fix azure expires at prefix for the credentials refresh (apache#2633) * Remove unused LOG in SparkCatalog (apache#2639) * fix(deps): update dependency com.google.errorprone:error_prone_core to v2.42.0 (apache#2636) * fix(deps): update dependency io.smallrye.config:smallrye-config-core to v3.14.0 (apache#2637) * Fix client license check (apache#2642) * fix(deps): update dependency software.amazon.awssdk:bom to v2.34.0 (apache#2645) * fix(deps): update mockito monorepo to v5.20.0 (apache#2641) * chore(deps): update docker.io/prom/prometheus docker tag to v3.6.0 (apache#2644) * chore(events): unify in-memory buffer listeners implementations (apache#2628) * fix(deps): update quarkus platform and group (apache#2595) * Update jandex dependency to 3.5.0 (apache#2649) * Last merged commit e6796f7 --------- Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@gmail.com> Co-authored-by: Adnan Hemani <adnan.h@berkeley.edu> Co-authored-by: Prashant Singh <35593236+singhpk234@users.noreply.github.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Yong Zheng <yongzheng0809@gmail.com> Co-authored-by: Alexandre Dutra <adutra@apache.org>
Background:
See Issue -#1929 and based on Dev email discussion
WHAT
Local Testing:

Happy Scenario
Failure scenario:

If clientId and clientSecret not passed, we retain the previous clientId and rotate the creds:
