Skip to content

UB: Never expiring creds bug - #3922

Open
okruitho wants to merge 2 commits into
aws:mainfrom
okruitho:never-expiring-creds-bug
Open

UB: Never expiring creds bug#3922
okruitho wants to merge 2 commits into
aws:mainfrom
okruitho:never-expiring-creds-bug

Conversation

@okruitho

@okruitho okruitho commented Sep 11, 2026

Copy link
Copy Markdown

Issue #, if available:

Description of changes:
Fix non-expiring CRT credentials being incorrectly reported as expired by CrtCredentialsProvider.

CRT documents UINT64_MAX as “no expiration”. Previously, the provider converted this sentinel into a DateTime as though it were an ordinary timestamp, exceeding the representable range and causing IsExpired() and IsExpiredOrEmpty() to return true.

For gcc this works fine; when using clang the casts from uint64_t to double to uint64_t give undefined behaviour, depending on compliler optimisation.

Downstream impact

We encountered this in DuckDB’s AWS extension, which uses this check before copying credentials into an S3 secret. Our toolchain is clang based. The incorrect expiration status caused valid credentials to be omitted, surfacing in its MinIO integration test.

Changes

  • Preserve AWSCredentials’ default non-expiring value when CRT returns UINT64_MAX.
  • Use the uint64_t seconds constructor for finite expiration timestamps, avoiding the floating-point conversion.
  • Add regression coverage for non-expiring credentials, ensuring all three state checks return false and subsequent retrieval uses cached credentials.
  • Add coverage confirming finite expiration timestamps are preserved.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@okruitho okruitho changed the title Never expiring creds bug UBI: Never expiring creds bug Sep 11, 2026
@okruitho okruitho changed the title UBI: Never expiring creds bug UB: Never expiring creds bug Sep 11, 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.

1 participant