Add regression tests for shell escaping with malicious Name/Upstream values #159

Closed
opened 2026-06-02 22:30:43 -04:00 by didericis-claude · 0 comments
Collaborator

Tracked from the medium-priority refactoring playbook in #154.

The git-gate shell rendering functions (git_gate_render_entrypoint, git_gate_render_hook, git_gate_render_access_hook) embed manifest-controlled values (GitEntry.Name, upstream_url) into generated POSIX shell scripts. There are currently no tests that exercise pathological values, so regressions in escaping would go undetected.

Work

  • Add unit tests for each rendering function that pass GitEntry objects with names/upstreams containing: single quotes, double quotes, spaces, semicolons, newlines, and backticks.
  • Assert the rendered output is syntactically valid shell (e.g. parse with bash -n or sh -n in a subprocess) and that the embedded values are correctly quoted/escaped.
  • These tests should be added alongside or after the shlex.quote hardening in the related issue.
Tracked from the medium-priority refactoring playbook in #154. The git-gate shell rendering functions (`git_gate_render_entrypoint`, `git_gate_render_hook`, `git_gate_render_access_hook`) embed manifest-controlled values (`GitEntry.Name`, `upstream_url`) into generated POSIX shell scripts. There are currently no tests that exercise pathological values, so regressions in escaping would go undetected. ## Work - Add unit tests for each rendering function that pass `GitEntry` objects with names/upstreams containing: single quotes, double quotes, spaces, semicolons, newlines, and backticks. - Assert the rendered output is syntactically valid shell (e.g. parse with `bash -n` or `sh -n` in a subprocess) and that the embedded values are correctly quoted/escaped. - These tests should be added alongside or after the `shlex.quote` hardening in the related issue.
didericis added the Kind/EnhancementKind/Security labels 2026-06-02 23:32:38 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: didericis/bot-bottle#159