Skip to content

Check Placeholders Inside a String Handed to a Second Shell in Paste-Safe #4375

Done

Description

@ptr727

Problem

The paste-safe rule in prose_lint.py reads a copy-and-run command the way the outer shell does. A placeholder sitting inside a single-quoted string that is passed to a second shell gets no check, even though that second shell reads a bare <name> as a redirection.

Here is a constructed case that the rule passes without a finding:

su -l root -c 'usermod -aG sudo <account>'

The outer shell treats <account> as literal text inside the single quotes. su then gives the string to a shell, and that shell tries to open a file named account for input. The same goes for sh -c '...', bash -c '...', ssh host '...', and sudo sh -c '...'.

GOVERNANCE.md "Copy-and-Run Commands" already requires quoting inside a string handed to a second shell. The rule just does not check it. The one instance in the tree, host-setup/README.md:32, was fixed by hand in #4374.

Done when

paste-safe reports an unquoted placeholder inside the string argument of a known second-shell command (su -c, sh -c, bash -c, ssh), and the test suite includes this constructed case.

Follow-up to #1615.

Activity

  1. ptr727 commented on Nov 23, 2026

    @ptr727
    OwnerAuthor

    Backlog burndown claim (round 5, 2026-11-23): branch burndown/paste-safe-second-shell.

    Predicted files: .github/actions/prose-gate/prose_lint.py, tests/test_prose_lint.py, .github/actions/prose-gate/prose-gate.json, host-setup/agent-safety/README.md (granted 2026-11-23 on the maintainer's approval; the pull request merges only on his go-ahead), GOVERNANCE.md (the "Copy-and-Run Commands" sentence, granted 2026-11-24 after #4378 merged) and its build_dist-generated include regions.

    Group issues: #4375. Resumed 2026-11-24.

  2. ptr727 commented on Nov 23, 2026

    @ptr727
    OwnerAuthor

    Maintainer's answer, 2026-11-23 (recorded during backlog burndown round 5): approved. Where the stricter check flags the whole-command placeholder in host-setup/agent-safety/README.md, rewrite that span as a concrete constructed loop or as prose rather than a copy-and-run command, and add no exemption to the gate. Because that file is under host-setup/agent-safety/, the pull request merges only on the maintainer's own go-ahead after he reads the diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions