Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
08111c2
chore: leave the generated OpenAPI document out of the formatter
thegdsks Oct 18, 2026
dd6b30e
fix: make MySQL DDL valid and claim single use rows without RETURNING
thegdsks Oct 18, 2026
2d27ad0
fix: refuse banned users on JWT and stateless sessions and fail close…
thegdsks Oct 18, 2026
551240a
feat: make approvals a first class flow with distinct decision codes …
thegdsks Oct 18, 2026
7adfac0
feat: record input provenance in the audit chain and rotate pseudonyms
thegdsks Oct 18, 2026
be213ce
feat: add framework integration helpers as a core subpath export
thegdsks Oct 18, 2026
6fb281d
feat: add explain and revocation pages and revocation admin routes
thegdsks Oct 18, 2026
f197327
feat: generate the OpenAPI contract and bring the Go and Python clien…
thegdsks Oct 18, 2026
7132cde
feat: add theauth doctor security to lint a config for weak settings
thegdsks Oct 18, 2026
023756e
docs: add wave 8 upgrade notes and navigation entries
thegdsks Oct 18, 2026
96ae5ef
chore: add the database and SDK client CI jobs, widen peer ranges to …
thegdsks Oct 18, 2026
f5616dc
feat: export robot permissions to SROS2 and gate hazardous commands
thegdsks Oct 18, 2026
2fab7c3
feat: verify the Go audit head checkpoint in TypeScript to detect tai…
thegdsks Oct 18, 2026
fc2973b
fix: apply the whole MySQL migration chain on a real server and test …
thegdsks Oct 18, 2026
fe7e6c6
feat: add device identity, step up auth, DPoP agent tokens, keyed pro…
thegdsks Oct 18, 2026
31e5ae6
fix: wait for pre-registered MCP clients before answering lookups and…
thegdsks Oct 18, 2026
78a20ae
test: wait for async audit rows and decision events instead of fixed …
thegdsks Oct 18, 2026
d40c1b4
chore: leave the Go generated vector fixtures out of the formatter
thegdsks Oct 18, 2026
f02cd2d
feat: bring the Go and Python clients up to the wave 9 features
thegdsks Oct 18, 2026
84ebfb8
fix: make approval hashes and Go pseudonym checks agree across TypeSc…
thegdsks Oct 18, 2026
a7aa6e2
docs: check docs links in CI, mention devices and robots and regenera…
thegdsks Oct 18, 2026
3953479
feat: add a Devices page, path aware matching, API key scoping, OIDC …
thegdsks Oct 18, 2026
69f07c2
feat: add Python guards for LangGraph, CrewAI and the OpenAI Agents S…
thegdsks Oct 18, 2026
701a372
fix: give every exported ROS 2 node the endpoints it needs to start u…
thegdsks Oct 18, 2026
a8284dc
feat: add fleet doctor findings, default API key scope to org roles, …
thegdsks Oct 18, 2026
81bb584
docs: correct the better-auth and paid platform comparisons against t…
thegdsks Oct 18, 2026
b7fbe38
fix: client bindings call the routes core serves, add session refetch…
thegdsks Oct 18, 2026
7a9dfac
feat: signed revocation snapshots and Android Key Attestation for dev…
thegdsks Oct 18, 2026
3e3855c
feat: quorum approvals, database hooks, Drizzle instance adapter, sto…
thegdsks Oct 18, 2026
a7dfd2f
chore: rebuild the UI registry after the route fixes
thegdsks Oct 18, 2026
f7238b3
docs: add dated, sourced facts to the comparisons and a Keycloak page…
thegdsks Oct 19, 2026
2d1bd9a
feat: add Apple App Attest and TPM 2.0 quote verifiers tested on real…
thegdsks Oct 19, 2026
746da30
feat: single-use repositories for 20 claim sites, resumable GDPR eras…
thegdsks Oct 19, 2026
d6ce6fd
perf: add hot path indexes, reuse crypto keys, cheaper canonicalizati…
thegdsks Oct 19, 2026
8bff5af
fix: make the hourly call budget atomic, refuse empty attestation non…
thegdsks Oct 19, 2026
372a4ec
feat: add a SPIFFE bridge for X.509 and JWT SVIDs with mTLS bound age…
thegdsks Oct 19, 2026
1ec0e34
fix: regenerate the OpenAPI contract, anchor the browser entry import…
thegdsks Oct 19, 2026
d62a425
feat: add spiffe routes and audit, a device fleet conformance kit, a …
thegdsks Oct 19, 2026
b274a01
fix: give the core build a larger heap so the type declarations bundl…
thegdsks Oct 19, 2026
0e16567
fix: accept the libsql provider in the cli database target type
thegdsks Oct 19, 2026
0231034
test: add the four spiffe routes to the route parity table
thegdsks Oct 19, 2026
bd34fa9
fix: hide other owners' workloads on the admin spiffe routes and add …
thegdsks Oct 19, 2026
8a0aade
feat: fire database hooks on user updates and the remaining user crea…
thegdsks Oct 19, 2026
6bdec47
feat: add core email and password, attestation policy and deeper devi…
thegdsks Oct 19, 2026
db6791b
fix: add the email verification and reset members and the sign up res…
thegdsks Oct 19, 2026
c38a22c
fix: let the email claim skip credential tables of features that are …
thegdsks Oct 19, 2026
4dec0be
chore: version packages for 2.0
thegdsks Oct 19, 2026
f0d5bf9
chore: align core coverage provider with vitest 4
thegdsks Oct 19, 2026
8884a77
test: wait for the in flight read instead of a fixed sleep in the rev…
thegdsks Oct 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/agent-framework-integrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth": minor
---

