Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track credential providers via User-Agent Feature ids #3008

Merged
merged 17 commits into from
Feb 21, 2025

Conversation

Madrigal
Copy link
Contributor

We already have a way to track feature ids via the user agent middleware. This PR adds a way to track which credential provider(s) have been used for getting the credentials on a certain service.

These features have been defined on a SEP, and a single provider can have multiple features depending on how the credentials were resolved

This is implemented by having the config object track which credential providers have been used, since it's the main point of entry where credentials are being loaded via config.LoadDefaultConfig.

Why not use the existing ProviderName field on aws.Credentials?

Because of 2 reasons

  1. The same provider can be used for multiple features we want to track, so we can't tell just by the provider which feature to add
  2. Adding this to the credentials object would make it more difficult to emit these metrics, since they'd have to be added only when credentials are resolved.

Why not extend the interface of credential provider to add this new method?

Because that would be a breaking change, since any credential provider implemented by a 3rd party would no longer satisfy the interface.

Why some providers have credential chain passed on the options struct instead of being part of the main provider?

Mainly due to backwards compatibility. The ones where options are used have a New() method on the package, and this is the main way to create a new provider. Adding a new field would change the signature.

How do we handle credential refresh?

Other SDKs have the concept of credential chain, where a provider is tried, and if it fails, there is a chain of credential providers that gets retried until valid credentials are found. In Go, we resolve credentials when we create the config object, but after that no changes are made to the credentials

Are there any known gaps?

Main thing is capturing intermediate credentials. We'd like to track the calls made to SSO to see which provider chain has been used. However, SSO doesn't use the aws.Credentials object and instead uses an access token that is set directly into it, so this whole process fails and we don't set any feature on the user agent.

@Madrigal Madrigal requested a review from a team as a code owner February 13, 2025 17:34
@Madrigal Madrigal requested a review from wty-Bryant February 19, 2025 16:07
@Madrigal Madrigal merged commit 402370d into main Feb 21, 2025
13 checks passed
@Madrigal Madrigal deleted the feat-track-credential-source branch February 21, 2025 16:38
Madrigal added a commit that referenced this pull request Feb 21, 2025
Madrigal added a commit that referenced this pull request Feb 21, 2025
…"This reverts commit 402370d. (#3015)

* Revert "Track credential providers via User-Agent Feature ids (#3008)"

This reverts commit 402370d.
Madrigal added a commit that referenced this pull request Feb 24, 2025
Madrigal added a commit that referenced this pull request Feb 27, 2025
* Reapply "Track credential providers via User-Agent Feature ids (#3008)"This reverts commit 402370d. (#3015)
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