Skip to content

(fix) Remove KMS policies when KMS is not configured and improved default KMS permission for RO/RW#3493

Merged
MonkeyCanCode merged 2 commits intoapache:mainfrom
MonkeyCanCode:kms_policy_management
Jan 24, 2026
Merged

(fix) Remove KMS policies when KMS is not configured and improved default KMS permission for RO/RW#3493
MonkeyCanCode merged 2 commits intoapache:mainfrom
MonkeyCanCode:kms_policy_management

Conversation

@MonkeyCanCode
Copy link
Contributor

This PR addressed one of the 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 [email protected])
  • 🔗 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)

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Jan 21, 2026
@MonkeyCanCode MonkeyCanCode changed the title Remove KMS policies when KMS is not configured and improved default KMS permission for RO/RW (fix) Remove KMS policies when KMS is not configured and improved default KMS permission for RO/RW Jan 21, 2026
dimas-b
dimas-b previously approved these changes Jan 21, 2026
IamStatement.Builder allowKms = buildBaseKmsStatement(canWrite);
boolean hasCurrentKey = kmsKeyArn != null;
boolean hasAllowedKeys = hasAllowedKmsKeys(allowedKmsKeys);
boolean isAwsS3 = 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.

For follow-up:

This logic for deciding "AWS or not" does not look robust to me.

I'd prefer to make this a property in the Storage Config (similar to stsUnavailable). We could choose the default value for it as true if no custom endpoint or stsEndpoint values are set (false if custom endpoints are set).

This should be fairly backward compatible... WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

The change in this PR appears to be compatible to old KMS logic, so I think it's ok to merge "as is" and improve config later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is correct. This is only for not include default RO KMS policy. For deciding "AWS or not", I raised a dev mailing list and a different PR. For sure using a new property will be most robust and less FP.

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

dimas-b commented Jan 21, 2026

FYI: @fabio-rizzo-01

singhpk234
singhpk234 previously approved these changes Jan 23, 2026
Copy link
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

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

LGTM too, thanks @MonkeyCanCode !

@MonkeyCanCode
Copy link
Contributor Author

@dimas-b @singhpk234 mind do another approve as I had to fix conflict on recent CHANGELOG.md issue.

Copy link
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

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

Thank you @MonkeyCanCode !

@MonkeyCanCode MonkeyCanCode merged commit c2785bd into apache:main Jan 24, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jan 24, 2026
evindj pushed a commit to evindj/polaris that referenced this pull request Jan 26, 2026
snazy added a commit to snazy/polaris that referenced this pull request Feb 11, 2026
* (doc) Outdated changelog (apache#3503)

* deduplicate storage requests when loading views. (apache#3488)

* dedup metadata fetch by reusing ops

* Update Gradle to 9.3.0 (apache#3514)

* Site: add tool to mark versioned-docs as "do not index" (apache#3485)

Adds a shell script to add the front-matter tags `robots: noindex` (HTML META tag) and `exclude_search: true` (local site search) for versioned docs for a specific version.

The rudimentary script handles only markdown files, not asciidoc files, because there are currently only .md files in the versioned-docs.

* feat(metrics): Evolve PolarisMetricsReporter interface with timestamp parameter and comprehensive documentation (apache#3468)

Enhance the `PolarisMetricsReporter` SPI interface by adding a timestamp parameter to the `reportMetric()` method, enabling accurate time-series metrics reporting to external systems.

* Make python version configuration in Makefile (apache#3510)

* Update max supported python version (apache#3509)

* (doc) Add doc for couple new feature flags introduced recently (apache#3511)

* Add doc for couple new feature flags

* Add doc for couple new feature flags

* (nit) Site: Fading anchor (apache#3522)

* Fading anchor

* Fading anchor

* Update doc to use /Users/richardliu rather than quoted tilde (apache#3472)

* Remove KMS policies when KMS is not configured and improved default KMS permission for RO/RW (apache#3493)

* Update triggers in "Hugo Site" workflow (apache#3518)

The `site.yml` workflow is currently triggered in the following scenarios:
1. A push to the `main` branch, using the state of the site and the workflow as on `main`.
2. A push to a `release/*`branch, using the state of the site and the workflow as on that release branch.

Notice that workflows get the repo state (from the checkout actions) and the workflow state as its on that particular branch.
Put in other words: if we'd have a change to some old `release/1.0.x` branch, the web site would be updated as it is defined on that `release/1.0.x` branch, which is wrong and not the intended behavior.

This change updates the workflow triggers to only run for pushes to the `main` branch, plus PRs against the `main` branch and when called from another workflow.

This is part of apache#3516

* Let `site/bin/checkout-releases.sh` pull the latest state (apache#3517)

The script `site/bin/checkout-releases.sh` is a convenience to get the `versioned-docs` branch locally. It is missing a `git pull` to get the latest state of that branch though, which can be confusing.

* Last merged commit 1bf72bc

---------

Co-authored-by: Yong Zheng <[email protected]>
Co-authored-by: Innocent Djiofack <[email protected]>
Co-authored-by: Anand K Sankaran <[email protected]>
Co-authored-by: Richard Liu <[email protected]>
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.

3 participants