Add the `@glinr/theauth/integrations` subpath with dependency free helpers for agent frameworks. `guardAiSdkTools` wraps a Vercel AI SDK tool map and `guardFunctionTool` wraps an OpenAI Agents SDK style function tool. Each call runs `authorize` first, with an optional approval retry, and a refusal comes back as a structured `ToolDenial` carrying the decision code. `createHttpGuard` calls `POST /authorize/token` for Node orchestrators such as LangGraph.js. All helpers fail closed and use structural types, so no framework is imported at runtime. Docs: `integrations/vercel-ai-sdk`, `integrations/openai-agents-sdk`, `integrations/langgraph-crewai` (includes Python REST recipes for LangGraph and CrewAI).
9 changes: 9 additions & 0 deletions .changeset/api-key-scoping-refresh-family-openapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@glinr/theauth": minor
---

Self service API keys are capped to the caller. `POST /auth/api-keys` (the `apiKeys` plugin and the `apiKeys.handleRequest` module handler) refuses with 403 `permissions_not_grantable` when the key asks for a permission the signed in user does not hold. New `ApiKeyManagerConfig` fields: `grantablePermissions(userId)` returns the user's own permissions (`*` and `ns:*` patterns cover narrower ones) and `adminOverride(userId)` lifts the cap for named users. With neither set, a self service request may only ask for an empty permission list. `theauth.apiKeys.create()` and `trustedServerUse` callers are not capped. Malformed `permissions` values now answer 400.

OIDC provider refresh token reuse now revokes the whole token family (RFC 9700 section 4.14.2). Migration `0012-oidc-refresh-family` adds a nullable `family_id` to `theauth_oidc_refresh_tokens` (OIDC provider enabled). Tokens issued before it fall back to revoking every refresh token of the same user and client on reuse. Run `theauth db up`.

The admin API routes for audit events, delegations, user disable, sessions and revocations are now in the generated OpenAPI document, and the admin approval routes are documented as returning bare JSON, which is what they send. The drift test checks every admin route the plugin registers. The decision code lists in the Python and Go clients are generated from `DECISION_CODES` by `scripts/generate-openapi.ts`, with a drift test.
8 changes: 8 additions & 0 deletions .changeset/approval-quorum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@glinr/theauth": minor
"@glinr/theauth-dashboard": minor
---

Added quorum (two person) approvals. `approval.request({ requiredApprovals: 2 })`, `approval.requiredApprovals` and `approval.quorum(request)` make a request need N distinct approvers (1 to 10, default 1). Approvers must differ from the requester and from each other, one denial ends the request, each approval writes its own audit row, and the argument bound hash, single spend and expiry apply to the whole quorum. `ApprovalQuorumError` carries the code `SELF_APPROVAL`, `DUPLICATE_APPROVER` or `APPROVER_REQUIRED`.

The admin API `POST /approvals` takes `requiredApprovals`, and approve answers `status: "pending"` until the quorum is complete. The `approval.pending` webhook payload adds `requiredApprovals` and `approvalsReceived`, and a new `approval.vote` event reports progress. The dashboard inbox shows "1 of 2 approvals". Adds migration 0013 (`required_approvals` column and `theauth_approval_votes` table).
5 changes: 5 additions & 0 deletions .changeset/approvals-first-class.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth": major
---

