What's wrong with this entry?
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.
- A new recursive function
dnu()walkstest_commandAST nodes and their four nested compound-expression node types:unary_expression,binary_expression,negated_expression, andparenthesized_expression - For each node the function tracks a byte-position cursor from
startIndextoendIndexand 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
endIndexand the node's ownendIndex, 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
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.