Skip to content

Include user-defined attributes when building PolarisPrincipal from PrincipalEntity#5032

Open
iprithv wants to merge 1 commit into
apache:mainfrom
iprithv:fix/polaris-principal-user-defined-properties
Open

Include user-defined attributes when building PolarisPrincipal from PrincipalEntity#5032
iprithv wants to merge 1 commit into
apache:mainfrom
iprithv:fix/polaris-principal-user-defined-properties

Conversation

@iprithv

@iprithv iprithv commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #4291

PolarisPrincipal.of(PrincipalEntity, …) forwards only the entity's internal properties (e.g. client_id) and silently drops the user-defined properties supplied at principal creation. As a result, downstream consumers that read PolarisPrincipal.getProperties() never see user attributes like region=northamerica or department=finance, and policies written against them never match.

@github-project-automation github-project-automation Bot moved this to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv iprithv closed this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv changed the title DefaultAuthenticator forwards user-defined principal properties for ABAC authorizers Add atomic multi-entity and grant-record commit SPI Jul 10, 2026
@iprithv iprithv reopened this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from ee0c065 to d729092 Compare July 10, 2026 21:51
@iprithv iprithv closed this Jul 10, 2026
@iprithv
iprithv deleted the fix/polaris-principal-user-defined-properties branch July 10, 2026 23:05
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv reopened this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 10, 2026
@iprithv
iprithv marked this pull request as draft July 10, 2026 23:12
@iprithv iprithv closed this Jul 10, 2026
@github-project-automation github-project-automation Bot moved this from PRs In Progress to Done in Basic Kanban Board Jul 10, 2026
@iprithv iprithv reopened this Jul 16, 2026
@github-project-automation github-project-automation Bot moved this from Done to PRs In Progress in Basic Kanban Board Jul 16, 2026
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from d729092 to ff0aba7 Compare July 16, 2026 21:42
@iprithv iprithv changed the title Add atomic multi-entity and grant-record commit SPI Include user-defined attributes when building PolarisPrincipal from PrincipalEntity Jul 16, 2026
@iprithv
iprithv marked this pull request as ready for review July 16, 2026 22:33
@dimas-b

dimas-b commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@iprithv : Please rebase to get compilation fixes from main

dimas-b
dimas-b previously approved these changes Jul 16, 2026
Comment thread CHANGELOG.md Outdated

### Fixes
- Fixed native catalog credential vending paths (`loadCredentials` and `loadTable` with delegation) to re-validate locations against the *current* catalog `allowedLocations`. Previously these paths trusted persisted table entity locations, allowing stale credentials after an admin tightened allowed locations on a native catalog. (The federated path had a partial check.)
- Fixed `PolarisPrincipal` construction from a `PrincipalEntity` to expose the principal's user-defined properties (alongside internal properties) so external authorizers such as OPA and Ranger can use them for policy evaluation. Internal properties win on key collision so that system-managed values such as `client_id` cannot be shadowed by user input.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I'd put this under "changes". Old behaviour was not a "bug" 😉

@github-project-automation github-project-automation Bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jul 16, 2026
@dimas-b

dimas-b commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

FYI: @cccs-cat001 @tokoko @sneethiraj

@dimas-b
dimas-b requested a review from adutra July 16, 2026 23:01
@iprithv
iprithv force-pushed the fix/polaris-principal-user-defined-properties branch from ff0aba7 to a245fbb Compare July 16, 2026 23:08
dimas-b
dimas-b previously approved these changes Jul 16, 2026
@dimas-b

dimas-b commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

#5085 proposes a more fundamental refactoring, which should support this use case too.

@adutra

adutra commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@iprithv I am proposing #5085 as an alternative to this PR. I am a little concerned by the fact that this PR merges together user-facing and internal properties. It also does not allow for generic attributes to be set on the principal. Let me know what you think. Thanks!

@dimas-b
dimas-b dismissed their stale review July 17, 2026 14:50

removing approval based on feedback from @adutra

* collision the internal value wins, so that system-managed properties (for example {@code
* client_id}) cannot be shadowed by user-supplied properties.
*/
private static Map<String, String> mergeEntityProperties(PrincipalEntity principalEntity) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the PrincipalEntity -> PolarisPrincipal property merge that the dev list moved away from (PR #4405 thread, Jul 7-11). The agreed direction is for the auth layer to forward user info to PolarisPrincipal as optional attributes, keeping PolarisPrincipal decoupled from PrincipalEntity (federated/detached principals may have no entity). It also only fires on the DefaultAuthenticator path -- a pluggable authenticator with no PrincipalEntity won't forward these. Is this still the intended mechanism, or superseded by the rework you described on the list?

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.

PolarisPrincipal missing user-defined attributes supplied during principal creation

4 participants