Repository navigation
fix: reject pack POSTs with mismatched Content-Type, classify actions by path - #51
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
bug: a POST to git-receive-pack with a non-exact Content-Type was classified as a default action and forwarded upstream without running the push chain. Co-Authored-By: Samir Chaudhry <samir@cognition.ai>
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Author
There was a problem hiding this comment.
✅ Devin Review: No Issues Found
Devin Review analyzed this PR and found no bugs or issues to report.
Custom reviewers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A POST to
.../git-receive-packwhoseContent-Typewas not byte-for-byteapplication/x-git-receive-pack-request(e.g.;charset=utf-8, different casing, or the upload-pack type) passedvalidGitRequest, was classified asdefaultbyparseAction, ran onlycheckRepoInAuthorisedList, and was forwarded upstream. That skipped every push check (parsePush, commit/author checks, hidden-commit check, pre-receive, gitleaks, scanDiff, approval).Changes:
validGitRequest(src/proxy/routes/helper.ts) now requires theContent-Typeof/git-receive-packand/git-upload-packrequests to exactly match the operation in the path. Anything else is rejected inproxyFilterbefore the chain runs.parseActionderives the action type from the URL path (/git-receive-pack→ push,/git-upload-pack→ pull) via the newgetActionTypeFromGitPath, so classification can no longer disagree with the operation the upstream performs.Runtime check against a local proxy (
tsx index.ts),POST /github.com/finos/git-proxy.git/git-receive-packwithContent-Type: application/x-git-receive-pack-request;charset=utf-8:Action processed: Allowed,Request resolved to https://github.com/finos/git-proxy.git/git-receive-packAction processed: Error/Invalid request receivedWith the exact
Content-Type, both branches run the push chain (parsePushhandles the request).Related Issue
Code scan finding sfind-362cffde7d414d00beb48e6902a33fd3 (push to git-receive-pack with a non-standard Content-Type skips every push check).
Checklist
General
Documentation
Configuration
config.schema.json) was modified:npm run generate-config-types)npm run gen-schema-doc)Tests
npx vitest --run test/testRouteFilter.test.ts test/testProxyRoute.test.ts test/testParseAction.test.ts test/chain.test.ts test/extractRawBody.test.ts test/testProxy.test.ts test/proxy.test.ts: 94 passed)npm run lintandnpm run format:check)npm run check-types) (except the existing errors inAttestationInfo.tsx)Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/b836fb682edb495fb7a7e663c606bfef
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/b836fb682edb495fb7a7e663c606bfef?variant=devin
Requested by: @schaudhry123