Skip to content

fix: reject pack POSTs with mismatched Content-Type, classify actions by path - #51

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/sfind-362cffde-receive-pack-content-type
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/sfind-362cffde-receive-pack-content-type

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Description

A POST to .../git-receive-pack whose Content-Type was not byte-for-byte application/x-git-receive-pack-request (e.g. ;charset=utf-8, different casing, or the upload-pack type) passed validGitRequest, was classified as default by parseAction, ran only checkRepoInAuthorisedList, 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 the Content-Type of /git-receive-pack and /git-upload-pack requests to exactly match the operation in the path. Anything else is rejected in proxyFilter before the chain runs.
  • parseAction derives the action type from the URL path (/git-receive-pack → push, /git-upload-pack → pull) via the new getActionTypeFromGitPath, 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-pack with Content-Type: application/x-git-receive-pack-request;charset=utf-8:

Proxy log Result
main Action processed: Allowed, Request resolved to https://github.com/finos/git-proxy.git/git-receive-pack forwarded to GitHub without the push chain
this branch Action processed: Error / Invalid request received rejected, never forwarded

With the exact Content-Type, both branches run the push chain (parsePush handles 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

  • Documentation has been added/updated for any new features

Configuration

  • If configuration schema (config.schema.json) was modified:
    • TypeScript types regenerated (npm run generate-config-types)
    • Schema reference docs regenerated (npm run gen-schema-doc)

Tests

  • Tests have been added/updated for new functionality
  • Unit tests pass (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)
  • Linting and formatting pass (npm run lint and npm run format:check)
  • Type checks pass (npm run check-types) (except the existing errors in AttestationInfo.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


Devin Review

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>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Custom reviewers

  • 🧪 Test 2 reviewer: no findings · View
  • 🚩 TD Enterprise Architecture: no findings · View
  • 👁️ TD Information Security: no findings · View
  • 🧠 TD French Language (Bill 96): no findings · View
  • ⏱️ TD API Contracts: no findings · View
  • 🧹 Henry's Style Guide: no findings · View

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant