Skip to content

feat: Add AWS STS Session Tags support for credential vending#3327

Merged
jbonofre merged 13 commits intoapache:mainfrom
obelix74:feature-3325-aws-session-tags
Jan 8, 2026
Merged

feat: Add AWS STS Session Tags support for credential vending#3327
jbonofre merged 13 commits intoapache:mainfrom
obelix74:feature-3325-aws-session-tags

Conversation

@obelix74
Copy link
Contributor

@obelix74 obelix74 commented Dec 24, 2025

Fixes #3325

Summary

Adds support for AWS STS Session Tags when vending S3 credentials, enabling correlation between Polaris catalog operations and S3 access in AWS CloudTrail. This feature is controlled by a new feature flag INCLUDE_SESSION_TAGS_IN_SUBSCOPED_CREDENTIAL (default: false).

Motivation

When Polaris vends temporary AWS credentials via STS AssumeRole, there's no way to correlate S3 access events in CloudTrail back to the originating Polaris catalog operation. This makes audit trails incomplete and security investigations difficult.

AWS STS Session Tags solve this by attaching metadata to the assumed role session that appears in CloudTrail events for all subsequent API calls made with those credentials.

Changes

New Components

  • CredentialVendingContext - Immutable value class holding session tag context (catalog name, namespace, table name, request-id)
  • INCLUDE_SESSION_TAGS_IN_SUBSCOPED_CREDENTIAL - Feature flag in FeatureConfiguration (default: false)

AWS Integration

  • AwsCredentialsStorageIntegration - Adds 5 session tags to AssumeRoleRequest when feature enabled:
    • polaris:principal - The authenticated principal name
    • polaris:catalog - The catalog being accessed
    • polaris:namespace - The namespace being accessed
    • polaris:table - The table being accessed
    • polaris:request-id - The originating request ID for correlation
  • Tags are marked as transitive for role chaining support
  • Tag values truncated to 256 characters (AWS limit)
  • Missing values use "unknown" placeholder for consistent CloudTrail presence

Cache Key Updates

  • StorageCredentialCacheKey - Now includes CredentialVendingContext when session tags enabled
  • StorageCredentialCache - Includes principal in cache key when session tags OR principal-name-in-session features are
    enabled (prevents credential cross-contamination)
  • Added toSanitizedLogString() for safe debug logging without exposing sensitive context

Interface Updates

  • Updated PolarisStorageIntegration, PolarisCredentialVendor, StorageCredentialsVendor to accept
    CredentialVendingContext
  • Updated Azure and GCP integrations for signature compatibility (pass-through only)

Testing

  • 6 new unit tests in AwsCredentialsStorageIntegrationTest:
    • testSessionTagsIncludedWhenFeatureEnabled
    • testSessionTagsNotIncludedWhenFeatureDisabled
    • testSessionTagsWithPartialContext
    • testSessionTagsWithLongValues
    • testSessionTagsWithEmptyContext
    • testSessionTagsAccessDeniedGracefulHandling
  • All existing tests updated for signature compatibility
  • Full test suites pass: polaris-core:test, polaris-runtime-service:test

Configuration

To enable session tags, set in your Polaris configuration:

   polaris:
     features:
       INCLUDE_SESSION_TAGS_IN_SUBSCOPED_CREDENTIAL: "true"

IAM Requirements

When enabled, the IAM role's trust policy must allow sts:TagSession:

   {
     "Effect": "Allow",
     "Principal": { "AWS": "arn:aws:iam::ACCOUNT:root" },
     "Action": ["sts:AssumeRole", "sts:TagSession"]
   }

Breaking Changes

None. Feature is off by default and all interface changes are backward compatible.

Checklist

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Dec 24, 2025
@obelix74 obelix74 marked this pull request as draft December 24, 2025 05:47
@singhpk234 singhpk234 marked this pull request as ready for review December 26, 2025 04:23
@singhpk234
Copy link
Contributor

This is a cool feature ! looking forward to the change :) ~

@singhpk234 singhpk234 marked this pull request as draft December 26, 2025 04:23
@singhpk234 singhpk234 self-requested a review December 26, 2025 04:24
@obelix74 obelix74 marked this pull request as ready for review December 26, 2025 04:43
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @obelix74 !

The PR LGTM overall, my only real concern is relying on REST contexts.

