Skip to content

Conversation

@MonkeyCanCode
Copy link
Contributor

This PR addressed issues reported in #3440 where when end-user is not using KMS encryption for S3, Polaris still enforces in-lines policies which contains KMS related policies. While fixing this issue, I noticed our read-only policy for kMS is a bit too wide where GenerateDataKey and GenerateDataKeyWithoutPlaintext should be belongs to write operation instead of read. Thus, this PR also addresses this issue.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes #
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • 🧾 Updated CHANGELOG.md (if needed)
  • 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

if (hasCurrentKey || hasAllowedKeys) {
policyBuilder.addStatement(allowKms.build());
} else if (!canWrite) {
} else if (!canWrite && region != null && accountId != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this else condition will now be evaluated when hasCurrentKey == true and hasAllowedKeys == false, but it was not evaluated in that case before 🤔 WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the quick review @dimas-b and that is a fair point which I missed. It appears this is really specific for handling s3 and s3-compatible and I am not sure if the above logic will break or not due to lack of infra to test. I had made the needed code changes to preserve this workflow. Please take another look when you get a chance.

Copy link
Contributor

Choose a reason for hiding this comment

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

thx - LGTM 👍

dimas-b
dimas-b previously approved these changes Jan 15, 2026
@github-project-automation github-project-automation bot moved this from PRs In Progress to Ready to merge in Basic Kanban Board Jan 15, 2026
@dimas-b
Copy link
Contributor

dimas-b commented Jan 15, 2026

CC: @fabio-rizzo-01

@dimas-b dimas-b requested a review from adutra January 19, 2026 19:32
Comment on lines +1415 to +1417
if (currentMetadata != null) {
tableFileIO =
loadFileIOForTableLike(
Copy link
Contributor

Choose a reason for hiding this comment

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

How is that related to KMS policies?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it's just a parallel bugfix, I'd prefer to make it in a separate PR for the sake of clarity 🤔 WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Appear to be a parallel bug. I am waiting for testing from reporter then I can split this into two PRs. Currently if we merged current PR, it will trigger diff error from reporter.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good - thx!

@MonkeyCanCode MonkeyCanCode changed the title (fix) Remove KMS policies when KMS is not configured (WIP) Remove KMS policies when KMS is not configured Jan 21, 2026
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jan 21, 2026
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.

2 participants