Approvals are a first-class flow. A failed `approvalId` spend in `authorize()`, `authorizeByToken()` and `policy.evaluate()` now returns a distinct code: `approval_not_found`, `approval_pending`, `approval_denied`, `approval_expired`, `approval_already_used`, `approval_mismatch` or `approval_arguments_mismatch`. The generic `approval_invalid` code is no longer returned (breaking), and the `APPROVAL_NOT_APPROVED` reason is split into `APPROVAL_PENDING` and `APPROVAL_DENIED`. `approval.approve()` and `approval.deny()` throw for an expired request and mark it `expired`, and `approval.listPending(ownerId)` leaves out expired requests. Added `approval.decide(id, { decision, decidedBy })`, an `approval.expire` audit row, decision events with `source: "approval"` (codes `approval_pending`, `approval_granted`, `approval_denied`, `approval_expired`), and an `approval.pending` webhook event that carries a hash of the arguments, not the arguments. New exports: `decisionCodeOfApproval`, `isApprovalDenial`, `ApprovalDeps`, `DecideInput`. See `docs/upgrading-to-2.mdx`.
10 changes: 10 additions & 0 deletions .changeset/audit-input-provenance-rotation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@glinr/theauth": minor
---

Audit input provenance and rotating pseudonyms.

- `authorize`, `authorizeByToken` and `policy.evaluate` record where a call's inputs came from. Pass `context.inputs` with kinds `user_message`, `tool_output`, `retrieved_document` or `agent`, an optional id and the content (hashed and dropped) or a SHA-256. Only the hash is stored in `input_provenance`, merged with taint labels. `guardTool` takes the same list as an `inputs` option.
- The argument name `inputProvenance` is now reserved in audit parameters, so tool arguments cannot plant a source.
- `audit.query` takes `provenance: { kind?, hash? }`. `hashInputContent` computes the hash to look for.
- New `audit.pseudonymRotation: { periodDays, retainPeriods? }` gives each subject a different pseudonym per period under a random per-period secret. Old period secrets are shredded, so a key holder cannot link a subject across periods. Chain verification and export keep working, and raw ids in a shredded period are no longer checked against their pseudonym.
15 changes: 15 additions & 0 deletions .changeset/client-routes-match-core.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@glinr/theauth-ui": minor
"@glinr/theauth-expo": minor
"@glinr/theauth-electron": minor
"@glinr/theauth-dashboard": minor
---

Point the UI, Expo, Electron and dashboard callers at routes the core handler serves. Before, these calls answered 404 against a TypeScript server.

- `@glinr/theauth-ui`: `TwoFactorVerify` posts `{ code }` to `/auth/2fa/verify` (a backup code goes in the same `code` field) and reads the core's `{ error: "..." }` body. `OAuthButtons` navigates to `/auth/oauth/authorize/:provider`, and the server builds the callback URL itself.
- `@glinr/theauth-expo` and `@glinr/theauth-electron`: sign-in and sign-up now call `/auth/username/sign-in` and `/auth/username/sign-up` with a `username` field, the session check is `GET /auth/session` and sign-out is `POST /auth/sign-out`. New options `signInPath`, `signUpPath` and `identifierField` point them at your own email route (for example `/auth/sign-in` with `identifierField: "email"` from `@glinr/theauth-email`). Responses read the core shape `{ user, session: { token, expiresAt } }`, and the older `{ data }` envelope still works. A 5xx on the session check no longer signs the user out.
- `@glinr/theauth-electron`: `openOAuthWindow` opens `/auth/oauth/authorize/:provider` and waits for the core callback to redirect back before it reports success, instead of closing the window on the provider redirect that carries `code=`.
- `@glinr/theauth-dashboard`: revoking an agent uses `DELETE /agents/:id`, and an agent's permissions come from `GET /agents/:id`. The Users, Permissions, Settings and MCP Servers pages call routes only the CLI dev server serves. Against a server without them the pages now show a "does not serve" message.

Upgrade note: if your Expo or Electron app relied on `/sign-in/email` and `/sign-up/email`, set `signInPath`, `signUpPath` and `identifierField` to the routes your server serves.
5 changes: 5 additions & 0 deletions .changeset/client-session-store-solid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth-client": minor
---

Add `createSessionStore`, a framework-neutral session store (subscribe, sign in, sign up, sign out, injected storage), and `createSolidAuth`, which wraps it as Solid accessors without depending on solid-js.
12 changes: 12 additions & 0 deletions .changeset/dashboard-devices-page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@glinr/theauth-dashboard": minor
---

New Devices page: fleet health counters from `GET /devices/stats`, a device list you can filter by status (last seen, suspend, resume, revoke), a detail view with credential kinds, and an enrollment token form that shows the plaintext token once.

Fixes:

- The audit client now matches the core `GET /audit` route. It sends `actions`, `since`, `until` and `provenanceKind`, reads the bare array the route returns, resolves agent names from the agent list, and keeps `inputs`. The old client expected `{ entries, total, offset }` and sent parameters the route ignores.
- `PaginatedAuditLogs` has `hasMore` instead of `total`, because the route returns no total. The audit table and Security page were updated to match, and `escalated` rows now render.
- Audit export returns the response body as text. CSV exports used to fail because the client parsed them as JSON.
- Error messages from core error bodies (`{ error: { message } }`) are shown instead of the HTTP status text. Error codes are unchanged.
12 changes: 12 additions & 0 deletions .changeset/dashboard-explain-revocations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@glinr/theauth-dashboard": minor
"@glinr/theauth": minor
---

The dashboard gains an Explain page and a Revocations page, and the approvals inbox now says so when the approvals API is not mounted.

Explain takes an agent id, action and resource and calls `POST /explain`, showing the decision code, the matched grant, constraint steps and the closest grants that nearly matched. Revocations shows the live `theauth_mcp_revocations` rows, the revocation bus counters, every live delegation link with the links and tokens a revoke would deny, and a revoke action for delegations, agents, users, clients and tokens. Every revoke is written to the audit log.

Core `adminApi` adds `GET /revocations`, `GET /revocations/delegations` and `POST /revocations`. Security fix: `DELETE /delegations/:id` on the admin API now pushes the revoked links to the instance revocation bus. Before, only the chain rows changed, so MCP tokens tied to a revoked delegation stayed valid on other instances until they expired.

Upgrade notes: mount the admin API at `/api` for the dashboard to reach the new routes. A core without them answers 404 and the page shows a short notice instead of failing.
5 changes: 5 additions & 0 deletions .changeset/database-hooks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth": minor
---

Add `databaseHooks`: per-model `before` and `after` hooks for create and update on `user`, `session` and `account`. A `before` hook can return `false` to abort or `{ data }` to replace allowed fields, and it fails closed on a throw, a timeout or a malformed result (`DatabaseHookError`). `after` hooks run once the row is committed and never break the write. Hooks stay outside every single-use claim statement, so magic links, OTP codes, OAuth state and refresh rotation remain atomic. Exports `DatabaseHooks`, `DatabaseHookError` and `createDatabaseHookRunner`. See `docs/database-hooks.mdx`.
12 changes: 12 additions & 0 deletions .changeset/db-drizzle-instance-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@glinr/theauth": minor
"@glinr/theauth-test-utils": minor
---

Add `database: { drizzle, dialect }` to pass an existing Drizzle instance (`"sqlite"`, `"postgres"` or `"mysql"`) instead of a URL. It goes through the same `DatabaseOpener` seam, migrations use the dialect, and `skipMigrations` works as before. See `docs/bring-your-own-drizzle.mdx`.

Add `StoreConflictError`, exported from `@glinr/theauth`. The nine places that rely on a unique index (user create, audit chain append, quorum vote, ban insert, erasure tombstones, MCP client, revocation and block inserts) now read structured driver codes first and keep the text match as a fallback, so behavior on the current providers is unchanged.

Fix SCIM group `PUT`: it deleted every member and re-inserted the list, so a member who stayed left the group for a moment, got a new row id, and lost any role other than `member`. It now removes only members missing from the list and adds only the new ones.

`@glinr/theauth-test-utils` gains a `./store-contract` subpath with `runStoreContract`: claim races with 24 parallel callers, unique conflicts and audit chain order, for any backend. `vitest` is an optional peer dependency.
5 changes: 5 additions & 0 deletions .changeset/fail-closed-session-handlers-grants.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth": major
---

Close three 2.0 blocker gaps. The JWT session module and the stateless session manager now refuse banned users with `USER_BANNED` (stateless takes a `db` or an `isBanned` callback, and with either one a ban also ends sessions already issued). `org.handleRequest` and `apiKeys.handleRequest` fail closed: they answer 401 without an authenticate resolver, bind ids to the signed-in user, and check org membership and role. Trusted server code can opt out with `trustedServerUse: true`. The MCP authorization code grant refuses a client an admin bound to another user's agent, with `ACCESS_DENIED` at authorize and `INVALID_GRANT` at token, both carrying `details.decisionCode` `owner_mismatch`. See the upgrade notes in `docs/upgrading-to-2.mdx`.
8 changes: 8 additions & 0 deletions .changeset/go-head-checkpoint-verify.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@glinr/theauth": minor
"@glinr/theauth-cli": minor
---

Add `verifyGoHeadCheckpoint` and `verifyGoHeadSignature` to verify the signed head checkpoint written by theauth-go (`checkpoint.CreateHeadCheckpoint`). Compared with rows exported from the Go log, it reports `chain_truncated` when a chain was cut off its tail (or is missing) and `head_mismatch` when the row at the signed position has another hash, after checking the Ed25519 signature, the domain separation and the sorted head list. Test vectors signed and judged by the real Go code ship in the test fixtures.

`theauth audit verify-go` gains `--head <file> --head-key <file>` to run the head check next to the chain check.
16 changes: 16 additions & 0 deletions .changeset/input-provenance-keyed-wiring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@glinr/theauth": minor
"@glinr/theauth-gateway": minor
"@glinr/theauth-mcp": minor
"@glinr/theauth-cli": minor
"@glinr/theauth-dashboard": minor
---

Input provenance end to end.

- Content hashes in `input_provenance` are now HMAC-SHA-256 under an HKDF subkey of the audit key (version tag `hv: 2`). Old plain hashes still match. `hashInputContent(content, auditKey)` takes the key now, `hashInputContentPlain` is the old function (breaking for callers that hashed themselves, see `docs/upgrading-to-2.mdx`).
- `audit.query({ provenance: { content } })` hashes on the server and matches keyed and plain rows. `AuditEntry.inputs` exposes the recorded sources.
- `POST /authorize` and `POST /authorize/token` accept `inputs` or a `TheAuth-Inputs` header. `GET /audit` takes `provenanceKind`, `provenanceHash` and `provenanceContent`. `sdks/openapi.json` is regenerated.
- Gateway reads `TheAuth-Inputs`, records it on permission checks and audit entries, and strips it before the upstream. The admin MCP server reads `_meta["io.theauth/inputs"]` and `query_audit` takes provenance filters.
- `theauth audit query` with `--provenance <kind>[:<hash>]` and `--input-content`, and an Inputs column with chips on the dashboard audit page.
- `policy.taint.inputLabels` (off by default) turns the kinds of `context.inputs` into `input:<kind>` call labels, so a taint rule can hold a tool such as `tool:exec` for approval after a retrieved document was in context.
14 changes: 14 additions & 0 deletions .changeset/iot-device-identity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"@glinr/theauth": minor
"@glinr/theauth-cli": minor
---

IoT devices as principals (`theauth.device`, opt in with `devices` in the config). A device is backed by an agent row of type `device`, so permissions, constraints, delegation, the revocation bus and the audit chain apply unchanged.

- Credentials: pre shared keys (`tdk_`, stored as SHA-256), public keys that sign `device-assertion+jwt` assertions (RFC 7523 layout, DPoP style `jti` replay cache), and TLS client certificate thumbprints (`x5t#S256`, RFC 8705) supplied by the host.
- Enrollment with single use claim codes or bulk tokens with a use limit, claimed atomically, plus an attestation hook with single use nonces (RFC 9334 freshness).
- `device.authorize` with device states (`device_suspended`, `device_revoked`, `device_expired`, `device_not_found`) and `theauthPrincipal` on every audit row.
- Signed offline policy bundles (`device-policy+jwt`, ES256 or EdDSA, one hour default, 24 hour cap, rollback protected), with `verifyDeviceBundle` and `evaluateDeviceBundle` for the device side.
- HTTP routes under `/devices` (owner scoped) and `/device` (device facing), OpenAPI metadata, migration `0010-devices`, and `theauth device` in the CLI.

