Include user-defined attributes when building PolarisPrincipal from PrincipalEntity#5032
Include user-defined attributes when building PolarisPrincipal from PrincipalEntity#5032iprithv wants to merge 1 commit into
Conversation
ee0c065 to
d729092
Compare
d729092 to
ff0aba7
Compare
|
@iprithv : Please rebase to get compilation fixes from |
|
|
||
| ### 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. |
There was a problem hiding this comment.
nit: I'd put this under "changes". Old behaviour was not a "bug" 😉
ff0aba7 to
a245fbb
Compare
|
#5085 proposes a more fundamental refactoring, which should support this use case too. |
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) { |
There was a problem hiding this comment.
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?
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 readPolarisPrincipal.getProperties()never see user attributes likeregion=northamericaordepartment=finance, and policies written against them never match.