-
Notifications
You must be signed in to change notification settings - Fork 0
fix(#7): allow POST git-upload-pack in default GitHub provider #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,9 +30,27 @@ endpoints: | |
| access: read-only | ||
| enforcement: enforce | ||
| # github.com is the git transport (clone / fetch by default). | ||
| # Explicit rules instead of `access: read-only` so that POST to | ||
| # git-upload-pack (clone/fetch) is allowed while git-receive-pack | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] design-smell The github.com endpoint uses explicit L7 rules while api.github.com endpoints use the read-only access preset, creating inconsistent policy expression patterns within a single provider profile. The inconsistency is inherent and documented by the inline comment. |
||
| # (push) stays blocked. | ||
| - host: github.com | ||
| port: 443 | ||
| protocol: rest | ||
| access: read-only | ||
| enforcement: enforce | ||
| rules: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] yaml_structure The rules array is the first use of explicit L7 rules in any provider YAML file in the providers/ directory. This introduces a new pattern without similar examples for consistency. |
||
| - allow: | ||
| method: GET | ||
| path: "**" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [info] permission-expansion The github.com:443 endpoint is upgraded from access: read-only to explicit rules that additionally allow POST on **/git-upload-pack and **/info/refs. The expansion is justified by issue #7 and follows least-privilege for the stated use case. |
||
| - allow: | ||
| method: HEAD | ||
| path: "**" | ||
| - allow: | ||
| method: OPTIONS | ||
| path: "**" | ||
| - allow: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [low] edge-case The rule { method: POST, path: **/info/refs } allows POST requests to /info/refs. In Git smart HTTP protocol, /info/refs is only accessed via GET. POST is used only for /git-upload-pack and /git-receive-pack. Since the GET ** rule already covers GET /info/refs, this POST rule is unnecessary. Suggested fix: Change the method from POST to GET, or remove this rule entirely since GET ** already covers it. |
||
| method: POST | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [info] authorization POST to **/info/refs is not part of the standard Git smart HTTP protocol (which uses GET for ref discovery). The practical security impact is negligible given the default-deny policy. |
||
| path: "**/git-upload-pack" | ||
| - allow: | ||
| method: POST | ||
| path: "**/info/refs" | ||
| binaries: [/usr/bin/gh, /usr/local/bin/gh, /usr/bin/git, /usr/local/bin/git] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[low] test-inadequate
The new test assertions check .access.is_empty() and !.rules.is_empty(), but do not validate the actual content of the rules array (specific methods, paths).
Suggested fix: Add assertions that validate at least one critical rule (e.g., the POST git-upload-pack rule) to ensure the rules contain expected values.