Skip to content

fix(proxy): #1588 accept smart-HTTP paths without .git suffix#1642

Open
re-vlad wants to merge 1 commit into
finos:mainfrom
re-vlad:fix/1588-smart-http-without-git
Open

fix(proxy): #1588 accept smart-HTTP paths without .git suffix#1642
re-vlad wants to merge 1 commit into
finos:mainfrom
re-vlad:fix/1588-smart-http-without-git

Conversation

@re-vlad

@re-vlad re-vlad commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Git smart-HTTP clients may send repository paths without a .git suffix (e.g. GET /owner/repo/info/refs?service=git-upload-pack). GitHub accepts this form; Git Proxy previously did not.

  • processUrlPath only matched paths containing .git ((.+\.git)(\/.*)?). For .git-less smart-HTTP URLs it returned null, so - proxyFilter rejected the request with Invalid request received before the plugin chain ran.

This PR fixes that in two places (both are required for a full clone/fetch):

  1. processUrlPath - after the existing .git regex, add a smart-HTTP suffix fallback for paths ending in /info/refs, /git-upload-pack, or /git-receive-pack. Normalise repoPath to end with .git internally so parseAction and getRepoByUrl continue to work unchanged.

  2. isPackPost - make .git optional in the POST pack URL regex so POST /owner/repo/git-upload-pack is recognised and extractRawBody runs. Without this, discovery could succeed but clone/fetch would still fail on the second HTTP request.

Complementary to, not a substitute for: v1->v2 DB URL migration (#1535 / #1543), which normalises stored repos.url. This PR fixes inbound wire paths clients send at runtime.

Related Issue

Resolves #1588

Checklist

General

Documentation

  • Documentation has been added/updated for any new features

N/A — behaviour fix aligned with GitHub/git client conventions; no new user-facing configuration.

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)

N/A — config.schema.json not modified.

Tests

  • Tests have been added/updated for new functionality
  • Unit tests pass (npm test)
  • Linting and formatting pass (npm run lint and npm run format:check)
  • Type checks pass (npm run check-types)

Local verification: npm test (1141 passed), npm run lint, Prettier on changed files.

Test plan

  • processUrlPath('/octocat/hello-world/info/refs?service=git-upload-pack')repoPath: /octocat/hello-world.git
  • processUrlPath('/github.com/octocat/hello-world/info/refs?service=git-upload-pack') → proxied host path with .git normalised
  • processUrlPath('/org/owner/repo/git-upload-pack') → pack path parsed
  • Regression: paths with .git unchanged (/octocat/hello-world.git/info/refs?..., /octocat/hello-world.git, /octocat/hello-world.git/)
  • isPackPost true for POST /a/b/git-upload-pack and POST /a/b.git/git-upload-pack
  • proxyFilter allows GET /github.com/finos/git-proxy/info/refs?service=git-upload-pack without mocking processUrlPath
  • Manual: curl -H "User-Agent: git/2.43.0" "http://<proxy>/owner/repo/info/refs?service=git-upload-pack" against authorised repo (both with and without .git in path)

@re-vlad re-vlad requested a review from a team as a code owner July 10, 2026 16:41
@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 3b385d5
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/6a5120d9287ad20008f89d3b

@re-vlad re-vlad requested a review from dcoric July 10, 2026 16:42
@re-vlad re-vlad self-assigned this Jul 10, 2026
@re-vlad re-vlad added bug Something isn't working fix and removed bug Something isn't working labels Jul 10, 2026
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.89%. Comparing base (3186da2) to head (3b385d5).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1642      +/-   ##
==========================================
+ Coverage   85.87%   85.89%   +0.01%     
==========================================
  Files          84       84              
  Lines        8109     8116       +7     
  Branches     1376     1379       +3     
==========================================
+ Hits         6964     6971       +7     
  Misses       1117     1117              
  Partials       28       28              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

processUrlPath rejects smart-HTTP requests when the repo path omits .git

1 participant