Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.213 ·

Shell Safety: Test Command Gap Analysis

Entry
JSON All of v2.1.213
EntryKind: in v2.1.213,
ImprovementsSection of the release
What

The Bash safety parser now checks test commands ([[ ... ]]) for unparsed bytes between children or after the last child, which would indicate the parser missed content the shell will actually see.

Details
  • A new recursive function dnu() walks test_command AST nodes and their four nested compound-expression node types: unary_expression, binary_expression, negated_expression, and parenthesized_expression
  • For each node the function tracks a byte-position cursor from startIndex to endIndex and measures the gap before each child and after the last child; gaps that contain only whitespace (spaces, tabs), backslash-newline continuations, or (in bash mode) comment characters are allowed
  • Between-children gap: if the bytes between two adjacent parsed children are non-trivial, the function returns { kind: "too-complex", reason: "Test command has unparsed bytes between children — parser dropped content that shell will see" }
  • After-last-child gap: if bytes remain between the last child's endIndex and the node's own endIndex, the function returns { kind: "too-complex", reason: "Test command has unparsed bytes after its last child — parser dropped content that shell will see" }
  • Child out-of-bounds: if a child's span extends outside the parent's span, the function returns { kind: "too-complex", reason: "Test command child extends past the node span — gap byte accounting is untrustworthy" }
  • All three cases produce a "too-complex" result; the safety classifier treats "too-complex" as inability to determine read-only status, so the command is not automatically approved — the user sees the standard "approve this command?" prompt rather than a silent pass-through
  • This closes a semantic gap where a tree-sitter parse failure inside [[ ]] could have caused the classifier to analyse a truncated/simplified version of the condition and incorrectly allow a command that the shell would evaluate differently
Evidence

Test command validation (search for "Test command has unparsed bytes between children", "Test command has unparsed bytes after its last child"); gap-check implementation (search for dnu, Zru, unu)

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

See this entry in the whole of v2.1.213 →

Feedback