Repository navigation
A variable on the line can't run code during a check (1.2.3) - #187
Merged
Merged
Conversation
The identity lookup gets the call's own environment, so a variable the line set could make it run what the line chose, before any verdict. Such a call now stops as "can't tell" without starting the lookup, naming the variable and never its value. Variables set before the line started stay the user's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PATH or PATHEXT the line set chose which file the identity lookup started, and what a shim started by bare name. The lookup now uses the ones the line started with, so honest PATH lines keep working. A CLI that isn't there stops as "can't tell" when the line changed PATH, since the command may find one the lookup can't. This also closes a silent allow: a PATH the line built from something unknown ($PATH) reached the lookup as no PATH at all, which read as a CLI not installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
guard's folding keeps the first spelling in code-unit order, so a line's $env:path lost to the environment's Path and the CLI read as not installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cloudpin switch starts the CLIs with its own environment, and the question the hook asks showed only cloudpin's own variables, so a person could approve a line whose PATH or NODE_OPTIONS chose what runs. Such a line is now denied, naming the variable. A person in a terminal runs their own switch as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AZURE_CONFIG_DIR picks the account, so the lookup keeps getting it. A folder the line chose that holds extensions, or a config file naming them, would have az import that code during the lookup, so that call stops as "can't tell". Also a test that kubeconfig exec plugins and helm's plugins start nothing, since the kubernetes provider only reads the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pure move, to leave room in a file at its size limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
env takes any word with an = before the command as a variable, so env 'A^=1' az group list --subscription other lost the call and the hook allowed it with no lookup. It is read now, and a name only known when the line runs stops as "can't tell". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmd /c "set GH_TOKEN=x&& gh pr list" reached no lookup with that token, so the hook checked the wrong identity. A set on a cmd line now reaches the calls after it, and set /a and /p stop as "can't tell". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assert the words of a "can't tell" and of a refusal, which an exception also denies; a set in quotes; each printing set on its own; explain in shell mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read as a command, GH folds to gh, so the mutation that kept it survived. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It does what it did on folded names, and the same file then works where an environment is not folded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… form Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The fix from 1.2.3 (released 2026-11-05, tag
v1.2.3onrelease/1.2.3), brought tomainin full, with 1.2.3's docs.To check a command, cloudpin starts the CLI's identity lookup with the command's environment. A variable set on the line that makes a program run code (
NODE_OPTIONS,PYTHONPATH,BASH_ENVand others, listed and sourced insrc/line-code-env.ts) or aPATHpointing at a planted file could run code during the check, in the hook,explainandcloudpin_check. Now:PATHthe line started with;PATHbuilt from$PATHon the line no longer reads as "not installed" and skips the check;env 'A^=1' cli,sudolikewise, andcmd /c "set X=y&& cli"are followed.Main has more than 1.2.3: an agent's
cloudpin switchon such a line is refused, and the rule reads every form November's line reader follows (set -a,Set-Item env:X,+=). 1.2.3's parser doesn't read those forms, and 1.3.0 will.Owner decisions: every listed variable stays a stop, including
HOMEandAWS_CONFIG_FILE, becausecredential_processcan run a command from that file. Set them before starting the agent. A person's terminalcloudpin execis unchanged, since it can't tell a line from their environment.CLAUDE.md's provider rule 3 now names this exception.Evidence
npm run typecheckexit 0;npx vitest runpasses on main (4883 before the docs commit), and 2501 onrelease/1.2.3, with Nightly green there.explainand MCP: code ran in 31 cases on the control build and 0 on this one. Re-run by the maintainer's session; the other 5 runs that execute are terminal cases, left by decision.cloudpin@1.2.3integrity equals the release tarball (1.2.2's differs); its attestation verifies, and a wrong-repo control fails.Not tested
No real CLI. Linux and macOS spawns come from this PR's Linux job and Nightly, not a run here.
LD_*,DYLD_*,PERL5*,RUBY*,AWS_CONFIG_FILEand the Azure extension folder are from documentation and source.🤖 Generated with Claude Code