-
Notifications
You must be signed in to change notification settings - Fork 146
Description
Is your feature request related to a problem? Please describe.
Currently, git-proxy via its express http proxy middleware is acting as a transparent proxy to https://github.com. There is business logic in place that restricts certain actions a git client make take (push a commit to a repo, pull a repo, etc). However, when a user visits a Git Proxy deployed server via the browser, there is no restrictions in place due to some fallback logic. As such, Git Proxy's middleware will permit the request to the upstream web server (GitHub) via the browser.
Given that this is meant to enforce git protections via pushes & pulls, Git Proxy should not permit web access through a browser by default. In most scenarios, git-proxy is deployed behind a corporate firewall and this presents path out of an organization that is not captured, filtered or inspected by the current proxying. This can be used to bypass a network perimeter, exfiltrate data with other GitHub services like gists, etc.
Describe the solution you'd like
- When a user is pushing or pulling code through Git Proxy using any compatible git client, the proxy operates as it certain does and uses the list of Actions to apply filtering and protections on git interactions.
- When a user visits a Git Proxy server in the browser to attempt to browse GitHub via https://git-proxy.example.com, they should receive an error.
Git Proxy can filter out the following properties of the inbound HTTP request:
- The server should perform content negotiation1 and reject requests that do not contain an
Acceptheader matching the content types ofapplication/x-git-*(multiple values are used23). Clients making requests from the browser with an Accept header oftext/htmlshould be rejected. - The server should only permit requests matching known "safe URL paths" used by git clients such as
/info/refs?service=git-receive-pack&/git-receive/packfor pushes and/info/refs?service=git-upload-pack&/git-upload-packfor pulls. - The error response should be a 400 Bad Request and return some minimal information such as "invalid request". The response should be minimal so as to not introduce potential security issues. At most, the server can respond with a 415 Unsupported Media Type.
Describe alternatives you've considered
You could deploy a reverse proxy in front of Git Proxy to handle this filter (via nginx). However, given that git-proxy is "git aware" and applies application-level filtering on git operations, it should apply this as a default.
Other networking solutions likely are available to apply filtering at the infrastructure layer but those appliances generally cannot implement git application logic to restrict access. Git Proxy is typically deployed as a trusted system and is permitted through firewalls, etc.
Additional context
N/A