Repository navigation
fix(shellwrap): mask glued docker env forms inside a command string - #1749
Merged
Dumbris merged 1 commit intoOct 26, 2026
Merged
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Dumbris
approved these changes
Oct 26, 2026
Dumbris
left a comment
Member
There was a problem hiding this comment.
Verified: the PR test fails on main for the reason described and passes on this branch merged with main; race tests for the touched packages and CI lint (bare and server tags) are clean. Also built and tested together with the rest of this batch, independently reviewed, and cross-reviewed with a second model.
Member
|
Merged. Thank you, @rudycelekli! Glued docker env forms ( |
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.
Pull Request
Description
shellwrap.RedactDockerArgsmasks the value of every docker env injection in three argv shapes:-e KEY=VALUE, the glued-eKEY=VALUE/--env=KEY=VALUE, and a whitespace-bearing command-string element. But the command-string rule (RedactDockerCommandStringWith) only knows the spaced form — its regex requires whitespace after-e/--env. So the glued spellings are masked when they are separate argv elements and published in the clear once a login-shell wrap folds the docker line into the single-cstring.Trigger. A stdio server configured as
{"command": "docker", "args": ["run", "-i", "--rm", "--env=API_TOKEN=…", "img"]}is wrapped by
WrapWithUserShellinto["-l", "-c", "docker run -i --rm --env=API_TOKEN=… img"]. Every spawn log sink (launcher command prepared, the[launcher] starting:banner inserver-<name>.log,Initialized stdio transport) goes throughoauth.AuditRedaction.SpawnArgv, whose stage 1 is this structural rule. Stage 2 (flag-name + value-shape) does not rescue it when the key name is not sensitive-looking, which is exactly the case the structural rule exists for. Checked throughSpawnArgvonmain:Fix
A second regex in
RedactDockerCommandStringWithcovers the glued forms, bare or as one quoted word (Shellescapesingle-quotes the whole token when the value has whitespace, e.g.'--env=K=a b'). The value goes through the samemaskEnvTokenWith, so the key and quotes are kept and onlyVALUEis masked. It is the same-e+=rule the argv path already applies to a glued element, so the two paths now agree. Tokens without=(node -e console.log(1),--entrypoint /bin/sh) are untouched.Testing
TestRedactDockerCommandString_GluedForms(ininternal/shellwrap/redact_test.go) covers long, short, single-quoted and double-quoted glued forms through bothRedactDockerCommandStringandRedactDockerArgswith a-celement, plus a no-change check for non-env-e…tokens.