Skip to content

Second independent auth provider: Auth.js behind the same principal/identity boundary (#841) - #886

Merged
jimhoyd merged 2 commits into
mainfrom
claude/second-auth-provider
Sep 29, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/second-auth-provider

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Adds #841 acceptance evidence: "a second independently owned provider at the same relevant capability boundary without editing core or importing default-provider types into it."

Provider package: proofs/authjs-provider/

  • It is an independent package, @example/urlcode-authjs (extension name authjs), built on Auth.js @auth/core 0.41.3 (ISC, 6 packages).
  • Auth.js's model differs from Better Auth's: a plain Request/Response handler, double-submit CSRF, encrypted JWT sessions, and no user store.
  • The mount forwards only an exact allowlist of Auth.js actions.
  • authorize() checks the session through Auth.js's own session action and sets the request principal. The package provides identity as {userId}.
  • It has no core edits and no imports from @jimhoyd/urlcode-auth or Better Auth.

Application: proofs/private-requests-authjs/

  • A copy of private-requests with only the provider swapped. The store declaration, page and route set are asserted identical.
  • Operator code passes Auth.js's own config through unchanged, and a scrypt password check owns the users.

Integration test: test/authjs-provider.integration.ts

  • Run with npm run test:proof:authjs, included in verify:workspaces and the CI workspace-integration job. All 12 subtests pass.
  • Install from a tarball: locked by sha512, list --strict passes, remove works.
  • Validate, the revision pin and explain pass.
  • Refused at startup: a missing or short secret, and a sandboxed route naming the provider.
  • Fixtures and audit (ready, 6 routes) pass.
  • Over HTTP:
    • sign-in, with a wrong password or missing CSRF token refused;
    • user id continuity;
    • forged token or context header gets 401/403;
    • owner privacy and reviewer reads;
    • cross-origin refusal;
    • the membership 403;
    • own-request refusal;
    • exactly one winner among racing approvals;
    • sign-out;
    • throttle 429.

Gaps (recorded in the README and docs)

  • No server-side revocation: a copied JWT cookie still works after sign-out until it expires, which the test asserts. Better Auth revokes server-side.
  • No session list, sign-out-everywhere or password change.
  • Accounts are operator code: no sign-up, reset or lockout.
  • No built-in limiter: it uses URLCode's policies.throttle on the mount.
  • No framework-neutral browser client: the client uses fetch.

Core coupling found (filed separately)
Everything tied to the provider is keyed on the extension name auth, not on providesPrincipal:

  • The auth: true short form (config.ts:456,464) and its policy-error locations (extensions.ts:684).
  • An independent package can't be named auth, a catalog name (addon-install.ts:524), so it can't use the short form.
  • OpenAPI emits 401/403 and the session scheme only for auth (openapi.ts:167,174,208,236).
  • The review's session hint (review.ts:185).

Evidence

npm run verify passes: 1150/1150, test:addons, test:proof, test:proof:authjs 12/12. npm run test:package passes.

🤖 Generated with Claude Code

…he principal and identity boundary (#841)

Adds proofs/authjs-provider (@example/urlcode-authjs), an independent extension
package that mounts Auth.js (@auth/core 0.41.3) on one route, sets the request
principal from Auth.js's own session action and provides the identity
capability. It imports only Auth.js and @jimhoyd/urlcode/extensions.

proofs/private-requests-authjs runs the private-requests application with it:
identical store declaration, page and routes apart from protection written as
policies.extensions.authjs. test/authjs-provider.integration.ts (npm run
test:proof:authjs, in verify:workspaces and the workspace-integration job)
installs the provider from a local tarball with `urlcode extensions add`,
checks the conformance cases over HTTP, records the gaps (no server-side
revocation with JWT sessions) and shows that an independent package cannot
take the name auth that the auth: short form requires. No core edits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd merged commit 7910f84 into main Sep 29, 2026
28 checks passed
@jimhoyd
jimhoyd deleted the claude/second-auth-provider branch September 29, 2026 02:11
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