feat(aws): track AWS CLI profiles and let nonprod reauthenticate - #121
Open
wadefletch wants to merge 1 commit into
Open
feat(aws): track AWS CLI profiles and let nonprod reauthenticate#121wadefletch wants to merge 1 commit into
wadefletch wants to merge 1 commit into
Conversation
~/.aws/config was the last untracked piece of shell setup, so a new machine needed it rebuilt by hand. The nonprod profile reaches its account by assuming OrganizationAccountAccessRole from root, and a profile configured that way carries no sso_start_url of its own. Any tool that offers to reauthenticate when the session lapses — fnox does, on every directory entry, because constellation's mise config sources it — ran `aws sso login` against that profile and failed on missing SSO configuration. Declaring sso_session on the profile gives the login command a session to resolve while leaving credential resolution alone: assume-role precedes sso in the provider chain, so the identity stays OrganizationAccountAccessRole. That exact role ARN is what the cross-account CodeArtifact trust policies match on, so turning nonprod into an ordinary SSO profile would have broken `secrets:fetch` and `codeartifact:login` instead. Only the config file is tracked. Credentials and the token cache stay host-local, so the package stows without folding, as codex already does.
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.
Why
~/.aws/configwas the last untracked piece of shell setup — a new machine needed it rebuilt by hand.It also carried a latent bug. Opening a terminal in
constellationfailed with:Answering yes then failed a second time:
constellation's mise config sources fnox on every directory entry to decrypt the KMS values infnox.toml, and.env.localpinsAWS_PROFILE=nonprod. Thenonprodprofile reaches its account by assumingOrganizationAccountAccessRolefromroot, so it has no SSO configuration of its own — andaws sso loginresolves SSO settings from the named profile only, never throughsource_profile.What changed
Declaring
sso_sessionon the profile gives the login command a session to resolve, without disturbing credential resolution:Keeping the chain matters.
assume-roleprecedesssoin botocore's provider chain, so the resolved identity staysOrganizationAccountAccessRole— and that exact ARN is what two cross-account trust policies match on (ArnLike aws:PrincipalArn):codeartifact-npm-readin shared-services, whichconstellation'smise run secrets:fetchassumescodeartifact-readin distribution, which a scaffolded project'smise run codeartifact:loginassumesConverting
nonprodto an ordinary SSO profile would have fixed the login and broken both.The
carlyleprofile is dropped;caddiwas never present locally.brizzcostays — it is a fictional customer used for bring-your-own-cloud testing.Scope
Only
~/.aws/configis tracked. Credentials and the SSO token cache stay host-local, so the package stows without folding — the same treatmentcodexalready gets.bootstrap.shnow drives that off aNO_FOLDINGlist instead of a hardcodedcodexcomparison.Verification
bash -n bootstrap.shpasses;NO_FOLDINGroutesawsandcodexto--no-folding, others to foldingstow -n --restow --no-folding awsreports no conflicts;~/.aws/configis a symlink andsso/,cli/,workbench/are untouchedaws configure list-profileslists all 12 profilesaws sso loginunderAWS_PROFILE=nonprodreaches the browser step instead of erroring on configuration--debugconfirms the provider chain still selectsassume-rolefornonprod, before and after