Skip to content

[aws-cpp-sdk-core]: ProfileCredentialsProvider no longer refreshes profile data #4008

Open

Description

@grrtrr

Describe the bug

The CrtCredentialsProvider-based change in #3721 moved the ProfileCredentialsProvider to using aws-crt-cpp.

It introduced a breaking change in making the refreshRateMs an AWS_UNREFERENCED_PARAM, since it changes the API behaviour of the ProfileConfigFileAWSCredentialsProvider it replaces.

The result is that profile-based credentials are never refreshed.

Log Examples

This was observed in an enviroment that sets AWS_SHARED_CREDENTIALS_FILE to a path that is periodically populated from STS Web Identity credentials, which are refreshed every 50 minutes.

Example 1:

2026-11-19 05:59:36 Z   stderr INFO, 2026-11-19 05:59:36,034:b'I20261119 05:59:36.034477 140596569544256 run_critic.cc:479] --->>> [redacted, code starts to run]
...
2026-11-19 07:03:08 Z   stderr INFO, 2026-11-19 07:03:08,895:b'Exception name: ExpiredToken'
2026-11-19 07:03:08 Z   stderr INFO, 2026-11-19 07:03:08,895:b'Error message: Unable to parse ExceptionName: ExpiredToken Message: The provided token has expired.'

Example 2:

2026-11-19 02:30:27 Z   stdout cwd [redacted, code starts to run]
...
2026-11-19 03:34:47 Z   stdout Exception name: ExpiredToken
2026-11-19 03:34:47 Z   stdout Error message: Unable to parse ExceptionName: ExpiredToken Message: The provided token has expired.

Since the SDK no longer refreshes profile data, every job running longer than 1 hour fails.

Regression Issue

  • Select this option if this issue appears to be a regression.

What to do

The fix should mimic the logic of the predecessor, ProfileConfigFileAWSCredentialsProvider, to take advantage of the existing refresh logic in the AWSCredentialsProvider base class, rather than setting an expiration date on the credentials as in awslabs/aws-c-auth#321 (though doing both would not harm).

A DEFAULT_REFRESH_RATE_MS is introduced in #3721, but it is only used for the futures timeout, and its value (300sec) is over-dimensioned for retrieving profile data.

Setting refreshRateMs internally would break existing code that sets custom refresh values.

AWS CPP SDK version used

1.11.919 (problem present on main)

Compiler and Version used

clang-20

Operating System and version

ubuntu 24.04

