feat: store credential expiration epoch in secret for proactive refresh#157
Open
HaoXuAI wants to merge 1 commit into
Open
feat: store credential expiration epoch in secret for proactive refresh#157HaoXuAI wants to merge 1 commit into
HaoXuAI wants to merge 1 commit into
Conversation
STS AssumeRoleWithWebIdentity returns an Expiration timestamp, but the secret only stored key_id/secret/session_token — discarding the expiration. Consumers (duckdb-iceberg) had no way to know when creds expire and resorted to fixed-interval refresh timers. Store credentials.GetExpiration() as 'expiration_epoch' (epoch seconds) in the secret_map. Consumers can now refresh at ~80% TTL instead of guessing with arbitrary intervals.
65d3190 to
aec765a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the
credential_chainprovider creates a secret withweb_identityorstschains, the STS response includes anExpirationtimestamp — but the extension only storeskey_id,secret, andsession_token. The expiration is discarded.Consumers (e.g., duckdb-iceberg) that need to refresh credentials have no way to know when they expire, and must resort to fixed-interval timers (e.g., refresh every 300s regardless of actual TTL).
Fix
Store
credentials.GetExpiration()asexpiration_epoch(epoch seconds as BIGINT) in thesecret_mapwhen the expiration is non-empty. This is backwards-compatible — existing consumers that don't read it are unaffected.Usage by consumers
Related