Commit Graph
5 Commits
Author SHA1 Message Date
Thomas Vincent 1aba203d3e fix(security): reject ambiguous shell expansion contexts
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 18:40:10 -07:00
Thomas Vincent 06f49d824a fix(security): reject script fields in backtick substitutions
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 15:30:40 -07:00
Thomas Vincent 3c9678007a fix(security): reject unsupported nested shell grammar in #8237 (#8359)
* fix(security): reject unsupported nested shell grammar

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* test(security): exercise nested grammar rejection in CI coverage

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-14 00:57:53 -07:00
TheWitness abd0acae45 security: address review - nested cmd-sub/backtick handling, coverage gate, test skip
substitute_script_path() now follows the template's own $(...) and backtick
command substitutions as nested parsing contexts with their own quote state, so a
token placed inside one ("$(printf %s <field>)") is judged against that fresh
context instead of a suspended outer double quote. This closes the
nested-reinterpretation bypass where an escaped value sitting inside a command
substitution could be re-activated by an outer double quote. Backslash pairing in
both the unquoted and double-quoted contexts now also neutralizes $ and backtick,
so an escaped command substitution (\$(...) or \`...`) is not mis-detected as live.

.github/workflows/pr-changed-coverage.yml: drop the hard-coded PR-number
allowlist so the job runs whenever the path filter selects it, rather than
silently skipping every unlisted PR once these merge.

tests/Unit/Security/ShellInjection/ScriptFieldShellRoundTripTest.php: skip when
either exec() or proc_open() is unavailable (the test launches the fixture with
exec() while the fixture itself uses proc_open()). The fixture adds 7 nested
command-substitution and backtick round-trip cases (90 -> 97), each proving the
field value echoes back verbatim with nothing inside it executing.
2026-10-12 08:22:22 -04:00
Thomas Vincent c077d88916 fix(security): preserve literal backslashes in quoted script fields
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-10-12 09:07:55 +00:00