Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adutra
Copy link
Contributor

@adutra adutra commented May 17, 2024

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
@@ -915,7 +923,13 @@ private FileIO tableFileIO(SessionContext context, Map<String, String> config) {
}

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
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
Copy link
Contributor Author

adutra commented Jun 4, 2024

@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
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 }

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.

None yet

2 participants