Skip to content

Feat/provider token auth - #56

Open
cedric-appdirect wants to merge 7 commits into
rolandjitsu:mainfrom
cedric-appdirect:feat/provider-token-auth
Open

cedric-appdirect wants to merge 7 commits into
rolandjitsu:mainfrom
cedric-appdirect:feat/provider-token-auth

Conversation

@cedric-appdirect

Copy link
Copy Markdown

What kind of change does this PR introduce?

  • fix
  • feat
  • refactor
  • perf
  • docs
  • test
  • build / ci
  • chore

Summary
This add support for checking access against github/gitlab/... for each git request. This is implementing the feature request from #40 .

Tests

  • Added / updated tests (unit, plus integration where it fits)
  • Not relevant, because: ...

Checklist

  • CI is green locally: cargo fmt --all --check, cargo clippy --all-targets --all-features --locked -- -D warnings, cargo test --all-features
  • Commits follow Conventional Commits; AI-assisted commits carry an Assisted-by: trailer (see CONTRIBUTING.md / AGENTS.md)
  • Preserves the read-only, pull-only invariant (no push or proactive replication to upstream)
  • Docs / README updated if behavior or flags changed

Breaking change?
This should not be introducing any breaking change and it is an opt-in feature.

Model client auth as an `Auth` value outside server.rs, so additional
client-auth modes can live beside the shared-secret one.

Assisted-by: Cursor:glm-5.3
Auth then checks exactly the repo that is served. Pushes and dumb-http
info/refs are now refused before auth, so they get 403 or 400, not 401.

Assisted-by: Cursor:glm-5.3
A shared serve token exposes every repo the upstream credential can read.
The github and gitlab providers check each request's own credential for its
repo through upstream's info/refs, which only answers a credential that can
clone. LFS object GETs are refused in these modes for now.

Assisted-by: Cursor:glm-5.3
Provider modes check the batch request against upstream, then hand out an
HMAC grant bound to repo, oid, and size, so object GETs stay local and
cannot reach another repo's objects in the shared cache.

Assisted-by: Cursor:glm-5.3
For upstreams whose git endpoint cannot answer the check, `custom` asks any
HTTP endpoint, with the token header and repo encoding it wants.

Assisted-by: Cursor:glm-5.3
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.63415% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.76%. Comparing base (b5e3375) to head (fe85681).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/auth.rs 98.50% 11 Missing ⚠️
src/server.rs 98.24% 2 Missing ⚠️
src/lfs.rs 97.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   96.97%   97.76%   +0.78%     
==========================================
  Files           6        9       +3     
  Lines        2218     3129     +911     
==========================================
+ Hits         2151     3059     +908     
- Misses         67       70       +3     

☔ 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.

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