Commit fbf9c7e
committed
Fix command injection
Add `--` in some commands that receive user input
and if interpreted as options could lead to remote
code execution (RCE).
There may be more commands that could benefit from `--`
so the input is never interpreted as an option,
but most of those aren't dangerous.
Fixed commands:
- push
- pull
- fetch
- clone/clone_from and friends
- archive (not sure if this one can be exploited, but it doesn't hurt
adding `--` :))
For anyone using GitPython and exposing any of the GitPython methods to users,
make sure to always validate the input (like if starts with `--`).
And for anyone allowing users to pass arbitrary options, be aware
that some options may lead fo RCE, like `--exc`, `--upload-pack`,
`--receive-pack`, `--config` (gitpython-developers#1516).
Ref gitpython-developers#15171 parent 17ff263 commit fbf9c7e
2 files changed
+5
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
| 967 | + | |
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
994 | | - | |
| 994 | + | |
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
| |||
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
| 1037 | + | |
1037 | 1038 | | |
1038 | 1039 | | |
1039 | 1040 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1169 | 1169 | | |
1170 | 1170 | | |
1171 | 1171 | | |
| 1172 | + | |
1172 | 1173 | | |
1173 | 1174 | | |
1174 | 1175 | | |
| |||
1305 | 1306 | | |
1306 | 1307 | | |
1307 | 1308 | | |
1308 | | - | |
| 1309 | + | |
1309 | 1310 | | |
1310 | 1311 | | |
1311 | 1312 | | |
| |||
0 commit comments