Skip to content

Resolve local AWS credentials via the full provider chain#39

Open
stevethomas wants to merge 2 commits into
mainfrom
support-credential-process
Open

Resolve local AWS credentials via the full provider chain#39
stevethomas wants to merge 2 commits into
mainfrom
support-credential-process

Conversation

@stevethomas
Copy link
Copy Markdown
Member

@stevethomas stevethomas commented May 23, 2026

Summary

Prerequisite for credential_process-based auth (1Password / SSO / Keychain). Replaces the local branch's CredentialProvider::ini() in RegistersAws::awsCredentials() with an explicit, memoised credential chain scoped to the keyed profile:

process(credentials) → ini(credentials) → process(config) → ini(config)

This lets a profile defined purely via credential_process in ~/.aws/config resolve — the seam 1Password's op plugs into — so long-lived keys can be kept out of ~/.aws/credentials entirely, while plain static-key profiles keep working unchanged.

Built explicitly rather than via defaultProvider() because defaultProvider() only selects the profile from the $AWS_PROFILE env var (it ignores a passed-in profile). The explicit chain keeps the profile scoped without mutating the environment, and avoids defaultProvider()'s fall-through to the IMDS/instance provider on a misconfigured local profile.

Backwards compatibility

  • Only the local branch changes — CI (env keys) and on-AWS (IMDS role) branches return earlier and are untouched.
  • A plain static key+secret profile still resolves via the chain's ini link.
  • Verified locally against temp credentials/config files: a static-key profile and a credential_process profile both resolve correctly.

Test plan

  • ./vendor/bin/pest — 213 passed
  • ./vendor/bin/phpstan analyse --memory-limit=1G — no errors
  • ./vendor/bin/pint — pass
  • Manual: static-key profile + credential_process profile both resolve via the chain

🤖 Generated with Claude Code

stevethomas and others added 2 commits May 23, 2026 17:14
Switch the local credential branch from CredentialProvider::ini() to
defaultProvider() (with AWS_PROFILE set from the keyed env) so a
credential_process profile — e.g. 1Password-backed short-lived
credentials — resolves alongside plain static access keys.

Backwards compatible: only the local branch changes (CI and on-AWS
paths untouched), and a static key+secret profile still resolves via
the chain's ini link.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
defaultProvider() only selects the profile from $AWS_PROFILE, so the
earlier approach set it via putenv. Replace with an explicit memoised
chain (process + ini against both the credentials and config files)
scoped to the keyed profile — no environment mutation, and no fall-
through to the IMDS provider on a misconfigured local profile.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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