Skip to content

Shell serial stack: here-strings, heredoc terminators, arithmetic/comment openers, secret ordering - #945

Open
TheGreatAxios wants to merge 4 commits into
mainfrom
cl-0324-shell-serial
Open

Shell serial stack: here-strings, heredoc terminators, arithmetic/comment openers, secret ordering#945
TheGreatAxios wants to merge 4 commits into
mainfrom
cl-0324-shell-serial

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Stacks four shell-serial fixes (0.3.24 posture: open only, do not merge).

Issues: CL-7319, CL-7386, CL-7387, CL-5420.

Commits (in order):

  1. a4e5812 — Treat here-strings as inline arguments, never heredoc openers (CL-7319). Acceptance: cat <<< word parses the word as an inline argument; no heredoc body is opened and the following chain still splits.
  2. 32e6d6e — Match heredoc terminators exactly, tab-stripping only for <<- (CL-7386). Acceptance: a space-indented marker does not close plain <<; CRLF markers compare CR-stripped; splitter and approval display agree on where the heredoc ends.
  3. 4cebff2 — Ignore heredoc openers inside arithmetic and comments (CL-7387). Acceptance: << inside ((/$((is left-shift and after a top-level#is documentation, so neither opens a heredoc. Follow-up fix folded in: the comment guard is a commentToEOL flag that suppresses ONLY the<<branch — operators after#still split, sosplitChainedCommand("# note && rm -rf /")surfacesrm -rf /` as its own segment.
  4. 50e0681 — Lock secret-before-listing ordering for shell secret paths (CL-5420). Acceptance: pure ls of a secret name still asks, chains flag the content-reading half, bounded listings stay exempt, unbounded listings still ask.

Verification:

  • bun test src/permission/permission.test.ts src/tui/command-display.test.ts src/permission/command.test.ts src/permission/classify-security.test.ts tests/unit/permission/cross-commit-composition.test.ts → 426 pass, 0 fail
  • bun run typecheck (tsc --noEmit) → clean
  • bunx oxlint on touched files → clean
  • bun run check → sole red is pre-existing oxfmt on untouched src/subagent/spawn-agent-worktree.test.ts (not in this branch diff; fails on main too)
  • Display verbatim behavior unchanged (only newline splits there); 7319/7386/5420 hunks untouched.

Trim-based closing accepted a space-indented marker for plain << and kept a stray carriage return in CRLF markers, so the splitter and the approval display disagreed with the shell about where a heredoc ends. Compare exact lines instead.
A << inside ((/$(( is the left-shift operator and a << after a top-level # is documentation, so neither the splitter nor the approval display may open a heredoc there and swallow the following chain. Track arithmetic depth and skip #-to-EOL comments in both.
Pure ls of a secret name still asks, and chains flag the content-reading half; bounded listings stay exempt and unbounded listings still ask. The secret-first ordering already holds at all three sites (classify auto-allow, gate segment guard, auto-shell policy) — these tests pin it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant