Skip to content

feat(oauth): the vault's /git as a second OAuth audience (CONTINUE-PUSH-NON-SLIP-SELECTION, server) - #10026

Open
olety wants to merge 3 commits into
mainfrom
opus-planmode/continue-push-git-audience
Open

olety wants to merge 3 commits into
mainfrom
opus-planmode/continue-push-git-audience

Conversation

@olety

@olety olety commented Nov 20, 2026

Copy link
Copy Markdown
Member

[CONTINUE-PUSH-NON-SLIP-SELECTION] PR 1 of 2: the vault's /git as a second OAuth audience (server)

Lead ruling CONTINUE-PUSH-NON-SLIP-SELECTION = B (Sat 21 Nov 04:3x): "a second door audience. oneiron hosted login asks for both MCP and git; only a token that asked for git may push, through the same git_push permission check as today; tokens for ChatGPT or Claude connectors still reach nothing else."

This PR is the server part. No client names /git yet, so nothing changes for any existing client. PR 2 (the CLI: hosted login names both resources, and continue --cloud pushes on an OAuth selection) follows, after the open ASK CONTINUE-PUSH-GIT-TIER on the tier hosted login asks for.

What changes

  • Several resources per sign-in (RFC 8707 §2). /oauth/authorize takes resource several times. Each value must be one of the vault's own (ProtectedResource: {origin}/mcp, {origin}/git), and none may repeat; any other answers invalid_target, as before. The query is read as pairs, so every other parameter still comes at most once (a repeat still reads as no request).
  • Rows keep each resource. PendingAuthorization, IssuedCode and TokenFamily keep resource (the first named) and gain further_resources (the rest; #[serde(default, skip_serializing_if = "Vec::is_empty")]). A token request's resource must be one the sign-in named. resolve_oauth_access_token resolves a token only on a resource its sign-in named (TokenFamily::names_resource, exact match).
  • The swap at the git door. The binding door's FIX 4902 swap (mcp_gateway::oauth_call) also runs at /git/{repo}/ + info/refs | git-upload-pack | git-receive-pack | info/lfs/.... A lease's door is excluded, since a lease is its own credential. A bearer OAuth access token that resolves on /git goes on as the slip the server holds for it, with a fresh holder proof on each request. So stock git can push with the token as one static header: the several requests of one push each get their own proof. The git gate (core:write, an unrestricted record scope, a registered principal) and git_push admission are unchanged. The owner grants the sign-in's agent git_push with vault.repo.git_push.mint, as for any holder (the agent is a live PERSON). A token that does not resolve answers 401 with WWW-Authenticate: Bearer error="invalid_token", resource_metadata="{origin}/.well-known/oauth-protected-resource/git", in the door's own body shape (text for smart-HTTP, the envelope for LFS).
  • Metadata. GET /.well-known/oauth-protected-resource/git serves /git's RFC 9728 document, which names the same authorization server. /mcp's document and the bare path are unchanged. The managed route table lists the new path as public.
  • The owner's ask detail names the resources the sign-in asks (resources).

Who may do what (substrate behind grants)

No new verb. The push is the same git_push admission every slip push passes. A token of a sign-in that named /mcp alone (every ChatGPT or Claude connector) resolves at no git door, and one that named /git alone resolves at no MCP endpoint.

Stored change: keep

Every held row decodes and reads as before: the three side tables are Named (msgpack maps), and the new field defaults to empty. A row naming one resource encodes byte for byte as before. No STORAGE_ABI_VERSION change.

Tests (crates/oneiron-server/tests/oauth_git_audience_served.rs, red on main at cc50edb, green on the head)

  1. a_sign_in_naming_git_pushes_through_the_git_door: sign in with /mcp + /git at full, the owner mints git_push, stock git push with one static bearer header lands; the refreshed token pushes again.
  2. a_sign_in_naming_mcp_alone_reaches_no_git_door: receive-pack and upload-pack advertisements and the LFS batch answer 401 invalid_token naming /git's metadata; stock git push lands nothing.
  3. a_token_reaches_mcp_only_when_its_sign_in_named_it: the /mcp + /git token handshakes at /mcp; a /git-only token gets 401 invalid_token at /mcp and /mcp/tool-first.
  4. a_read_tier_git_sign_in_is_refused_at_the_push_gate: 403 insufficient scope with a Grant, the same gate as every slip.
  5. the_git_resource_serves_its_metadata.
  6. a_sign_in_naming_a_resource_twice_or_another_is_refused: invalid_target.

Run: RUSTFLAGS="--cfg oneiron_test_support" cargo test --locked -p oneiron-server --all-features --features oneiron/test-support --test oauth_git_audience_served (stock git with http-backend on PATH). The proofs are booked after the merge.

… door

CONTINUE-PUSH-NON-SLIP-SELECTION (lead ruling B, Sat 21 Nov 04:3x): a
second OAuth audience. A sign-in naming /mcp and /git pushes with stock
git through the git door, its access token one static header, once the
owner granted its agent git_push on the repo; its refreshed token pushes
again. A sign-in naming /mcp alone (every ChatGPT or Claude connector)
reaches no smart-HTTP or LFS request; one naming /git alone reaches no
MCP endpoint; a read-tier one is refused at the push gate for want of
core:write. /git serves its own RFC 9728 document. An authorize request
naming a resource twice, or another, is sent back with invalid_target.

Red on main: the authorize door takes one resource, so every sign-in
naming /git is refused and /.well-known/oauth-protected-resource/git is
404.
CONTINUE-PUSH-NON-SLIP-SELECTION (lead ruling B, Sat 21 Nov 04:3x: "only a
token that asked for git may push, through the same git_push permission
check as today; tokens for ChatGPT or Claude connectors still reach
nothing else"), the server part.

- One sign-in may name several RFC 8707 resources, each one of the
  vault's own (`ProtectedResource`: {origin}/mcp, {origin}/git) and none
  twice; any other answers invalid_target. The authorize door reads its
  query as pairs, so `resource` may repeat while every other parameter
  still comes once.
- The request, its code and its token family keep every resource named:
  `resource` stays the first, `further_resources` holds the rest
  (#[serde(default)], skipped when empty). Stored change: keep: every
  held row decodes and reads as before, and a row naming one resource
  encodes as before. A token request's resource must be one the sign-in
  named; a token resolves only on a resource its sign-in named.
- The binding door's swap (FIX 4902 slice C) also runs at the git door,
  /git/{repo}/ then info/refs, git-upload-pack, git-receive-pack or
  info/lfs/... (a lease's door is none): a bearer OAuth access token that
  resolves on /git goes on as the slip the server holds for it with a
  fresh holder proof per request, so stock git pushes with the token as
  one static header. The gate (core:write, unrestricted record scope,
  registered principal) and the git_push admission are unchanged; the
  owner grants the sign-in's agent git_push as any holder. A token that
  does not resolve answers 401 invalid_token naming the /git metadata, in
  the door's own refusal shape.
- GET /.well-known/oauth-protected-resource/git serves /git's document;
  the managed route table lists it as public.
- The owner's ask names the resources the sign-in asks.
@greptile-apps

greptile-apps Bot commented Nov 20, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 14 billable files and costs up to $3.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 37 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 436c6e5 and 3891ad2.

Files selected for processing: 14

  • crates/oneiron-server/Cargo.toml
  • crates/oneiron-server/src/api/mcp_gateway/oauth_call.rs
  • crates/oneiron-server/src/api/mod.rs
  • crates/oneiron-server/src/api/oauth_server/authorize.rs
  • crates/oneiron-server/src/api/oauth_server/metadata.rs
  • crates/oneiron-server/src/api/oauth_server/mod.rs
  • crates/oneiron-server/src/auth.rs
  • crates/oneiron-server/src/auth/binding_admission.rs
  • crates/oneiron-server/src/managed/state_serve/route_selection_tests.rs
  • crates/oneiron-server/tests/oauth_git_audience_served.rs
  • crates/oneiron/src/authority/oauth_server/authorization.rs
  • crates/oneiron/src/authority/oauth_server/mod.rs
  • crates/oneiron/src/authority/oauth_server/rows.rs
  • crates/oneiron/src/authority/oauth_server/tokens.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…n text

Review #10026 round 1 P1: a token that does not resolve at
`/git/{repo}/info/refs`, `git-upload-pack` or `git-receive-pack` answered the
binding door's JSON error, while the git gate answers a request it does not
authenticate in plain text, which a git client shows. Smart HTTP now answers
401 (or 500 when the token could not be judged) as plain text, with the
same `WWW-Authenticate` challenge; the LFS door keeps its JSON envelope.
The served test asserts both.

The test's registered redirect URI, which nothing listens on, carries the
fixed-port lint's allow with its reason (ratchet test_lint_fixed_port back
to 123).

This branch has not been deployed

No deployments
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