fix(iam): random access key secrets and STS credentials - #1437
Merged
Merged
Conversation
IAM secrets were secret-%08x off the shared id counter, so anyone who knew a key id could guess the secret and forge SigV4 under --enforce-auth. Secrets are now 40 random base64 chars; STS uses ASIA + base32 ids and a long random session token, and the gate now requires that token with ASIA keys. Azure and GCP access keys and OCI auth tokens get the same treatment.
…-secret-keys # Conflicts: # server/aws/authgate.go
…etries randString no longer falls back to all-A ids, and every caller passes the error up. Access key id collision retries in IAM and STS stop after 5 tries with an internal error.
NitinKumar004
marked this pull request as ready for review
October 4, 2026 09:57
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.
Summary
IAM
CreateAccessKeybuilt secrets assecret-%08xfrom the shared id counter. Underserve --enforce-auth, anyone who knew an access key id could guess the secret in a few tries and forge SigV4 requests. A test that signs withsecret-00000010against a fresh key got a 200 on the old code.Changes
internal/idgen: newSecretAccessKey(40 chars, base64 alphabet),SessionToken(356 chars, base64 alphabet) andOCIAuthToken(20 chars). They use crypto/rand with rejection sampling and return an error rather than falling back to a fixed value.CreateAccessKeynow uses the random secret and retries the key id on collision.SessionStore.Mintnow issuesASIA+ 16 base32 ids, 40-char secrets and a long random session token. Ids are unique within the store.X-Amz-Security-Tokenheader or query parameter. Before this, the token was never checked.Not changed
test/test) are accepted.Testing
go test -raceon internal/idgen, providers/{aws,azure,gcp}/iam, providers/oci/..., server/aws/..., server/wire/sigv4, server/wire/awsidentity, persist, seed, server/oci, compat/aws auth tests and contrib/server EnforceAuth.cloudemu serve --enforce-authwith the aws CLI: