v0.3.0.

Agents ask. People approve.

Released 6 December 2026. All releases

Highlights

  • Approvals

    When your agent tries something risky, it gets a link instead of a yes. You tap your passkey on that exact action, and the agent continues, once, with a signed receipt. Read the docs: Approvals

  • Drop-in screens

    Ten Web Components for sign-in, sign-up, approvals, sessions, two-step setup, and recovery. They need no framework and no build step, and authroutes.Mount serves them. Read the docs: Drop-in screens

  • Email and password

    Sign-in held to OWASP ASVS 5.0 Level 2. No account exists until the address is confirmed, and hashes are Argon2id. Read the docs: Email and password

  • MCP authorization

    mcpauth protects an MCP server built on the official Go SDK: each token works for one server, and each tool checks its own scopes. It also works when your app already has its own sign-in. Read the docs: MCP authorization

  • Device-bound sessions

    In browsers that support DBSC, a stolen cookie stops working within minutes and can't be renewed on another device. It is opt-in. Read the docs: Device-bound sessions

  • Import from Auth0, Clerk, or Supabase

    One command brings your users across in one transaction. Their bcrypt passwords keep working and move to Argon2id at the next sign-in. Read the docs: Import from Auth0, Clerk, or Supabase

Breaking changes

  • The module path is tensile.tools/auth, not github.com/tensile-tools/tensile-auth, and the tools module is tensile.tools/auth/tools. Replace the old path in your imports and in go.mod, then run go get tensile.tools/auth@v0.3.0. Versions up to 0.2.2 used the old path.
  • authroutes.Mount serves email and password sign-in by default, and panics unless exactly one of Config.Passwords and Config.PasskeyOnly is set. To keep serving passkeys only, add PasskeyOnly: true to authroutes.Config. To serve passwords, create a password.Passwords and set Config.Passwords.
  • Service.DeviceBound returns (bool, error) instead of bool, so a store failure is no longer read as "not bound".
  • authroutes.Config.DisableDeviceBound is removed. DBSC is opt-in: set Config.DeviceBound to turn it on.
  • leakscan.Handler is no longer comparable with ==, because leakscan.WithRevoker added a function field.
  • cachestore dropped auth.FactorStore, auth.DeviceStore, and auth.TransferStore, and claimed auth.EmailStore, auth.IdentityStore, auth.SignupStore, and auth.SignupSettingsStore even when the wrapped store lacked them. The server wraps Postgres in the cache by default, so a production server couldn't create or redeem approvals through /v1/check or authhttp.Approvable ("approvals need a FactorStore"), elevate a session, start or complete a pending sign-in, bind a device with DBSC, or undo a recovery. Behind the cache, Service.Setup reported no factors, step-up challenges offered no methods, the password cap never applied, and Prune left expired ceremonies and device codes. The store that cachestore.New returns implements each optional interface exactly when the wrapped store does, and storetest.RunWrapper checks a wrapper for this. This is an incompatible change: cachestore.Store is an interface instead of a struct, so write cachestore.Store where you wrote *cachestore.Store, and use a type assertion, such as cache.(auth.EmailStore), to reach an optional interface.

All changes

Added

Show 84 added entriesHide added
  • tensile-auth-server, a sign-in server for apps in any language: configuration from TOML, the environment, and _FILE secrets, with startup refusals and check; Postgres or SQLite with migrations; keys sealed under a master key, with keys status, keys rotate, and keys rewrap; the sign-in routes behind the app's proxy; app keys (tsx_); the /v1 API with POST /v1/check, /v1/meta, and /v1/openapi.json; /v1/events/stream; hooks and signed webhooks; the admin API; and the OAuth provider. The image ghcr.io/tensile-tools/tensile-auth-server is distroless, runs as a non-root user, and is built for linux/amd64 and linux/arm64. See docs/server.md.
  • @tensile-tools/auth, the TypeScript SDK for apps that use the server, on npm: createTensile with check, meta, users.get, and as(subject) for agents, delegation, approvals, and the session tree; a proxy for the browser routes; webhook verification and answerHook; a cache built on /v1/events/stream (cache: true); and adapters for Next.js, Express, and Hono. Its types come from server/openapi.json. It names @tensile-tools/auth-client as a peer dependency. See docs/guide-node.md.
  • @tensile-tools/auth-client, the browser client, on npm at the same version as the Go module.
  • The library is licensed under the Apache License 2.0.
  • The approvals user flow. When your agent tries something risky, it gets a link instead of a yes; you tap your passkey on that exact action, and the agent continues, once, with a signed receipt.
    • authhttp.Approvable holds a retry that sends Prefer: wait=N (RFC 7240) until the person approves or denies, for at most 60 seconds, and runs the route once; auth.Service.RedeemApprovalWait does the same outside HTTP. The wait ends when the client disconnects, authenticates the agent's token again before it spends the approval, and is limited to 4 waits per agent and 1,024 per service (MaxApprovalWait, MaxApprovalWaitsPerAgent, MaxApprovalWaits).
    • RequestApproval returns the agent's pending approval for the same action and need instead of a new one.
    • Apps that use the server and the SDK wait for the person's tap too. POST /v1/check takes Prefer: wait=N: on a retry it holds the check until the person decides, for at most N seconds, and on the check that creates an approval N caps the wait the refusal offers. Each app key holds at most 256 waits on each replica; a wait over any limit answers approval_pending at once, a wait whose app disconnects writes nothing, and shutdown ends every wait with approval_pending.
    • The SDK's approvalWait option, in seconds from 0 to 60, caps how long an approvable route holds an agent's retry. It defaults to 50 on a long-running server and to 0 on a detected serverless platform (VERCEL, AWS_LAMBDA_FUNCTION_NAME, NETLIFY, or an edge runtime); on serverless, keep maxDuration >= approvalWait + 5. approvable in the Express, Hono, and Next.js adapters takes { wait } for one route, and ends the check when the agent disconnects. check takes approval.wait and signal, and a waiting check's timeout is its wait plus timeoutMs.
    • authhttp.WithApprovalWait caps how long Approvable holds a retry, and the wait the refusal offers; 0 turns waiting off. authhttp.PreferWait reads a request's Prefer: wait=N.
    • auth.WithApprovalURL sets an absolute approval link, carried as Approval.URL and as the challenge's approval.url; authhttp.WithApprovalURL joins a relative prefix to the first WithOrigins origin. ChallengeApproval.WaitHint (wait_hint) and the problem's fix tell the agent to show the link and retry with Prefer: wait=N, where N is the smallest of the app's cap, 60 seconds, and the seconds until the approval expires, and say how long the request waits. When the app holds no retry, wait_hint is missing and the fix tells the agent to retry after Retry-After.
    • Need.ApprovalTTL sets how long an approval waits for the person and then for the agent, from 1 minute to 24 hours (MinApprovalTTL, MaxApprovalTTL); the default stays 5 minutes. PendingApprovals reads the last 24 hours.
    • auth.WithApprovalNotifier calls a function once for each new approval, in the background, with the approval and its link. The guide has recipes for email and a Slack incoming webhook.
    • examples/agents: errands pay prints the approval's link and a terminal QR code and waits, and the MCP tool task_mark_paid asks and waits in two calls.
  • The elements: drop-in sign-in and account screens as framework-free Web Components, served by authroutes.Mount under /auth/client/elements/ with Geist and Inter: <tensile-sign-in>, <tensile-sign-up>, <tensile-step-up>, <tensile-approval>, <tensile-approvals>, <tensile-sessions>, <tensile-wasnt-me>, <tensile-activity>, <tensile-two-step>, and <tensile-recovery-codes>. The browser client gains approvals, approval, approve, deny, sessions, revokeSession, signOutOthers, activity, recoverySignIns, undoRecovery, enrollTOTP, confirmTOTP, generateRecoveryCodes, confirmRecoveryCodes, and me.
  • RevokeOwn from a session in recovery mode revokes only that session and what is delegated from it; for any other session it refuses with stronger_factor_required.
  • authroutes.Mount serves the account routes the elements call: GET /approvals, GET /approvals/{id}, and POST /approvals/{id}/begin, /finish, and /deny; GET /sessions, POST /sessions/{id}/revoke, and POST /sessions/revoke-others; GET /activity; and, with Config.Recovery, GET /recovery/sign-ins and POST /recovery/undo. Each is for a human session and its own account only.
  • Service.PendingApprovals, a person's inbox of approvals that wait for them, newest first. Every approval event carries the approval's ID in Event.Factor.
  • Email and password sign-in in the password package, held to OWASP ASVS 5.0 Level 2: sign-up that creates no account before the address is confirmed (VerifyFirst, the default), confirmation that needs the browser that signed up or the account's session or password besides the code, sign-in that answers factor_rejected and does the same work for every failure, step-up, change, forgot and reset, a reset started by an administrator, address change, and adding and removing a password. Argon2id hashes in PHC strings at or above the OWASP minimum, rehashed at sign-in; a 15-character minimum and a 256-character maximum; 10,000 common passwords from SecLists; context words; no composition rules, expiry, or lockout. See the design.
  • MCP authorization (see the design): oauth.Config.Resources and auth.GrantSpec.Resource bind a grant and every token under it to one resource (RFC 8707), reported as Principal.Resource and as aud from introspection; authhttp.WithResource accepts tokens for a resource, which authhttp.Middleware otherwise refuses. Every authorization response carries iss (RFC 9207), and the metadata is also served at /.well-known/oauth-authorization-server. oauth.Config.CIMD accepts client ID metadata documents, in allowlist mode by default, fetched through an SSRF-safe fetcher; oauth.Config.Registration turns on dynamic client registration. AuthorizationRequest gains the client kind, its verified host, the redirect host, the resource, and Warnings, and Service.RecordConsent records each approval. The SQL stores add a resource column (sqlitestore migration 0018, pgstore migration 0019).
  • mcpauth, which protects an MCP server built on the official Go SDK: Protected Resource Metadata, audience checks, per-tool scopes checked inside the SDK, and the Local and Introspection verifiers.
  • mcpauth.JWT, a verifier for JWT access tokens from another authorization server: an allowlist of asymmetric algorithms only, keys from a JWKS URL or the issuer's RFC 8414 or OpenID Connect metadata fetched through the SSRF-safe fetcher and refetched for an unknown kid at most once a minute, required iss, exp, and audience, nbf and iat with a clock skew, an optional at+jwt requirement, and MaxAge. A key outage is a 503.
  • Service.Connections, Service.RevokeConnection, and Service.RecordToolCall, with mcpauth.AuditTo, and GET /v1/users/{user}/connections in authadmin.
  • examples/mcpserver, an MCP server and its provider in one binary, with a README that connects Claude Code.
  • Bridged sessions, for an application with its own login (see the design): auth.MethodBridged, StartOptions.Bridged and StartOptions.MaxAge, Principal.BridgedOnly, Need.Bridged, and the reason bridged. A bridged session keeps the application's sign-in time and meets only needs that set Bridged, which oauth.NeedApprove and auth.NeedGrant do; CreateAgent and Delegate refuse it.
  • authhttp.Bridge, middleware that turns an application's own signed-in user into a bridged session for the OAuth provider and the consent page. It keeps one short-lived session per sign-in to the application in __Host-bridge, compares the user on every request and revokes the session when the user changes or signs out, and refuses unsafe cross-origin requests. authhttp.EndBridge ends it from the application's sign-out. authhttp.Middleware never accepts a bridged session.
  • authexport, which writes every sign-in record of an install to one age-encrypted JSON Lines file with Export, and reads it into another store with Import, in one transaction or not at all. TOTP secrets leave in the clear inside the encrypted file and are sealed under the target's key ring. totp.OpenSecret and totp.SealSecret open and seal one secret for it. It adds the dependency filippo.io/age. See the design.
  • auth.TransferStore, which exports every sign-in record in one read-only snapshot and imports records in one transaction, in memstore, sqlitestore, and pgstore, with storetest.RunTransfer. cachestore doesn't implement it. The events export_started, users_exported, and users_imported.
  • password.Config.AcceptBcrypt verifies bcrypt hashes imported from Auth0, Clerk, Supabase, and other products, with a cost from 10 to 14, and replaces each with Argon2id on the first correct password. It is off by default, and the library never creates a bcrypt hash. password.CheckHash checks a hash before an import stores it. See the export design.
  • authexport.ReadAuth0, ReadClerk, and ReadSupabase read other products' export files into an authexport.Plan, which Plan.Import stores in one transaction. They keep the source's user ID, or mint usr_ IDs with SourceOptions.MintIDs and write the mapping with Plan.WriteIDs; carry addresses, verified state, bcrypt hashes, and Google and GitHub identities; skip and report blocked and deleted users and users who share an address; and stop with ErrUnknownField at a column or field they don't know. authexport.SupabaseCopy is the statement that exports Supabase's users.
  • tensile-auth-server import --from auth0, clerk, or supabase reads those files into the install, with --users for Auth0's bulk user export, --mint-ids FILE to mint IDs and write the mapping before the users are stored, --dry-run, and --merge.
  • authadmin.WithAlertSource adds alerts from state outside the audit log to GET /v1/alerts, as authadmin.Alert values. A source that fails, or returns an alert without a valid kind, severity, message, and FirstAt, fails the request with 503.
  • The server raises a webhook_late alert in GET /admin/v1/alerts while a webhook has failed for 15 minutes or more, and a webhook_skipped alert for events skipped after 72 hours, which it records as server.webhook_skipped.
  • The release workflow, which on every version tag smoke-tests the server image, builds it for linux/amd64 and linux/arm64 with an SPDX SBOM and SLSA provenance, signs it keylessly with cosign, with the signature recorded in Sigstore's public transparency log, and pushes it to the public ghcr.io/tensile-tools/tensile-auth-server package. just smoke-server runs the smoke test.
  • docs/server.md, the server's operator guide: installing with Docker or the binary, configuration, the master key and key rotation, backups, upgrades and migrations, export and import, the first administrator, OAuth, hooks and webhooks, the reverse proxy and its timeouts, monitoring with /readyz, and troubleshooting from the startup refusals.
  • password/pwned, an opt-in breached-password check against the Have I Been Pwned range API that sends 5 characters of a SHA-1.
  • auth.MethodPassword, and the password cap: on an account with a passkey or confirmed TOTP, a session whose strongest method is a password is never fresh, and Service.StepUp and Service.Elevate refuse password proofs with stronger_factor_required.
  • auth.EmailStore in memstore, sqlitestore (migration 0017), and pgstore (migration 0018), passed through by cachestore, with storetest.RunEmails. DeleteUserFactors also deletes the address and the password, and a first identity fails for a user with an address.
  • CreateAgent, ClaimAgent, and Delegate from a human session refuse an account whose address is unconfirmed, with email_unverified. Accounts without an address are unaffected.
  • Attempt.Target, Runtime.AllowTarget, and ratelimit.Rule.PerTarget limit attempts against one address across every client, and ratelimit.DefaultRules has rules for every password action.
  • UndoRecovery also deletes a password or an address set after the recovery, and UndoResult reports both.
  • federation.Federation.Unlink counts a usable password as another sign-in method.
  • The browser client gains signInWithPassword, signUpWithPassword, confirmEmail, forgotPassword, resetPassword, stepUpWithPassword, changePassword, addPassword, removePassword, changeEmail, resendVerification, and passwordStatus.
  • auth.WithRecoveryGate holds every need at AssuranceMulti until the account has a second factor and a confirmed recovery path, with the refusal code setup_incomplete. Service.Setup reports what an account has. recovery.Codes.Confirm checks a typed-back code without spending it and records recovery_codes_confirmed; a new set voids it.
  • The preset package: four versioned presets, consumer@1, standard@1 (the default), strict@1, and passkey-only@1, each a complete, explicit configuration of session policy, verification, minimum length, the second factor, the recovery gate, nudges, and code lifetimes. A released preset never changes; a golden test holds every @1 expansion. Preset.ASVS states the level each reaches, the Level 2 requirements it misses, and its deviations; Describe prints the expansion; ShouldOffer says when to offer a passkey, a second factor, or recovery codes; strict@1 and consumer@1 require the breached-password check, which sends only 5 characters of the password's SHA-1 to the Have I Been Pwned range API.
  • cmd/tensile-auth-preset prints a preset's full settings, its ASVS level, what it misses, and its deviations: go run ./cmd/tensile-auth-preset strict@1, with -json for the expansion and -all for every preset.
  • authroutes.Config.Preset checks that the configuration matches a preset and adds GET /auth/setup, which answers what the account has and what to offer it now. With Recovery set, POST /auth/recovery/confirm takes a typed-back recovery code. The README's quickstart uses standard@1.
  • Device Bound Session Credentials (DBSC). With authhttp.WithDeviceBound and authhttp.DeviceBound, browsers that support DBSC bind each session to a key in their hardware after sign-in; the session cookie then lives 10 minutes and renews only with a proof signed by that key, so a stolen cookie stops working within minutes and can't be renewed on another device. Other browsers keep a plain cookie. It is opt-in: set authroutes.Config.DeviceBound. Turning it off signs no one out: authhttp.WithDeviceBoundRetired, which authroutes uses when DBSC is off, binds nothing new and moves each bound browser to a plain cookie after one last proof of its key. The service checks ES256 and RS256 proofs with the standard library (Service.RegistrationChallenge, Service.BindDevice, Service.RefreshChallenge, Service.RefreshDevice, Service.UnbindDevice, Service.DeviceBound). Mux.Configure adds middleware options after NewMux.
  • bench/agentbench measures how fast coding agents add passkey sign-in with this library, and checks the result with a real sign-up through a virtual authenticator. The first run: 6 of 6 agents built a working sign-in, the fastest in 33 seconds.
  • For coding agents: skills/tensile-auth/SKILL.md, a tested recipe for adding sign-in that TestSkillRecipeCompiles builds against the library, and llms.txt, the index an LLM reads first.
  • examples/quickstart: passkey sign-in in one Go file of about 60 lines and one HTML page, with no build step. Run go run ./examples/quickstart and open http://localhost:8080.
  • The compiled browser client ships in client/dist and is embedded in Go by package client; authroutes serves it under /auth/client/, revalidated on every load against a content ETag, so apps need no Node. just client fails when the committed build is stale.
  • Service.RequireAgentPart checks an agent against the parts of a need that don't need a person, after WithNeeds tightened the need.
  • Service.UnsealedAudit counts the audit events that aren't sealed into the hash chain, which VerifyAudit can't cover, and returns when the oldest was recorded. The admin API's chain status reports them as unsealed and oldest_unsealed_at.
  • authtest.PublicRoutes lists a Mux's Public routes, so a test can compare them with the list you expect.
  • authhttp.WithSignInPage("/signin", pages...) sends a signed-out browser that opens the approval page, or a page you list, to sign-in with a return_to path, instead of a 401 problem. It applies only to a GET or HEAD whose Accept header prefers text/html. authhttp.SafeReturnTo accepts only a relative path on the same origin, auth.Runtime.ApprovalURL returns the service's approval link, and Mux.Check refuses a sign-in page that isn't a path on the origin.
  • <tensile-approval> handles a signed-out person: it says "Sign in to review this request", signs in with a passkey, and then shows the request; with sign-in-href, it also links to the sign-in page. <tensile-sign-in> and <tensile-sign-up> go to a safe return_to path after sign-in, ahead of redirect, and their links to each other carry it on.
  • tensile-auth-server help COMMAND, and -help, -h, or --help after a command, print that command's usage and its configuration flags.
  • examples/agents: the approval link and the consent page send a signed-out person to sign-in and back, and the device page says "Sign in first, and you'll come back here to enter the code."
  • authroutes.Mount adds every route the browser client calls to an authhttp.Mux in one call: passkey sign-up, sign-in, step-up, adding a passkey, the Signal API list, sign-out, and the session, plus TOTP and recovery codes when configured. Each route declares its rule. Config.NewUser and Config.Scopes connect it to the app's users.
  • Service.PendingSignIn and authhttp.PendingSignIn read a pending sign-in without using it up, for a second-factor page.
  • The client answers needs_factor when an account needs TOTP, with verifyTOTP and signInWithRecoveryCode to finish.
  • docs/guide.md, an integration guide from nothing to passkeys, recovery, TOTP, step-up, tokens, agents, and approvals, and docs/errors.md, an error catalog that TestErrorCatalogIsCurrent keeps in step with Describe.
  • passkey.Passkeys.Rename relabels one of a person's passkeys and records passkey_renamed; FactorStore.RenameCredential supports it in every store.
  • passkey.User.State carries up to 4 KiB of app data, such as a display name from a sign-up form, from a registration's begin step to Credential.State at its finish, so apps need no pending map.
  • Dev tools: auth.WithDevTools turns on Service.DevAge and Service.DevRecoverySession, and authhttp.DevTools serves them with the session state to the client's mountDevTools panel, so step-up and recovery screens can be tried in seconds. They answer 404 when off, and Mux.Check refuses them unless every origin is localhost.
  • authhttp.WithFreshHeader sends Tensile-Auth-Fresh-Until and Tensile-Auth-Assurance; the client exposes freshUntil and fetch(path, {stepUpFirst: true}) steps up before the request instead of after a refusal.
  • The browser client, @tensile-tools/auth-client in client/: passkey ceremonies with honest outcomes, one "Continue" entry point with immediate mediation, autofill that the other ceremonies cancel, fetch that steps up on a challenge and retries once, Signal API sync, tab sync through BroadcastChannel, capability detection, and non-extractable PRF keys. It has no dependencies; just client type-checks and tests it.
  • passkey.Passkeys.AcceptedCredentials answers the client's Signal API sync.
  • Purpose-scoped elevation: Service.Elevate steps a session up for one Purpose (for example auth.For("secrets.edit", "repo:acme/api:prod")) without rotating it or making it generally fresh, and a Need with that Purpose passes only through it, within 10 minutes by default. Service.Elevation reports when, for a labeled timer. Challenges for such needs carry purpose. Elevations last at most MaxElevation, 1 hour, and are recorded as session_elevated.
  • Action-bound approvals. An agent asks its human to approve one exact Action with Service.RequestApproval; the human reviews it with Service.Approval and approves with one passkey tap through passkey.Passkeys.BeginApproval and FinishApproval, whose WebAuthn challenge is ApprovalChallenge over the action's digest; Service.Approve records the Receipt in the approval_granted event, and passkey.Passkeys.VerifyReceipt checks it later. Service.RedeemApproval spends the approval once, only for the agent that asked and the same action. Service.Deny refuses it.
  • authhttp.Approvable turns an agent's refusal into a challenge with approval (id, url from WithApprovalURL, summary, expires_in), and runs the route once when the agent retries with the Tensile-Approval header.
  • FactorStore.CeremonyByID reads a ceremony without consuming it, in every store.
  • Agent claim previews: Service.PeekClaim shows the unclaimed agent behind a claim code, with four pairing words, without spending the code. The agent prints the same words with PairingWords, so the person can check they're claiming the agent in front of them. SignupStore.AgentByClaimCode supports it in every store.
  • Service.CollectClaimWait holds a collect open for up to 60 seconds and returns as soon as a person claims the agent.
  • DelegateSpec.Name labels a delegated token, for example "Claude Code, task 14"; it appears as SessionInfo.Name.
  • Safe hints after identification, through auth.HintFactor: a TOTP code reused within its step returns code_reused with the seconds until the next code and doesn't count toward the lockout; a locked TOTP factor returns factor_locked. A step-up with another account's passkey records the reason wrong_account in the audit log. Failures before sign-in stay identical.
  • totp.TOTP.Status reports whether a user has TOTP, and whether it is confirmed or locked.
  • Sessions people can read: StartOptions.Device and StartOptions.UserAgent, which authhttp.SignIn fills from the request with authhttp.DeviceLabel ("Chrome on macOS"), appear on SessionInfo. Service.SessionTree returns live sessions as a tree of devices with the agents delegated from each. Every store has a migration for the new columns.
  • authhttp.WithRotation rotates a browser session's token on the first request after an interval. Principal.IssuedAt and SessionInfo.RotatedAt say when the current token was issued, and Swap.At records it.
  • HTTP helpers: authhttp.SignIn starts a sign-in and sets the session cookie, or a pending cookie when the account needs another factor; authhttp.CompleteSignIn, authhttp.StepUp, and authhttp.SignOut finish the rest without raw-token plumbing.
  • authhttp.WithClientIP sets the client key from the connection, or from X-Forwarded-For through trusted proxies only, with IPv6 keys as /64 prefixes. authhttp.WithClientKey takes a custom function.
  • authhttp.Mux: every route declares authhttp.Public or authhttp.Need(...), and Mux.Check refuses to start with a route without a rule, an admin route (WithAdminPrefix) below a multi-factor human, no client key, no limiter, or an http origin (WithOrigins) other than localhost.
  • authtest.Routes calls every route of a Mux as an anonymous caller, a recovery-mode session, a stale session, and an agent without scopes, and fails on any 2xx the route's need excludes.
  • Ownership-checked management: Service.RevokeOwn, Service.RevokeOwnAgent, and Service.RevokeOthers ("sign out other devices"), which check NeedRevokeOwn or NeedRevokeOthers, record the caller as the actor, and answer ErrNotFound for another account's session or agent. RevokeOthers refuses recovery mode, so a stolen recovery code can't sign the person out of the devices that could undo the recovery. Service.ListSessions filters by kind, liveness, and agent.
  • Recovery mode. After a recovery code is used, WithRecoveryHold (1 hour by default, 0 to turn it off) refuses every session of the account the needs marked HoldAfterRecovery: creating personal access tokens, OAuth grants and approvals, and agent claims. The refusal has the code recovery_hold and a retry_after.
  • "That wasn't me": Service.RecoverySignIns lists recovery sign-ins from the last 72 hours, and Service.UndoRecovery, from a session that started before the recovery, revokes the recovered session and every session, token, and grant created since, disables new agents, removes new passkeys and TOTP, deletes the remaining recovery codes, and lifts the hold. It records recovery_undone.
  • Pending sign-ins: Service.BeginSignIn records a first proof and returns what else the account needs, and Service.CompleteSignIn starts the session once a proof for each arrives. A sign-in that starts with a recovery code or a federated sign-in needs TOTP when the account has it. Pending tokens (tsi_, a checksummed kind of their own) work once, never authenticate requests, and expire after PendingTTL, 5 minutes.
  • recovery.Codes.Check verifies a code without spending it. Its proof carries the code in Proof.Reserved, and the service spends it only when a session starts or steps up, so leaving at the TOTP prompt keeps the code. FactorStore.RecoveryCodeOwner supports it in every store.
  • Declared needs: Need, Service.Require, Service.Meets, and WithNeeds. A need names an action and sets a minimum Assurance (none, recovering, single, or multi), how recent the human's proof must be, whether only a human may act, and required scopes. The library's own sensitive operations each check one, such as NeedCreatePAT, passkey.NeedRemove, and oauth.NeedApprove, and WithNeeds can tighten any need by its action but never loosen it. Principal.Assurance reports a session's level.
  • Refusal, the error Require returns. It says which part of the need failed and lists the factors the account has that would meet it with a step-up.
  • One problem model: Problem and Describe turn every library error into RFC 9457 problem details with a stable code, a fix for people, retry_after, and a challenge. NewError gives packages built on the library the same shape.
  • authhttp.Error, authhttp.WriteProblem, authhttp.RequireNeed, authhttp.RequireHuman, authhttp.WithStepUpURL, and authhttp.WithProblemWriter.

Changed

Show 25 changed entriesHide changed

This is a minor version because it makes incompatible changes, each marked Breaking: here or under Fixed.

  • Breaking: The module path is tensile.tools/auth, not github.com/tensile-tools/tensile-auth, and the tools module is tensile.tools/auth/tools. Replace the old path in your imports and in go.mod, then run go get tensile.tools/auth@v0.3.0. Versions up to 0.2.2 used the old path.
  • SignupPolicy.SessionIdle defaults to 24 hours or ClaimWindow, whichever is shorter, so a claim window under 24 hours no longer fails validation unless SessionIdle is also set.
  • RegisterAgent stores an empty agent type as unknown instead of refusing it.
  • ratelimit.DefaultRules has an agent.register rule: each client gets a burst of 5 sign-ups, then 5 an hour. It used the default of 10 a minute.
  • Breaking: authroutes.Mount serves email and password sign-in by default, and panics unless exactly one of Config.Passwords and Config.PasskeyOnly is set. To keep serving passkeys only, add PasskeyOnly: true to authroutes.Config. To serve passwords, create a password.Passwords and set Config.Passwords.
  • Breaking: Service.DeviceBound returns (bool, error) instead of bool, so a store failure is no longer read as "not bound".
  • Breaking: authroutes.Config.DisableDeviceBound is removed. DBSC is opt-in: set Config.DeviceBound to turn it on.
  • Breaking: leakscan.Handler is no longer comparable with ==, because leakscan.WithRevoker added a function field.
  • approval_pending's fix tells the agent it can wait in one request with Prefer: wait=60, and human_required with an approval tells it to show the link and retry with the Tensile-Approval and Prefer headers.
  • ratelimit joins the parts of its counter keys with the ASCII unit separator instead of NUL, which PostgreSQL refuses in text, so pgstore.RateLimits works with ratelimit.Limiter. Counters under the old keys stop counting, so every limit starts fresh once, at the upgrade.
  • Each email that carries a code carries it twice: as a link, and as a typed code of 8 Crockford base32 characters, shown as ABCD-EFGH, that works only on the device that started the flow (the browser that signed up or asked for a reset, or the session that asked) and dies after 5 wrong guesses. password.Message.Code is the typed code; the link code moves to Message.Token, and Message.Link carries it in a link to Config.Links when that is set. Message.ValidFor says how long the code works in plain words. Forgot takes ForgotOptions{Binding}, and ResetOptions.Binding lets that browser type the reset code. Typed codes are stored as Argon2id hashes with a random salt.
  • A reset email carries a typed code only when the browser that asked holds a known-device token for the account and its current password version (ForgotOptions.KnownDevice, which authroutes reads from __Host-known). Every other reset email carries the link only. Otherwise an attacker could ask for a reset of someone else's address from their own browser and talk the owner into reading out the code. Message.CodePurpose and password.NeverShare give the words every email shows next to a typed code.
  • password.Config.CodeTTL is replaced by ConfirmTTL and ResetTTL. Address confirmation (sign-up, verify, adding a password with an address, and address changes) lasts 24 hours by default and up to 72 hours, because confirming an address never starts a session or returns a proof. Reset codes keep the 10-minute default and ceiling. To migrate, rename CodeTTL to ResetTTL; leave ConfirmTTL unset for 24 hours, or set it to the old value to keep confirmations as short as before. emailcode.MaxTTL is 72 hours, and emailcode.MaxProofTTL is the 10-minute ceiling for reset codes.
  • authroutes keeps the sign-up binding cookie for ConfirmTTL and sets a __Host-reset binding cookie for ResetTTL on forgot-password, so the browser that started can type the code. ratelimit.DefaultRules limits password.confirm and password.reset for each device that types a code: a burst of 10, then 10 an hour.
  • authroutes serves GET /auth/password/confirm and GET /auth/password/reset, pages for links in email that change nothing when they load: each posts the code from the URL fragment only when the person presses its button, so a mail scanner that opens a link, even one that runs scripts, spends nothing. The pages can't be framed and aren't cached. authroutes.Links returns them for password.Config.Links. The code_invalid problem reads "That link or code doesn't work".
  • Every refusal's challenge lists a password, after TOTP, when the account has one and no stronger factor, and factorList names it "your password".
  • An invalid claim code describes itself as "That claim code doesn't work" instead of the sign-in message.
  • Pending sign-in tokens are a checksummed token kind of their own, tsi_…, instead of tsp_…, which personal access tokens use, so secret scanners and logs tell them apart.
  • Service.RequestApproval and Service.RedeemApproval take the action's Need, and FactorStore.ConsumeCeremony takes the kinds it may consume.
  • totp.TOTP.Confirm returns a TOTP proof, so finishing enrolment can also step the session up.
  • Service.Meets takes a context, because it also checks the recovery hold.
  • authadmin answers every error as RFC 9457 problem details (application/problem+json) with the same codes as the core. fresh_session_required becomes step_up_required, and agents get human_required. Refused changes carry a challenge. WriteError writes the same shape for routes added with WithRoutes.
  • authhttp writes every refusal as application/problem+json instead of plain text. A step-up refusal also carries an RFC 9470 insufficient_user_authentication challenge in WWW-Authenticate, and a throttled one a Retry-After header.
  • authhttp.RequireFresh refuses a session whose only factor is a recovery code, and records agents as not_human instead of not_fresh.
  • Sensitive operations return a *Refusal. It matches ErrStepUpRequired, ErrStrongerFactorRequired, or ErrScopeMissing as before, and is recorded as access_denied, including for passkey, recovery-code, TOTP, and signup-override changes that didn't record refusals before.

Fixed

Show 18 fixed entriesHide fixed
  • <tensile-two-step> offered setup again to a person whose authenticator app was already on. It reads the new GET /auth/totp/status route first and shows "Your authenticator app is on" with Replace and Remove, a locked app with Set it up again, or the setup steps. authroutes.Mount serves GET /totp/status and POST /totp/remove with Config.TOTP, for a human session and its own account only; removing needs a sign-in from the last 10 minutes. The browser client gains totpStatus, removeTOTP, and the TOTPStatus type, and the element dispatches two-step-off.
  • examples/agents: the household activity said "You completed …" for an agent's work. Each entry records the agent and its name, and the person who approved an agent's payment, so the feed says "Claude Code completed …" with the agent's name in violet, and "Claude Code marked … paid, approved by you". The work an agent does over MCP is recorded too. The activity API adds agent_id, agent_name, approved_by, and approved_by_name, from migration 002_activity_actor.sql.
  • examples/agents: "No due date" wrapped onto two lines in the household task table at 1440 px. The Due, Status, and action cells, the ledger's Date, and the members' Role don't wrap on a desktop, and wrap freely when the table stacks on a phone. A due date showed a clock time, such as "Dec 18, 5:30 AM", from reading the date as UTC midnight; it shows the day in the person's calendar, such as "Dec 18", "Today", or "Tomorrow".
  • tensile-auth-server -help, -h, and --help print the usage and exit 0, instead of refusing to start with "flags: flag: help requested".
  • An element that shows the person's data reloaded on every session event except a step-up, so a signed-out <tensile-approval> or <tensile-sessions> loaded, got 401, and loaded again without end, in every tab. Each element drops its data and shows "You're signed out" with a passkey sign-in when the session ends, fetches nothing while signed out, and loads once after the next sign-in.
  • examples/agents: the household, ledger, and members tables have header scopes, names, and labelled buttons.
  • Breaking: cachestore dropped auth.FactorStore, auth.DeviceStore, and auth.TransferStore, and claimed auth.EmailStore, auth.IdentityStore, auth.SignupStore, and auth.SignupSettingsStore even when the wrapped store lacked them. The server wraps Postgres in the cache by default, so a production server couldn't create or redeem approvals through /v1/check or authhttp.Approvable ("approvals need a FactorStore"), elevate a session, start or complete a pending sign-in, bind a device with DBSC, or undo a recovery. Behind the cache, Service.Setup reported no factors, step-up challenges offered no methods, the password cap never applied, and Prune left expired ceremonies and device codes. The store that cachestore.New returns implements each optional interface exactly when the wrapped store does, and storetest.RunWrapper checks a wrapper for this. This is an incompatible change: cachestore.Store is an interface instead of a struct, so write cachestore.Store where you wrote *cachestore.Store, and use a type assertion, such as cache.(auth.EmailStore), to reach an optional interface.
  • Step 6 of the Node guide hand-wrote the sign-in page with createAuthClient. It uses <tensile-sign-in> and <tensile-sign-up>, loaded from /auth/client/elements/ through the SDK's proxy, and the guide creates the app with --no-cache-components, because its pages read the request.
  • A claimed agent couldn't ask for or redeem an approval for an action that WithNeeds marks Human: RequestApproval, RedeemApproval, and authhttp.Approvable applied WithNeeds again after removing the parts only a person can meet, and got human_required. The agent meets the scopes and the recovery hold of the tightened need, and the approver meets all of it.
  • Delegate with a scope that the parent holds but AgentSpec.Scopes doesn't allow said the scope exceeds what the parent holds. The error names the agent's allowed scopes, and its problem's fix says to ask for fewer scopes or allow the agent more. It still matches ErrScopeExceeded with the code scope_exceeded.
  • authhttp refused a token bound to another resource with the generic "Sign in to continue". The 401's detail says the token is for a different resource without naming it, and a warning in the log names the resource and authhttp.WithResource.
  • authhttp.Middleware, authhttp.NewMux, and authhttp.Bridge discarded their logs unless given a logger of their own, so the error behind a 500 was lost. They log to the service's logger by default.
  • passkey.New errors name the field and the fix, for example an RPID with a scheme, a port, or a path.
  • authroutes.Mount panics with a message for each case: no Passkeys, neither Passwords nor PasskeyOnly, or both.
  • Step-up, approvals, and AcceptedCredentials failed on sqlitestore and pgstore with a NOT NULL constraint error. They read the passkey user handle with FactorStore.UserHandle(ctx, user, nil), and the SQL stores tried to insert the nil handle before resolving the conflict. A nil handle only reads: UserHandle returns the stored handle, or ErrNotFound when there is none, and stores nothing. The storetest case NilUserHandleOnlyReads covers every store.
  • Passkey sign-up failed with factor_invalid for providers that return PRF outputs at registration, such as iCloud Keychain and some password managers, and for clients that serialize those outputs with JSON.stringify, which turns each into {}. Registration asks only whether PRF is available, so FinishRegistration drops the outputs unread. A sign-in still rejects PRF outputs. Registration rejections also name their cause: passkey.ReasonResponseUnreadable when the response isn't a WebAuthn response, and passkey.ReasonNotVerified when the passkey was made without user verification.
  • FactorStore.PutCeremony overwrote an existing ceremony in memstore but failed with a raw database error in pgstore and sqlitestore, so elevating twice for the same purpose failed on those stores. Every store answers ErrConflict for an existing ID, and Elevate replaces an earlier elevation for the same purpose.
  • The client's enter() failed in browsers that report immediate mediation in getClientCapabilities but reject the value; it falls back to the normal prompt. A prompt cancelled by a timeout signal reads as no_passkey_or_cancelled, not a failure.

