From 9ed8f10e83381a9feaa74aa6d2b2afc45b64199b Mon Sep 17 00:00:00 2001 From: Ray Xu Date: Fri, 13 Nov 2026 22:22:23 +0000 Subject: [PATCH] fix(security): treat backticks inside single quotes as plain text The ssh-to-self floor read a backtick or $( inside a single-quoted argument as a live command substitution. Bash keeps that text as plain characters, so a PR body or commit message that quotes an ssh example in Markdown code spans was refused although nothing runs. The shared payload walk now reads substitution openers with the quote state the shell uses: one inside '...' or $'...' opens no nested frame. Double quotes, unquoted text, sh -c and eval scripts, and heredocs a shell runs still open one, so every real refusal stays. The catalog pattern row is unchanged. Closes #36887 --- docs/system-specs/modules/security.md | 22 ++ src/kiro_crew/security/argv_floor.py | 1 + src/kiro_crew/security/argv_floor_self.py | 22 +- src/kiro_crew/security/argv_floor_ssh.py | 12 +- src/kiro_crew/security/shell_normalizer.py | 22 +- .../security/shell_normalizer_walk.py | 106 +++++++--- .../ssh-self-quoted-message-flags.txt | 8 + test/test_argv_rules.py | 1 + .../test_denied_commands_security_ssh_self.py | 193 ++++++++++++++++++ 9 files changed, 345 insertions(+), 42 deletions(-) create mode 100644 test/security_line_budget/ssh-self-quoted-message-flags.txt diff --git a/docs/system-specs/modules/security.md b/docs/system-specs/modules/security.md index db9c4e48f0c6..4a97da634860 100644 --- a/docs/system-specs/modules/security.md +++ b/docs/system-specs/modules/security.md @@ -1086,6 +1086,28 @@ Two mechanisms make "the split changed nothing for a caller" a tested claim rath views in `deny_gate.py` and to `shell_normalizer._shell_payload_walk` (the self-protection and git-publish floors), which add them to the frame's own payloads, so `sh -c 2>/dev/null '