Activity

  1. added
    bug
    needs-triage
    on Nov 23, 2026
  2. sbiscigl commented on Nov 25, 2026

    @sbiscigl
    Collaborator

    hey thanks for the detailed write up. like dengke called out on the crt side the shared credentials file has no expiration so those credentials are static, and expiration is what should drive a refresh. the old provider forcing a re-read every 5 minutes was the wrong behavior.

    something we're actively working towards is making the cpp sdk less different from the other aws sdks and this is one of those things. botocore and the go v2 sdk both load static profile credentials once and never re-read them.

    sorry this one bit you on the upgrade, thats on us, and youre right that refreshRateMs doesnt do anything anymore, we only kept it so existing code still compiles. i get the hyrums law point but we cant keep doing the wrong thing when it stops us from doing the right thing, which here is moving onto the crt providers. the way we try to handle these is to do the right thing by default and still let you opt into the old behavior if you depend on it, which you can do here.

    for credentials that rotate credential_process is the right tool, it returns an Expiration and the sdk refreshes before it. since youre already getting these from sts web identity you can also skip the file and set AWS_WEB_IDENTITY_TOKEN_FILE and AWS_ROLE_ARN (or web_identity_token_file and role_arn in the profile) and the sdk will call sts and refresh on its own.

    if the old behavior fits your setup better ProfileConfigFileAWSCredentialsProvider is still available and still re-reads the file on its refresh interval, it just isnt part of the default chain anymore. you can pass it to your client directly or add it to your own chain, something like

    class MyCredentialsChain : public Aws::Auth::AWSCredentialsProviderChain {
     public:
      MyCredentialsChain() {
        AddProvider(Aws::MakeShared<Aws::Auth::EnvironmentAWSCredentialsProvider>("MyCredentialsChain"));
        AddProvider(Aws::MakeShared<Aws::Auth::ProfileConfigFileAWSCredentialsProvider>("MyCredentialsChain"));
      }
    };

    that said happy to keep talking about this, if theres something about your setup where none of these work let us know and we can figure out what makes sense.

  3. added
    response-requested
    and removed
    needs-triage
    on Nov 25, 2026
  4. grrtrr commented on Nov 25, 2026

    @grrtrr
    ContributorAuthor

    like dengke awslabs/aws-c-auth#321 (comment) the shared credentials file has no expiration so those credentials are static, and expiration is what should drive a refresh. the old provider forcing a re-read every 5 minutes was the wrong behavior.

    Why are you changing the API behaviour on the fly - this hidden API change has cost us about a week of work. And there may well be other people who use the same pattern.

    It creates an expensive surprise, and I did not see a "breaking change" announcement in the notes.

    You could have kept the CRT-based ProfileCredentialsProvider API-compatible, or at least kept the ProfileConfigFileAWSCredentialsProvider until it is compatible.

    I had thought about doing such a swap, but the provider has a scary looking comment above it:

    // src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h
    
            // class AWS_DEPRECATED("This class is in the maintenance mode, no new updates will be released, use S3EncryptionClientV3. Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.") AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider
            class AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider
            {
  5. sbiscigl commented on Nov 25, 2026

    @sbiscigl
    Collaborator

    really sorry about this, losing a week to a change we made underneath you is frustrating and thats on us. to answer your question directly, this was a runtime break and we made it on purpose for two reasons. we're moving the sdk onto the crt credential providers, and we're aligning with how the other aws sdks behave, botocore and the go v2 sdk both load static profile credentials once and never re-read them.

    you're also right that the comment and the release notes were both wrong. the commented out AWS_DEPRECATED above ProfileConfigFileAWSCredentialsProvider was copy pasted from the s3 encryption client by mistake, the class isnt deprecated and is safe to use. and honestly we didnt really have release notes when we made this change, they were just commit messages, and we've heard from a lot of people that changes like this werent visible. thats why we added changelog entries recently, and thats how we'll document changes like this going forward. ive opened pull/4010 that removes the bad comment and adds a changelog entry for this change after the fact.

    we aren't trying to break anyone here. we want to move the sdk toward conforming behavior in small pieces, with the correct behavior as the default and a way to opt back into the old one when a piece doesn't fit your setup. for this specific piece, we think that moving towards other SDKs while providing this opt-back-in is the correct way forward, however more than happy to talk about it more.

  6. added
    response-requested
    and removed
    response-requested
    on Nov 25, 2026
  7. grrtrr commented on Nov 25, 2026

    @grrtrr
    ContributorAuthor

    Thank you for following up. I agree with your point, since none of the other SDKs supports the polling behaviour. I will work with my colleagues internally to use an alternative (process credentials).

    There were a few other rough edges that I saw while looking into the PR:

    • Crt profile credentials provider #3721 also removed the ProcessCredentialsProvider (which would be a lovely replacement for the polling) - is that intended, is there another path for the process credentials provider?
    • ProfileCredentialsProvider has an empty/unused Reload() method.
    • The DEFAULT_REFRESH_RATE_MS name looks wrong (it is used for the futures-timeout), and its value is too high for just parsing a profile - e.g. 60 sec may be fully sufficient.
    • Maybe mark the refreshRateMs deprecated and remove it altogether.
  8. sbiscigl commented on Nov 25, 2026

    @sbiscigl
    Collaborator

    thanks for working with us on this, and for digging into the rest of the code too.

    #3721 also removed the ProcessCredentialsProvider - is that intended, is there another path for the process credentials provider?

    it actually was intended, the CRT implementation covers process credentials alongside web identity and a few others.

    /*
     * Resolve credentials from a profile. The credential source is determined by the following
     * priority order:
     *
     *   1. Profile: static credentials (aws_access_key_id / aws_secret_access_key)
     *   2. Profile: assume role with source_profile
     *   3. Profile: assume role with credential_source
     *   4. Profile: web identity token (web_identity_token_file)
     *   5. Profile: SSO (not yet supported from profile provider)
     *   6. Profile: legacy SSO (not yet supported from profile provider)
     *   7. Profile: login (not yet supported from profile provider)
     *   8. Profile: process (credential_process)
     */
    

    This was partially the motivation for this change, to use the correct precedence when resolving credentials.

    So if you specify process credentials in your config it should just work, if it doesnt thats a rather large problem we'd like to hear about.

    ProfileCredentialsProvider has an empty/unused Reload() method.

    This is intentional and confusing, however it is correct. the underlying CRT implementation owns its own reload logic, and we didnt want to expose that to customers. ive added a warning log there in case it is invoked directly, so that a user knows nothing is happening.

    The DEFAULT_REFRESH_RATE_MS name looks wrong (it is used for the futures-timeout), and its value is too high for just parsing a profile

    Yeah, rolling this change into the current open PR.

    Maybe mark the refreshRateMs deprecated and remove it altogether.

    agreed it should go away, but we cant remove it without breaking code that passes it, and marking it deprecated fails anyone building with -Werror. so for now passing it logs a warning that its ignored, which should get people off of it until we can actually remove it.

    all of this is rolled into #4010, would love any comments or suggestions you have on it, and thanks again for sticking with us on this one!

  9. removed
    response-requested
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions