Skip to content

Allow setting ARN role and external ID on catalogs that had none#4019

Open
adutra wants to merge 3 commits intoapache:mainfrom
adutra:change-arn-role
Open

Allow setting ARN role and external ID on catalogs that had none#4019
adutra wants to merge 3 commits intoapache:mainfrom
adutra:change-arn-role

Conversation

@adutra
Copy link
Contributor

@adutra adutra commented Mar 18, 2026

Fixes: #3885

Catalogs created without a role ARN (e.g. not using STS) could not be updated to add one, because the validation treated going from null to a non-null value as a forbidden AWS account ID change. The same applied to external IDs.

This change relaxes the validation in validateUpdateCatalogDiffOrThrow() so that setting a previously-null role ARN or external ID is allowed, while still preventing changes to the AWS account ID or external ID once set.

This change also changes the error message from the misleading "Cannot modify Role ARN" (the role name can be changed) to the more accurate "Cannot modify AWS account ID".

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)

Fixes: apache#3885

Catalogs created without a role ARN (e.g. not using STS) could not be updated to add one, because the validation treated going from null to a non-null value as a forbidden AWS account ID change. The same applied to external IDs.

This change relaxes the validation in `validateUpdateCatalogDiffOrThrow()` so that setting a previously-null role ARN or external ID is allowed, while still preventing changes to the AWS account ID or external ID once set.

This change also changes the error message from the misleading "Cannot modify Role ARN" (the role name *can* be changed) to the more accurate "Cannot modify AWS account ID".
Comment on lines +857 to +858
if (currentAwsConfig.getAwsAccountId() != null
&& !currentAwsConfig.getAwsAccountId().equals(newAwsConfig.getAwsAccountId())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This means we allow updating the role A to role B if they are same account ? any reason why

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. This has always been like this, presumably for security reasons (i.e. prevent a malicious client from changing to a role in another AWS account). Maybe @dennishuo or @collado-mike know more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would love to know about the history, because i think malicious client can also point it to a role within the same account but different privledge if they have the access to catalog ? want to understand the attack vector more (not a blocker for this pr)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Me too 😄 The original discussion #3885 was precisely about that.


if (!Objects.equals(currentAwsConfig.getAwsAccountId(), newAwsConfig.getAwsAccountId())) {
// Allow setting a role ARN when none was previously configured, but prevent changing the
// AWS account ID once it has been set.
Copy link
Contributor

@dimas-b dimas-b Mar 18, 2026

Choose a reason for hiding this comment

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

TBH, I do not see much value in allowing changes from unset to a new roles in some account, but preventing changing to a role in another account.

The security implications are the same for changing from unset to some role as for changing from one account to another, IMHO.

If the new role has more access to the data in storage than the Polaris Administrator considers valid (for whatever reason), and Polaris is able to assume that role with current credentials, it is a mistake in the authorization setup in the new role's account.

This can hardly be a concern when the Polaris owner (who controls Polaris storage access credentials) and the catalog owner is the same person or entity.

I can see this being a concern when the Polaris owner is different from the catalog admin.

Therefore, I'd prefer adding a feature flag to enable any role changes (at the discretion of the Polaris owner). If the flag is not set, let's keep current behaviour. The default should probably be off (current, more restricted behaviour).

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.

I don't disagree 😄

Since we don't have feedback from the original Polaris authors, let's go with the feature flag approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thx! I believe the feature flag will allow maintaining the old (current) behaviour when the Polaris owner so wishes, and allow more flexibility in fresh deployments.

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