Harden git_gate.py shell rendering with shlex.quote and name validation #155
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Tracked from the medium-priority refactoring playbook in #154.
git_gate_render_entrypoint()passesGitEntry.Nameandupstream_urlinto a POSIX shell script using single-quoted interpolation.GitEntry.Nameis only validated for non-empty, so a name containing a single quote (e.g.o'reilly) will break the generated script and could allow injection into the entrypoint.Work
shlex.quote()tonameandupstream_urlbefore interpolation ingit_gate_render_entrypoint()(and any other rendering functions that embed manifest-controlled values into shell).GitEntry(or_from_object()) that rejects names containing characters unsafe for shell identifiers, or rely onshlex.quote()and document that names are quoted.NameandUpstreamvalues (single quotes, spaces, semicolons) to pin the fix.