Skip to content

REST: disallow overriding "credential" in table sessions - #10345

Merged
nastra merged 1 commit into
apache:mainfrom
adutra:table-credential
Jul 4, 2024
Merged

nastra merged 1 commit into
apache:mainfrom
adutra:table-credential

Conversation

@adutra

@adutra adutra commented May 17, 2024

Copy link
Copy Markdown
Contributor

See #10256 for context.

As requested, this change disallows overriding the credential property in table sessions, by introducing an allow-list of auth-related properties that can be overridden in such situations.

Only the token property and properties used to exchange one token for another (urn:ietf:params:oauth:token-type:*) are now allowed.

@github-actions github-actions Bot added the core label May 17, 2024

private AuthSession tableSession(Map<String, String> tableConf, AuthSession parent) {
Pair<String, Supplier<AuthSession>> newSession = newSession(tableConf, tableConf, parent);
Map<String, String> credentials = Maps.newHashMapWithExpectedSize(tableConf.size());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note: this change still allows overriding credential from the SessionContext which I believe is the desired behavior. But I'm happy to also apply the restriction to SessionContext as well.

@adutra

adutra commented Jun 4, 2024

Copy link
Copy Markdown
Contributor Author

@nastra could you have a look at this one as well please?

if (TABLE_SESSION_ALLOW_LIST.contains(prop)) {
credentials.put(prop, tableConf.get(prop));
}
}

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: newline after the closing }

@nastra
nastra requested a review from amogh-jahagirdar June 4, 2024 13:21
See apache#10256 for context.

This change disallows overriding the "credential" property
in table sessions, by introducing an allow-list of
auth-related properties that can be overridden in such
situations.

Only the "token" property and properties used to exchange
one token for another ("urn:ietf:params:oauth:token-type:*")
are now allowed.
@adutra
adutra force-pushed the table-credential branch from c744c0b to f9d20a0 Compare June 5, 2024 07:48
@nastra nastra added this to the Iceberg 1.6.0 milestone Jun 25, 2024
@nastra
nastra merged commit d1f9f28 into apache:main Jul 4, 2024
jasonf20 pushed a commit to jasonf20/iceberg that referenced this pull request Aug 4, 2024
See apache#10256 for context.

This change disallows overriding the "credential" property
in table sessions, by introducing an allow-list of
auth-related properties that can be overridden in such
situations.

Only the "token" property and properties used to exchange
one token for another ("urn:ietf:params:oauth:token-type:*")
are now allowed.
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
See apache#10256 for context.

This change disallows overriding the "credential" property
in table sessions, by introducing an allow-list of
auth-related properties that can be overridden in such
situations.

Only the "token" property and properties used to exchange
one token for another ("urn:ietf:params:oauth:token-type:*")
are now allowed.
zhongyujiang pushed a commit to zhongyujiang/iceberg that referenced this pull request Apr 16, 2025
See apache#10256 for context.

This change disallows overriding the "credential" property
in table sessions, by introducing an allow-list of
auth-related properties that can be overridden in such
situations.

Only the "token" property and properties used to exchange
one token for another ("urn:ietf:params:oauth:token-type:*")
are now allowed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants