R93 Pass text through a shell only from a file written with a quoted heredoc

Off by default

Superseded by R285 Pass text through a shell from a file written with a quoted heredoc.

Write a message, a body or a commit message that you pass to a command through a shell into a file with a quoted heredoc first, and pass the file.

Reason

Inside double quotes the shell expands $ and backticks, so a code span in Markdown runs as a command and a value in the text is replaced by whatever the shell finds, with no error. Text quoted from others can carry a command that way, which is a flaw others can exploit (Art. II §7), and a changed number in a report states a fact that was never looked up (Art. VII §1(2)). Single quotes break on the first apostrophe. A heredoc with a quoted delimiter passes every character as written, whatever the text holds, so there is one way for every text and no case to judge.

Verification

The text covered is prose for people or agents: a message to an agent, the body of a pull request, issue or comment, and a commit message, whatever its length. A title of one line, flags, paths and identifiers are not covered. A quoted heredoc is one whose delimiter is quoted, as in <<'EOF'. Passing the file means the command reads it, for example through --body-file, -F or "$(cat <file>)".

Violated when an agent passes such text to a command as a literal in the command line, in any quoting, or writes it with a heredoc whose delimiter is not quoted, or pipes a heredoc into the command without writing it to a file.

Provisions of the constitution it cites

Relations

Parent
R13 Security
Requires
none
Conflicts with
none

Metadata

ID
93
Revision
3
Kind
rule
Status
superseded
Slug
pass-shell-text-from-a-quoted-heredoc-file
Default level
project
Constitution revisions
>=1
Check
none
Default
off
Uses
Instructions instructions
Original language
English en
Translations
Chinese zh