Skip to content

feat(auth): authenticate callers by their bearer token - #141

Open
PiquelChips wants to merge 1 commit into
feat/permissions-admin-abandonfrom
feat/permissions-auth
Open

PiquelChips wants to merge 1 commit into
feat/permissions-admin-abandonfrom
feat/permissions-auth

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

Every request to a server is anonymous, so nothing can tell its callers apart, let alone decide what each may do.

Requests now carry Authorization: Bearer <token>, which Credentials turns into a Caller: anonymous without a header, a principal with one.

Tokens a server accepts:

  • Static tokens from the [tokens] of its configuration, compared by hash so response times don't reveal how much of one matched. They go through the Authenticator trait, so other identity providers can take their place.
  • Short-lived scoped tokens it signed with its node key, verified without storage.

A malformed, unknown or expired token gets a 401 with the new unauthorized error code.

Clients: the SDK's Client::with_token sends one on every request, and never shows it in debug output. The command line sends the remote the token config.toml names for its URL under [tokens], or $ORIGIN_TOKEN. A remote on a local path is always called as its owner.

Nothing is enforced yet: callers are told apart, and each may still do everything.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 68d10902-f4c6-4f89-babf-a322317350f0
Commits

Reviewing files that changed from the base of the PR and between fa28789 and 659dd5f.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 19

  • README.md
  • apps/origin-src/Cargo.toml
  • apps/origin-src/benches/server.rs
  • apps/origin-src/benches/sync.rs
  • apps/origin-src/src/auth.rs
  • apps/origin-src/src/config.rs
  • apps/origin-src/src/http.rs
  • apps/origin-src/src/lib.rs
  • apps/origin-src/src/permissions.rs
  • apps/origin-src/src/remote.rs
  • apps/origin-src/src/server.rs
  • apps/origin-src/src/service.rs
  • apps/origin-src/src/workspace/remote.rs
  • apps/origin-src/tests/common/mod.rs
  • apps/origin-src/tests/http.rs
  • crates/origin-client/src/lib.rs
  • crates/origin-shared/src/api.rs
  • docs/openapi.json
  • tools/xtask/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/permissions-auth branch from 3a54935 to dab8e3b Compare November 22, 2026 15:04
@PiquelChips
PiquelChips force-pushed the feat/permissions-auth branch 2 times, most recently from 14f9083 to 450aec6 Compare November 22, 2026 18:54
Every request to a server was anonymous, so nothing could tell its
callers apart, let alone decide what each may do.

Requests now carry `Authorization: Bearer <token>`, which
`Credentials` turns into a `Caller`: anonymous without a header, a
principal with one. A token is either static, from the `[tokens]` of
the server's configuration, compared by hash so response times don't
reveal how much of it matched, or one the server signed with its node
key, scoped and short-lived, verified without storing it. Static tokens
go through the `Authenticator` trait, so other identity providers can
take their place. A malformed, unknown or expired token is refused with
401 and the new `unauthorized` error code.

The SDK's `Client::with_token` sends one on every request, and never
shows it in debug output. The command line sends the remote the token
`config.toml` names for its URL under `[tokens]`, or `$ORIGIN_TOKEN`; a
remote on a local path is always called as its owner.

Nothing is enforced yet: callers are told apart, and every one may
still do everything.
@PiquelChips
PiquelChips force-pushed the feat/permissions-auth branch from 450aec6 to 659dd5f Compare November 22, 2026 19:20
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