Repository navigation
Agent lines: follow variables set earlier in the line (#86) - #87
Merged
Merged
Conversation
Found in the review of the threat model. `export AWS_PROFILE=other; aws ...` and PowerShell `$env:AWS_PROFILE='other'; aws ...` were checked against the default account, and `GH_TOKEN=$(cat other.token) gh ...` read GH_TOKEN as empty; each ran on another account. The command parser now carries export / declare -x / typeset -x / unset / $env: through the rest of the line (not out of a ( ) subshell or bash -c). A plain `X=1;` reaches a command only if X is already exported, so envFor applies it only then. A value from $(...), backticks or $VAR is unknown: if it decides the CLI's account (its identity variables, e.g. GH_TOKEN, AWS_*), the guard blocks and says why instead of guessing; other unknown values never reach the CLI. The hook and explain share envFor; agents still can't set the user-only variables. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Closes #86
Found in the review of the threat model (#85). Before this, a variable an agent set earlier in the same command line was ignored, and a value only known when the line runs was read as empty. cloudpin checked the default account while the command ran on another:
export AWS_PROFILE=other; aws s3 lsother$env:AWS_PROFILE = 'other'; aws s3 ls(PowerShell)otherGH_TOKEN=$(cat other.token) gh repo listGH_TOKENis set from something only known when it runsHow
export,declare -x/typeset -x,unsetand$env:through the rest of the line. These don't leak out of a( )subshell,bash -cor$( ).X=1;reaches a command only ifXis already exported, soenvForapplies it only then. Applying it otherwise would check an account the command won't use.$(...), backticks or$VARis unknown. If it's one of the CLI's identity variables (e.g.GH_TOKEN,GH_HOST,AWS_*), the guard blocks it as "can't tell". Other unknown values are dropped before the CLI's identity check runs.cloudpin explainshareenvFor. Agents still can't set or unsetCLOUDPIN_ENV,CLOUDPIN_CONFIRMorCLOUDPIN_SKIP.Checked
$(...)as known. All five caught.gh(read-onlyexplain --agent):gh repo listallowed;GH_TOKEN=$(...) gh repo listandexport GH_HOST=$(...); gh repo listblocked with the reason.On the critical path for 1.0.0, so it merges when CI is green.
🤖 Generated with Claude Code