Harden git_gate.py shell rendering #166
Reference in New Issue
Block a user
Delete Branch "fix/shell-injection-git-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #155.
Summary
bot_bottle/git_gate.py—git_gate_render_entrypoint()now callsshlex.quote()on bothnameandupstream_urlbefore embedding them in the generated sh script, so values containing single quotes, spaces, semicolons, or other shell metacharacters cannot break or inject into the entrypoint.bot_bottle/manifest_git.py—GitEntry.from_repos_entry()now rejects repo names that do not match[A-Za-z0-9._-]+, making the manifest the first line of defence andshlex.quote()the belt-and-suspenders backstop.tests/unit/test_git_gate.py— regression tests for a single-quoted URL and a URL with spaces/semicolons; the existingtest_one_init_repo_call_per_upstreamassertion is updated to parse the call viashlex.splitrather than string-matching the raw quoted form.tests/unit/test_manifest_git.py— four name-validation tests (',,;,$all rejected;my.repo-name_1accepted).Changes (1 commit)
cc0c952fix(security): harden git_gate.py shell rendering with shlex.quote and name validation