Since this affects Polaris core, could you also send a discussion email to the dev ML for awareness?

@obelix74 obelix74 requested a review from dimas-b December 29, 2025 18:30
@obelix74
Copy link
Contributor Author

Thanks for your contribution, @obelix74 !

The PR LGTM overall, my only real concern is relying on REST contexts.

Since this affects Polaris core, could you also send a discussion email to the dev ML for awareness?

Thanks. Sent an email to the ML. I addressed most of your comments. I have a question on one of them. Thanks again.

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.

Thanks for the change @obelix74 !

took an initial passs, i do agree with @dimas-b on sending rest context as part of tag, can you explain how do you wanna use this ?

@obelix74
Copy link
Contributor Author

Thanks for the change @obelix74 !

took an initial passs, i do agree with @dimas-b on sending rest context as part of tag, can you explain how do you wanna use this ?

I removed using RestContext and used SLF4F#MDC instead to get the request id in a commit that I pushed about 30 mins ago. I am proposing using the request id (trace_id in the below picture) to tie in the request end to end from the client, all the way to the storage layer. If the clients to the catalog are willing to share information about the SQLs executed, we can use the request id to tie it all together.

Do I make sense?


image

@obelix74 obelix74 requested a review from singhpk234 December 29, 2025 19:38
@obelix74
Copy link
Contributor Author

@singhpk234 as discussed, removed request_id from this PR.

@obelix74 obelix74 requested a review from singhpk234 December 29, 2025 20:48
@obelix74 obelix74 requested a review from dimas-b December 30, 2025 16:45
dimas-b
dimas-b previously approved these changes Dec 30, 2025
Copy link
Contributor

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

Let's wait a few days for other reviewers to have a chance at commenting since it's a holiday season 😉

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

@adnanhemani adnanhemani left a comment

Choose a reason for hiding this comment

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

LGTM, I think this will be an exciting feature that many will use!

singhpk234
singhpk234 previously approved these changes Dec 30, 2025
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, thanks @obelix74 for the all work !

@obelix74 obelix74 dismissed stale reviews from singhpk234 and dimas-b via 985454a December 31, 2025 03:24
@obelix74
Copy link
Contributor Author

obelix74 commented Jan 1, 2026

I see that @jbonofre wants to review. I will wait for them.

@dimas-b
Copy link
Contributor

dimas-b commented Jan 7, 2026

@jbonofre : I see you added yourself as a reviewer... Do you need more time or are you ok with merging?

Copy link
Member

@jbonofre jbonofre left a comment

Choose a reason for hiding this comment

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

I did the review and it looks good to me ! Thanks !

@jbonofre jbonofre merged commit 2833e2c into apache:main Jan 8, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jan 8, 2026
@obelix74 obelix74 deleted the feature-3325-aws-session-tags branch January 10, 2026 17:50
evindj pushed a commit to evindj/polaris that referenced this pull request Jan 26, 2026
…#3327)

* feat: Add AWS STS Session Tags support for credential vending
Fixes apache#3325

* Minor fixes

* Review comments

* Review comments.

* Remove request_id from the PR

* Review comment: added activated roles

* Review comments

* Update AwsSessionTagsBuilder.java

* Spotless fixes

* Update StorageCredentialCacheKey.java

* fix failing tests

* Review comments.

* Reverting last commit based on review comments for cache collisions.

---------

