Title: I would like to contribute a "safe mode" for working with untrusted repos · Issue #2020 · gitpython-developers/GitPython · GitHub
Open Graph Title: I would like to contribute a "safe mode" for working with untrusted repos · Issue #2020 · gitpython-developers/GitPython
X Title: I would like to contribute a "safe mode" for working with untrusted repos · Issue #2020 · gitpython-developers/GitPython
Description: For f-droid.org, we build thousands of Android apps from git repos. To reduce our attack surface and work towards "least authority", we use a custom Git wrapper that locks down a lot of things that we never need, and have a higher risk o...
Open Graph Description: For f-droid.org, we build thousands of Android apps from git repos. To reduce our attack surface and work towards "least authority", we use a custom Git wrapper that locks down a lot of things that...
X Description: For f-droid.org, we build thousands of Android apps from git repos. To reduce our attack surface and work towards "least authority", we use a custom Git wrapper that locks down a lot of t...
Opengraph URL: https://github.com/gitpython-developers/GitPython/issues/2020
X: @github
Domain: togithub.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"I would like to contribute a \"safe mode\" for working with untrusted repos","articleBody":"For f-droid.org, we build thousands of Android apps from git repos. To reduce our attack surface and work towards \"least authority\", we use a custom Git wrapper that locks down a lot of things that we never need, and have a higher risk of vulnerabilities. I would like to rework this to be a part of GitPython. So I'm opening this issue to see if this is something that the GitPython maintainers would be interested in merging.\n\nI'm open on the API, it could be something like this:\n\n```python\ngit_repo = git.repo.Repo('.', safe=True)\n```\n\nThe goal would be then that all invocations of Git would include these kinds options:\n\n```config\ncore.askpass = /bin/true\ncore.hooksPath = /dev/null\ncore.sshCommand = /bin/true\ncredential.helper = /bin/true\nhttp.emptyAuth = true\nprotocol.allow = never\nprotocol.https.allow = always\nurl.https://.insteadOf = ssh://\n```\n\nAnd run with these env vars:\n\n```bash\nGIT_TERMINAL_PROMPT=0\nGIT_ASKPASS=/bin/true\nSSH_ASKPASS=/bin/true\nGIT_SSH=/bin/true # for git \u003c 2.3\n```\n\nThis then hopefully only allows unauthenticated access to HTTPS repos, and prevents the execution of any command besides `git`. This would eliminate risks like these:\n\n* https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-2mqj-m65w-jghx\n* https://stackoverflow.com/questions/74200395/is-it-dangerous-to-open-or-clone-a-git-repository-from-an-untrusted-source\n* https://github.com/git/git/security/advisories/GHSA-vm9j-46j9-qvq4\n* https://git-scm.com/docs/git#_security\n* https://github.blog/open-source/git/securing-git-addressing-5-new-vulnerabilities/\n* https://nvd.nist.gov/vuln/detail/CVE-2017-1000117\n","author":{"url":"https://github.com/eighthave","@type":"Person","name":"eighthave"},"datePublished":"2025-03-31T20:16:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/2020/GitPython/issues/2020"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cd66a53a-b56b-99b4-e1b2-78a1eacfa0d2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5C4:E1812:84577:B3F3B:6969610D |
| html-safe-nonce | 772fe7d13c00171a292c4fdf279d38acae724683b3f85a97c7331f003f789fae |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUM0OkUxODEyOjg0NTc3OkIzRjNCOjY5Njk2MTBEIiwidmlzaXRvcl9pZCI6Ijg3MDQ4MDE5MzUwMjY5MDUzNTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ad1343a5b5d3f732e42cb6e9d4b96084fd449239bd259ea1ad80b5f00b0295dc |
| hovercard-subject-tag | issue:2961483417 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/gitpython-developers/GitPython/2020/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e499cadb9557c89834144ef38ef4303e88ae0a014f226bc837b4e768c49bd653/gitpython-developers/GitPython/issues/2020 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e499cadb9557c89834144ef38ef4303e88ae0a014f226bc837b4e768c49bd653/gitpython-developers/GitPython/issues/2020 |
| og:image:alt | For f-droid.org, we build thousands of Android apps from git repos. To reduce our attack surface and work towards "least authority", we use a custom Git wrapper that locks down a lot of things that... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eighthave |
| hostname | github.com |
| expected-hostname | github.com |
| None | 48487c1ad776a7975b7132d95f4240ff3ae37cd5b8e3cb597102a4edb76738f1 |
| turbo-cache-control | no-preview |
| go-import | github.com/gitpython-developers/GitPython git https://github.com/gitpython-developers/GitPython.git |
| octolytics-dimension-user_id | 503709 |
| octolytics-dimension-user_login | gitpython-developers |
| octolytics-dimension-repository_id | 1126087 |
| octolytics-dimension-repository_nwo | gitpython-developers/GitPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1126087 |
| octolytics-dimension-repository_network_root_nwo | gitpython-developers/GitPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 669463fcc54773a88c1f5a44eef6b99a5504b9c7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width