Security

Show 18 security fixesHide security
  • OpenTelemetry, which the OIDC provider pulls in, is upgraded from v1.46.0 to v1.47.0 for GO-2026-6975 (memory amplification when parsing W3C baggage) and GO-2026-6974 (an attribute length limit bypass). govulncheck found that the library doesn't call the affected code.
  • After a lost session, by expiry or a revocation in another tab or device, <tensile-sessions>, <tensile-activity>, <tensile-approvals>, and <tensile-approval> kept showing the person's sessions, agents, activity, and approvals. They clear that data at once, a load that started before the session changed drops its result, and a sign-in, perhaps by another person, shows the loading state before it shows that person's data.
  • The sign-in redirect from authhttp.WithSignInPage and the elements' return_to follow only a relative path on the app's own origin, so neither is an open redirect: //host, /\host, an absolute URL, a percent-encoded //, a backslash, a fragment, a control character, and a path over 2,048 bytes are refused.
  • tensile-auth-server never read Tensile-Client-IP, which the SDK's proxy sends with the app key, so behind the proxy every person shared the app server's address in per-client rate limits and the audit log. One person could throttle sign-ins for everyone, the limits were too loose for each person, and the audit log recorded the app server as the client. The server keys by Tensile-Client-IP only on a request that carries a live app key, checked first, and only when the value is a single IP address; otherwise it ignores the header. /v1/check with a request.client_ip that isn't a single IP address counts against the app's address instead of a shared 0.0.0.0. authhttp.ClientIP and authhttp.ClientKey expose the rule that WithClientIP uses, for a WithClientKey function.
  • passkey.Passkeys.VerifyReceipt checked a receipt's user-verified flag but not its user-present flag, so a receipt read back from the audit log could verify although the authenticator never saw a person. FinishApproval already refused such an assertion. VerifyReceipt requires both flags.
  • Two requests racing to bind one session to a device key could both succeed. A session gets at most one registration challenge, recorded with an atomic insert, so only one binding can win.
  • Device-bound sessions had three gaps: the lifetime check ran only for cookies, so a stolen token sent as a Bearer header kept working; the refresh endpoint issued a challenge for any ID, including a session ID, and registration and refresh challenges shared one namespace, so a stolen cookie could bind the session to the thief's key; and a session could be bound again, with refreshes not checking that a binding was still current. The lifetime check covers every way a token is sent; RegistrationChallenge and RefreshChallenge keep separate namespaces, the first refusing a bound session and the second refusing anything but a current binding; and binding a bound session is refused.
  • agentbench started the app an agent built with the whole environment of the person running it, including API keys and tokens; let the agent run any go subcommand, including go run; and pointed the agent at the live checkout. The app starts with a minimal environment, the agent may run only exact go build, go vet, go mod tidy, and gofmt commands, since a prefix such as go build:* still allowed -toolexec, and it works against a temporary copy of the committed library.
  • The browser client signalled a passkey as unknown to the password manager on any factor_rejected, which also covers an expired ceremony or a failed check, so a password manager could delete a passkey that still works. It no longer does; syncPasskeys alone tells password managers which passkeys exist.
  • RedeemApproval wasn't tied to the route's need, so an approval granted under one need could open another route that describes the same action under a stricter need; it didn't re-check the agent's own part of the need; and a store error during its ownership check failed open. It takes the need, which must have the same action as the one the approval was asked for, checks the agent's scopes and the recovery hold again, and fails closed.
  • Service.Elevate trusted the principal it was given, so it could elevate a revoked or expired session, or a principal built by hand naming another session. It checks that the session is a live human session of the principal's user, and returns ErrParentInactive otherwise.
  • Approvals could stand in for more than a person: an agent missing a scope, or held after a recovery, could still get an approval and use it, and the approving session didn't have to meet the action's need. RequestApproval takes the need: the agent must meet its scopes and the recovery hold, and the approver must meet the whole need, with the recovery hold. A redeem by another agent, or for another action, no longer spends the approval, so a stranger who learns an approval ID can't burn it.
  • FactorStore.ConsumeCeremony deleted a ceremony of any kind, so a crafted passkey response, federation state, or OAuth request ID whose hash matched another flow's ceremony could delete it. It takes the expected kinds and leaves other ceremonies alone, in every store.
  • A passkey step-up told the caller wrong_account before checking the passkey's signature, so anyone with a session could submit made-up credential IDs and learn which exist on other accounts. The reason now reaches only the audit log, and the caller gets the generic rejection.
  • authhttp.Mux checked the admin prefix against route patterns as text when the server started, so a pattern with a host (example.com/admin/x), a wildcard (/{section}/users), or no trailing slash (/admin) could serve admin paths without the multi-factor rule. Every request whose cleaned path is under the prefix now needs a human with AssuranceMulti, whichever route serves it, and Mux.Check parses patterns the way ServeMux does.
  • The recovery hold could be escaped: undoing any recovery lifted it, and a session that had used a recovery code could undo another recovery. An attacker with two recovery codes could recover twice, add a passkey to the first session, and undo the second recovery from it. The hold now covers every sign-in or step-up with a recovery code inside it until that recovery is undone, and UndoRecovery refuses a session that used a recovery code. Listing recoveries also stopped after 1,000 events, so a burst of sign-ins could push a recovery out of reach of an undo; it now pages through the whole window.
  • authhttp.RequireNeed named a need without an Action after the raw request path when no ServeMux pattern matched. A client controls that path, so a rule set with auth.WithNeeds for one path could be dodged with another spelling of it, for example /repos//x. The route's own need still applied. Such needs are now named authhttp.UnnamedAction; a matched pattern still names them.
  • A session whose only factor is a recovery code no longer passes the checks for creating long-lived credentials or changing factors. Before, one stolen recovery code could create a personal access token that lasts up to 366 days, approve an OAuth grant or device, link an identity, change TOTP, remove a passkey, or make admin changes, even on an account with TOTP. These operations return ErrStrongerFactorRequired, which also matches ErrStepUpRequired, and record access_denied with the reason recovery_only; authadmin answers 403 stronger_factor_required. The session can still add a passkey and make new recovery codes, so recovery keeps working. Principal.RecoveryOnly and Principal.CheckStrong expose the rule.

CHANGELOG.md in the library repository is the source.