Co-authored-by: Anand Kumar Sankaran <anand.sankaran@workday.com>
snazy added a commit to snazy/polaris that referenced this pull request Feb 11, 2026
* feat: Add AWS STS Session Tags support for credential vending (apache#3327)

* feat: Add AWS STS Session Tags support for credential vending
Fixes apache#3325

* Minor fixes

* Review comments

* Review comments.

* Remove request_id from the PR

* Review comment: added activated roles

* Review comments

* Update AwsSessionTagsBuilder.java

* Spotless fixes

* Update StorageCredentialCacheKey.java

* fix failing tests

* Review comments.

* Reverting last commit based on review comments for cache collisions.

---------

Co-authored-by: Anand Kumar Sankaran <anand.sankaran@workday.com>

* chore(deps): update registry.access.redhat.com/ubi9/openjdk-21-runtime docker tag to v1.24-2.1767639862 (apache#3383)

* Added HttpRoute and Gateway to Helm Chart (apache#3314)

* Added httproute and gateway

* added to readme

* updated helm site docs

* updated changelog

* Added tests

* fixed broken test

* fixed test part 2

* removed odd comment

* added check for httproute and gateway

* shuffled the gateway documentation

* better gateway instructions

* removed extra case in validateRouting

* Errorprone: prepare for v2.46.0 (apache#3384)

This tackles the current failure in apache#3382: `-XDaddTypeAnnotationsToSymbol=true is required by Error Prone on JDK 21`

* NoSQL: Metastore maintenance (apache#3268)

Implementation of the NoSQL meta-store maintenance implementation. It adds the meta-store specific handling to the existing NoSQL maintenance service to purge unreferenced and unneeded data from the database.

* Update release workflows to use the new GPG private key (apache#3399)

* [tech debt] Cleanup `gradle/libs.versions.toml` (apache#3394)

This change removes unreferenced dependency references, inlines single usages of a version-reference and adds a dependency for checkstyle to get that version managed by renovate.

* fix(deps): update dependency org.keycloak:keycloak-admin-client to v26.0.8 (apache#3405)

* fix(deps): update dependency com.google.errorprone:error_prone_core to v2.46.0 (apache#3382)

* [doc]: Add Minio OSS disclaimer (apache#3390)

* [Releasy] Let Maven artifact publication propagate failures (apache#3407)

The Gradle build to publish the Maven artifacts is invoked like `./gradlew ... | tee <log>`. The (overall) exit code of pipes is the exit code of the _last_ command. The exit codes of all pipe "parts" is available in bash's `PIPESTATUS` array and needs to be checked.

* Fix Gradle up-to-date of jars (apache#3401)

The change apache#1036 added the Maven pom.xml to all built jars. However, the `GenerateMavenPom` Gradle task type is never up-to-date, in consequence no jar can ever be up-to-date, leading to unnecessarily longer build times.

This change ensures that the pom.xml is included in release builds, but not in developer/snapshot builds.

* fix(deps): update dependency net.ltgt.gradle:gradle-errorprone-plugin to v4.4.0 (apache#3406)

* fix(deps): update dependency com.puppycrawl.tools:checkstyle to v13 (apache#3403)

* fix(deps): update dependency io.opentelemetry:opentelemetry-bom to v1.58.0 (apache#3408)

* fix(deps): update dependency software.amazon.awssdk:bom to v2.41.5 (apache#3416)

* chore(deps): update dependency jupyterlab to v4.5.2 (apache#3419)

* Release workflows should retry svn checkout in case of failure (apache#3393)

* Change parser option to be required (apache#3413)

* Support hierarchical namespace in Azure (apache#3347)

* Support hierarchical namespace in Azure

* Add `hierarchical` to `AzureStorageConfigInfo` (the default is unset translating to current behaviour).

* Use `DataLakeDirectoryClient` instead of `DataLakeFileSystemClient` for generating SAS tokens
  when `hierarchical` is set to `true`.

* Add `cloudTest` classes for testing with credential vending in ADLS.

* chore(test): Increase Authorization Test Coverage (apache#3332)

* increase test coverage

* update docstrings

* clean up

* make use of same helper method

* remove duplicate tests from OpaIntegrationTest

* use tempdir

* fix(deps): update dependency io.micrometer:micrometer-bom to v1.16.2 (apache#3422)

* chore(deps): update registry.access.redhat.com/ubi9/openjdk-21-runtime docker tag to v1.24-2.1767878250 (apache#3421)

* Last merged commit 1996156

* Add free-disk-space action

* Add free-disk-space action to regtest + spark_client_regtests

---------

Co-authored-by: Anand K Sankaran <lists@anands.net>
Co-authored-by: Anand Kumar Sankaran <anand.sankaran@workday.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: cccs-cat001 <56204545+cccs-cat001@users.noreply.github.com>
Co-authored-by: Pierre Laporte <pierre@pingtimeout.fr>
Co-authored-by: Yong Zheng <yongzheng0809@gmail.com>
Co-authored-by: Dmitri Bourlatchkov <dmitri.bourlatchkov@gmail.com>
Co-authored-by: Sung Yun <107272191+sungwy@users.noreply.github.com>
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.

[Feature] Add AWS STS Session Tags to Credential Vending for CloudTrail Correlation

5 participants