Skip to content

Commit 23f33ef

Browse files
authored
Merge pull request #2342 from gitpython-developers/fix-threatmodel
docs(security): clarify command wrapper responsibilities
2 parents 2ad7960 + 1cc7239 commit 23f33ef

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎SECURITY.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ For an untrusted repository directory, Git recommends obtaining a clean copy wit
3737
unprivileged user for additional isolation. See
3838
[Git's `git-upload-pack` security guidance](https://github.com/git/git/blob/master/Documentation/git-upload-pack.adoc#security).
3939

40+
`git.cmd.Git`, also exposed as `repo.git`, is a low-level command wrapper: it
41+
runs the Git command with the arguments and options the caller supplies. It does
42+
what it is told, including file reads, writes, or command execution requested
43+
through those options. These explicitly requested effects are intended command
44+
behavior, not unwanted side effects. For example,
45+
`repo.git.checkout(pathspec_from_file=path)` asks Git to read `path` as pathspec
46+
input, and Git's diagnostics may include that input. Applications exposing this
47+
interface to untrusted callers must restrict commands, arguments, and options
48+
and control which output and errors they disclose.
49+
50+
Higher-level methods, such as `Head.checkout()` and `Repo.clone_from()`, provide
51+
specific operations and apply protections against options or operands that
52+
introduce unwanted side effects beyond those operations. Where supported,
53+
callers can explicitly opt into unsafe behavior. These protections do not
54+
restrict direct calls through the command wrapper; bypasses of higher-level
55+
protections remain reportable.
56+
4057
Violations of these trust boundaries or bypasses of Git's intended protections
4158
remain reportable, including cases where Git itself is affected.
4259

0 commit comments

Comments
 (0)