Also fixed: agent registration tokens stored any `agent_type` string the caller sent; only `autonomous`, `delegated` and `service` are accepted now. The OpenAPI generator supports discriminated unions.
5 changes: 5 additions & 0 deletions .changeset/mcp-pre-registered-clients-ready.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@glinr/theauth": patch
---

A request that arrives while the MCP module is still writing its `preRegisteredClients` now waits for them instead of answering `invalid_client` for a client that is configured. A failed pre-registration write is thrown to the first client lookup, not lost.
6 changes: 6 additions & 0 deletions .changeset/migrate-supabase-workos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@glinr/theauth": minor
"@glinr/theauth-cli": minor
---

Add `supabase` and `workos` sources to the user importer and `theauth migrate`. Supabase reads `auth.users` rows (JSON or CSV, with optional `auth.identities`) and keeps bcrypt `encrypted_password` hashes for lazy migration. WorkOS reads List users API output and accepts an optional support-provided hash file, because the API returns no hashes. New guides: `migrate/from-supabase` and `migrate/from-workos`.
9 changes: 9 additions & 0 deletions .changeset/mysql-dialect-ddl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@glinr/theauth": minor
---

MySQL dialect fixes. The MySQL DDL is now generated from the portable baseline: key, unique, defaulted and referenced `TEXT` columns become `VARCHAR(191)`, inline `REFERENCES` become table level `FOREIGN KEY` clauses (MySQL ignored the inline form), `CREATE INDEX IF NOT EXISTS` loses the unsupported clause, and every table uses InnoDB, utf8mb4 and a binary collation so tokens and ids match exactly. The migration ledger stores `UTC_TIMESTAMP(3)` and the MySQL pool connects with `timezone: "Z"`.

Single use claims (magic link, OTP, one time token, OAuth state, refresh token, session refresh, approvals) no longer call `RETURNING`, which the MySQL query builder lacks. They go through the new `claimCount` helper in `src/db/claim.ts`, which uses `RETURNING` where it exists and the affected row count otherwise. SQLite and Postgres behavior is unchanged.

`provider: "mysql"` still requires `experimental: true`: the gate stays until the contract suite (`THEAUTH_TEST_MYSQL_URL`) has passed against a real MySQL 8.4 server. The suite has not been run against one yet. MySQL migration checksums changed, which affects nobody because no MySQL database could be created before.
12 changes: 12 additions & 0 deletions .changeset/openapi-generated-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@glinr/theauth": major
---

`generateOpenAPISpec` now builds the document from the handler's route table and the core result shapes, and the result is checked in as `sdks/openapi.json` with a test that fails on drift.

Upgrade notes:

- `servers[0].url` is `baseUrl` plus the new `basePath` option (default `/api/theauth`). Pass the origin as `baseUrl`.
- Paths now match the served routes. `AuthorizeResult` has a required `code`, and explain, delegation chain fields, approvals and `/mcp/introspect` are described.
- `POST /authorize` and `POST /authorize/token` accept `approvalId`, which was dropped before.
- New options: `handler` (leave out routes the handler does not serve) and `adminApi`.
8 changes: 8 additions & 0 deletions .changeset/path-aware-resource-matching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@glinr/theauth": minor
"@glinr/theauth-cli": minor
---

Opt in path aware resource matching: `resourceMatching: "path"` on `createTheAuth` (and `policy.resourceMatching` for the policy engine). Inside a colon segment `/` separates path segments, `*` matches one, `**` matches one or more, never an empty, `.` or `..` segment. The default is unchanged. Device bundles carry the mode (`rm` claim), `theauth ros2 export` takes `--resource-matching path` and `--single-level skip|widen`, `--robot` includes delegated permissions, and `--enclave-cert` sets the grant window from the certificate.

Security fix: the delegation subset check accepted a child resource longer than an exact parent resource (parent `tool:db`, child `tool:db:secrets`), which gave the child access the parent did not have. It now uses the runtime matcher. Also, with the default matching, `devices.register` and `devices.update` refuse a `*` that is not the last segment of a device resource.
8 changes: 8 additions & 0 deletions .changeset/peer-range-2x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@glinr/theauth-gateway": patch
"@glinr/theauth-prisma": patch
"@glinr/theauth-email": patch
"@glinr/theauth-plugin-discovery": patch
---

Widen the `@glinr/theauth` peer range from `<2.0.0` to `<3.0.0` so these packages install next to core 2.x without a peer warning.
Loading
Loading