Answer security round 4: 1 🔴, 1 🟡; refuse the format options that start gpg, and load no settings from the case's clone

This commit is contained in:
2026-10-16 22:42:11 +02:00
parent e57309a415
commit 57cd5f76a4
4 changed files with 11 additions and 10 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ working directory, with GIT_DIR and GIT_WORK_TREE pinned to it.
The wrapper refuses every subcommand and option ALLOWED does not list, so a cluster of short options
or a long option cut to a prefix is refused too. An option that takes a value takes it glued, as
`--format=%h`. A commit needs `-m`, whose value is the one free-text argument. Every other argument
`--grep=fix`. A commit needs `-m`, whose value is the one free-text argument. Every other argument
must name no path outside the clone. git runs with no global or system config, hook, pager or editor.
The wrapper checks the arguments git receives, after the shell has removed quotes and expanded `$`,
so no quoting hides a path from it. It lives outside the clone, so a module planted in the clone
@@ -25,10 +25,10 @@ ALLOWED = {
"add": {"-A", "--all", "-u", "--update"},
"commit": {"-a", "--all"},
"diff": OUTPUT | {"--cached", "--check", "--staged", "--word-diff"},
"log": OUTPUT | {"--author=", "--decorate", "--follow", "--format=", "--graph", "--grep=", "--max-count=",
"--oneline", "-p", "--patch", "--pretty=", "--reverse", "--since=", "--until="},
"log": OUTPUT | {"--author=", "--decorate", "--follow", "--graph", "--grep=", "--max-count=",
"--oneline", "-p", "--patch", "--reverse", "--since=", "--until="},
"ls-files": {"--cached", "--deleted", "--exclude-standard", "--modified", "--others"},
"show": OUTPUT | {"--format=", "--no-patch", "--oneline", "--pretty=", "-s"},
"show": OUTPUT | {"--no-patch", "--oneline", "-s"},
"status": {"-b", "--branch", "--porcelain", "-s", "--short"},
}
# The commit identity, since no config supplies one.