Repository navigation
fix(guard): close comment and arithmetic bypasses of the artifact guard - #231
Open
TornquistK wants to merge 1 commit into
Open
TornquistK wants to merge 1 commit into
TornquistK wants to merge 1 commit into
Conversation
A # starts a comment only at a word start, a comment in backticks ends at the closing backtick, ${…} is a span, and $(( that closes with a lone ) is read as a substitution with a subshell.
This branch has not been deployed
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.
Summary
Seven command forms wrote a Markdown file into the Working Repository while the artifact guard exited 0. All seven came from two rules in
commandTextMask(packages/mate-core/src/runtime/shell-heredoc.ts).echo hi `# why` > notes/x.md#after$(…)echo $(date)#1 > notes/x.md#after a backtick substitutionecho `id`#1 > notes/x.md#after an escaped spaceecho a\ #b > notes/x.md#after$((…))echo $((1+2))#b > notes/x.md#inside${…}k=${l%% #*}; echo hi > notes/x.md$((that is a subshellecho "$((cat > notes/x.md) </dev/null; true)"Real comments and real arithmetic stay masked. The guard stays a heuristic, not a shell parser.
Evidence
echo a # > notes/x.md,(echo a)#x > notes/x.md,echo $(echo a # c) > notes/x.md,echo hi `# > notes/x.md`, a backtick comment holding an escaped backtick,echo $((2 > 1)) notes/x.md,echo $(( (2 > 1) + 1 )) notes/x.md.typecheck,lint,format:checkandknipexit 0.Merge Danger
Door: two-way
A revert restores the old scanner. Nothing persists.
Blast Radius: hooks
The artifact guard now refuses the seven forms above. The secret guard and the commit-attribution guard share the scanner for heredoc stripping: they see a change only for a
<<marker that follows one of these forms on the same line. Known trade-off: the$((look-ahead ignores quotes, so a quoted)inside arithmetic can flip the reading.