-
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)
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:
