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.Mountserves them. Read the docs: Drop-in screensEmail 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
mcpauthprotects 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 authorizationDevice-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, notgithub.com/tensile-tools/tensile-auth, and the tools module istensile.tools/auth/tools. Replace the old path in your imports and ingo.mod, then rungo get tensile.tools/auth@v0.3.0. Versions up to 0.2.2 used the old path. authroutes.Mountserves email and password sign-in by default, and panics unless exactly one ofConfig.PasswordsandConfig.PasskeyOnlyis set. To keep serving passkeys only, addPasskeyOnly: truetoauthroutes.Config. To serve passwords, create apassword.Passwordsand setConfig.Passwords.Service.DeviceBoundreturns(bool, error)instead ofbool, so a store failure is no longer read as "not bound".authroutes.Config.DisableDeviceBoundis removed. DBSC is opt-in: setConfig.DeviceBoundto turn it on.leakscan.Handleris no longer comparable with==, becauseleakscan.WithRevokeradded a function field.cachestoredroppedauth.FactorStore,auth.DeviceStore, andauth.TransferStore, and claimedauth.EmailStore,auth.IdentityStore,auth.SignupStore, andauth.SignupSettingsStoreeven 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/checkorauthhttp.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.Setupreported no factors, step-up challenges offered no methods, the password cap never applied, andPruneleft expired ceremonies and device codes. The store thatcachestore.Newreturns implements each optional interface exactly when the wrapped store does, andstoretest.RunWrapperchecks a wrapper for this. This is an incompatible change:cachestore.Storeis an interface instead of a struct, so writecachestore.Storewhere you wrote*cachestore.Store, and use a type assertion, such ascache.(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_FILEsecrets, with startup refusals andcheck; Postgres or SQLite with migrations; keys sealed under a master key, withkeys status,keys rotate, andkeys rewrap; the sign-in routes behind the app's proxy; app keys (tsx_); the/v1API withPOST /v1/check,/v1/meta, and/v1/openapi.json;/v1/events/stream; hooks and signed webhooks; the admin API; and the OAuth provider. The imageghcr.io/tensile-tools/tensile-auth-serveris distroless, runs as a non-root user, and is built forlinux/amd64andlinux/arm64. Seedocs/server.md.@tensile-tools/auth, the TypeScript SDK for apps that use the server, on npm:createTensilewithcheck,meta,users.get, andas(subject)for agents, delegation, approvals, and the session tree; a proxy for the browser routes; webhook verification andanswerHook; a cache built on/v1/events/stream(cache: true); and adapters for Next.js, Express, and Hono. Its types come fromserver/openapi.json. It names@tensile-tools/auth-clientas a peer dependency. Seedocs/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.Approvableholds a retry that sendsPrefer: wait=N(RFC 7240) until the person approves or denies, for at most 60 seconds, and runs the route once;auth.Service.RedeemApprovalWaitdoes 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).RequestApprovalreturns 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/checktakesPrefer: 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 answersapproval_pendingat once, a wait whose app disconnects writes nothing, and shutdown ends every wait withapproval_pending. - The SDK's
approvalWaitoption, 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, keepmaxDuration >= approvalWait + 5.approvablein the Express, Hono, and Next.js adapters takes{ wait }for one route, and ends the check when the agent disconnects.checktakesapproval.waitandsignal, and a waiting check's timeout is its wait plustimeoutMs. authhttp.WithApprovalWaitcaps how longApprovableholds a retry, and the wait the refusal offers;0turns waiting off.authhttp.PreferWaitreads a request'sPrefer: wait=N.auth.WithApprovalURLsets an absolute approval link, carried asApproval.URLand as the challenge'sapproval.url;authhttp.WithApprovalURLjoins a relative prefix to the firstWithOriginsorigin.ChallengeApproval.WaitHint(wait_hint) and the problem'sfixtell the agent to show the link and retry withPrefer: 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_hintis missing and thefixtells the agent to retry afterRetry-After.Need.ApprovalTTLsets 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.PendingApprovalsreads the last 24 hours.auth.WithApprovalNotifiercalls 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 payprints the approval's link and a terminal QR code and waits, and the MCP tooltask_mark_paidasks and waits in two calls.
- The elements: drop-in sign-in and account screens as framework-free Web Components, served by
authroutes.Mountunder/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 gainsapprovals,approval,approve,deny,sessions,revokeSession,signOutOthers,activity,recoverySignIns,undoRecovery,enrollTOTP,confirmTOTP,generateRecoveryCodes,confirmRecoveryCodes, andme. RevokeOwnfrom a session in recovery mode revokes only that session and what is delegated from it; for any other session it refuses withstronger_factor_required.authroutes.Mountserves the account routes the elements call:GET /approvals,GET /approvals/{id}, andPOST /approvals/{id}/begin,/finish, and/deny;GET /sessions,POST /sessions/{id}/revoke, andPOST /sessions/revoke-others;GET /activity; and, withConfig.Recovery,GET /recovery/sign-insandPOST /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 inEvent.Factor.- Email and password sign-in in the
passwordpackage, 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 answersfactor_rejectedand 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.Resourcesandauth.GrantSpec.Resourcebind a grant and every token under it to one resource (RFC 8707), reported asPrincipal.Resourceand asaudfrom introspection;authhttp.WithResourceaccepts tokens for a resource, whichauthhttp.Middlewareotherwise refuses. Every authorization response carriesiss(RFC 9207), and the metadata is also served at/.well-known/oauth-authorization-server.oauth.Config.CIMDaccepts client ID metadata documents, in allowlist mode by default, fetched through an SSRF-safe fetcher;oauth.Config.Registrationturns on dynamic client registration.AuthorizationRequestgains the client kind, its verified host, the redirect host, the resource, andWarnings, andService.RecordConsentrecords each approval. The SQL stores add aresourcecolumn (sqlitestoremigration 0018,pgstoremigration 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 theLocalandIntrospectionverifiers.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 unknownkidat most once a minute, requirediss,exp, and audience,nbfandiatwith a clock skew, an optionalat+jwtrequirement, andMaxAge. A key outage is a 503.Service.Connections,Service.RevokeConnection, andService.RecordToolCall, withmcpauth.AuditTo, andGET /v1/users/{user}/connectionsinauthadmin.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.BridgedandStartOptions.MaxAge,Principal.BridgedOnly,Need.Bridged, and the reasonbridged. A bridged session keeps the application's sign-in time and meets only needs that setBridged, whichoauth.NeedApproveandauth.NeedGrantdo;CreateAgentandDelegaterefuse 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.EndBridgeends it from the application's sign-out.authhttp.Middlewarenever accepts a bridged session.authexport, which writes every sign-in record of an install to one age-encrypted JSON Lines file withExport, and reads it into another store withImport, 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.OpenSecretandtotp.SealSecretopen and seal one secret for it. It adds the dependencyfilippo.io/age. See the design.auth.TransferStore, which exports every sign-in record in one read-only snapshot and imports records in one transaction, inmemstore,sqlitestore, andpgstore, withstoretest.RunTransfer.cachestoredoesn't implement it. The eventsexport_started,users_exported, andusers_imported.password.Config.AcceptBcryptverifies 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.CheckHashchecks a hash before an import stores it. See the export design.authexport.ReadAuth0,ReadClerk, andReadSupabaseread other products' export files into anauthexport.Plan, whichPlan.Importstores in one transaction. They keep the source's user ID, or mintusr_IDs withSourceOptions.MintIDsand write the mapping withPlan.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 withErrUnknownFieldat a column or field they don't know.authexport.SupabaseCopyis the statement that exports Supabase's users.tensile-auth-server import --from auth0,clerk, orsupabasereads those files into the install, with--usersfor Auth0's bulk user export,--mint-ids FILEto mint IDs and write the mapping before the users are stored,--dry-run, and--merge.authadmin.WithAlertSourceadds alerts from state outside the audit log toGET /v1/alerts, asauthadmin.Alertvalues. A source that fails, or returns an alert without a valid kind, severity, message, andFirstAt, fails the request with 503.- The server raises a
webhook_latealert inGET /admin/v1/alertswhile a webhook has failed for 15 minutes or more, and awebhook_skippedalert for events skipped after 72 hours, which it records asserver.webhook_skipped. - The
releaseworkflow, which on every version tag smoke-tests the server image, builds it forlinux/amd64andlinux/arm64with 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 publicghcr.io/tensile-tools/tensile-auth-serverpackage.just smoke-serverruns 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, andService.StepUpandService.Elevaterefuse password proofs withstronger_factor_required.auth.EmailStoreinmemstore,sqlitestore(migration 0017), andpgstore(migration 0018), passed through bycachestore, withstoretest.RunEmails.DeleteUserFactorsalso deletes the address and the password, and a first identity fails for a user with an address.CreateAgent,ClaimAgent, andDelegatefrom a human session refuse an account whose address is unconfirmed, withemail_unverified. Accounts without an address are unaffected.Attempt.Target,Runtime.AllowTarget, andratelimit.Rule.PerTargetlimit attempts against one address across every client, andratelimit.DefaultRuleshas rules for every password action.UndoRecoveryalso deletes a password or an address set after the recovery, andUndoResultreports both.federation.Federation.Unlinkcounts a usable password as another sign-in method.- The browser client gains
signInWithPassword,signUpWithPassword,confirmEmail,forgotPassword,resetPassword,stepUpWithPassword,changePassword,addPassword,removePassword,changeEmail,resendVerification, andpasswordStatus. auth.WithRecoveryGateholds every need atAssuranceMultiuntil the account has a second factor and a confirmed recovery path, with the refusal codesetup_incomplete.Service.Setupreports what an account has.recovery.Codes.Confirmchecks a typed-back code without spending it and recordsrecovery_codes_confirmed; a new set voids it.- The
presetpackage: four versioned presets,consumer@1,standard@1(the default),strict@1, andpasskey-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@1expansion.Preset.ASVSstates the level each reaches, the Level 2 requirements it misses, and its deviations;Describeprints the expansion;ShouldOffersays when to offer a passkey, a second factor, or recovery codes;strict@1andconsumer@1require 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-presetprints a preset's full settings, its ASVS level, what it misses, and its deviations:go run ./cmd/tensile-auth-preset strict@1, with-jsonfor the expansion and-allfor every preset.authroutes.Config.Presetchecks that the configuration matches a preset and addsGET /auth/setup, which answers what the account has and what to offer it now. WithRecoveryset,POST /auth/recovery/confirmtakes a typed-back recovery code. The README's quickstart usesstandard@1.- Device Bound Session Credentials (DBSC). With
authhttp.WithDeviceBoundandauthhttp.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: setauthroutes.Config.DeviceBound. Turning it off signs no one out:authhttp.WithDeviceBoundRetired, whichauthroutesuses 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.Configureadds middleware options afterNewMux. bench/agentbenchmeasures 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 thatTestSkillRecipeCompilesbuilds against the library, andllms.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. Rungo run ./examples/quickstartand open http://localhost:8080.- The compiled browser client ships in
client/distand is embedded in Go by packageclient;authroutesserves it under/auth/client/, revalidated on every load against a contentETag, so apps need no Node.just clientfails when the committed build is stale. Service.RequireAgentPartchecks an agent against the parts of a need that don't need a person, afterWithNeedstightened the need.Service.UnsealedAuditcounts the audit events that aren't sealed into the hash chain, whichVerifyAuditcan't cover, and returns when the oldest was recorded. The admin API's chain status reports them asunsealedandoldest_unsealed_at.authtest.PublicRouteslists aMux'sPublicroutes, 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 areturn_topath, instead of a 401 problem. It applies only to a GET or HEAD whoseAcceptheader preferstext/html.authhttp.SafeReturnToaccepts only a relative path on the same origin,auth.Runtime.ApprovalURLreturns the service's approval link, andMux.Checkrefuses 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; withsign-in-href, it also links to the sign-in page.<tensile-sign-in>and<tensile-sign-up>go to a safereturn_topath after sign-in, ahead ofredirect, and their links to each other carry it on.tensile-auth-server help COMMAND, and-help,-h, or--helpafter 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.Mountadds every route the browser client calls to anauthhttp.Muxin 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.NewUserandConfig.Scopesconnect it to the app's users.Service.PendingSignInandauthhttp.PendingSignInread a pending sign-in without using it up, for a second-factor page.- The client answers
needs_factorwhen an account needs TOTP, withverifyTOTPandsignInWithRecoveryCodeto finish. docs/guide.md, an integration guide from nothing to passkeys, recovery, TOTP, step-up, tokens, agents, and approvals, anddocs/errors.md, an error catalog thatTestErrorCatalogIsCurrentkeeps in step withDescribe.passkey.Passkeys.Renamerelabels one of a person's passkeys and records passkey_renamed;FactorStore.RenameCredentialsupports it in every store.passkey.User.Statecarries up to 4 KiB of app data, such as a display name from a sign-up form, from a registration's begin step toCredential.Stateat its finish, so apps need no pending map.- Dev tools:
auth.WithDevToolsturns onService.DevAgeandService.DevRecoverySession, andauthhttp.DevToolsserves them with the session state to the client'smountDevToolspanel, so step-up and recovery screens can be tried in seconds. They answer 404 when off, andMux.Checkrefuses them unless every origin is localhost. authhttp.WithFreshHeadersendsTensile-Auth-Fresh-UntilandTensile-Auth-Assurance; the client exposesfreshUntilandfetch(path, {stepUpFirst: true})steps up before the request instead of after a refusal.- The browser client,
@tensile-tools/auth-clientinclient/: passkey ceremonies with honest outcomes, one "Continue" entry point with immediate mediation, autofill that the other ceremonies cancel,fetchthat steps up on a challenge and retries once, Signal API sync, tab sync throughBroadcastChannel, capability detection, and non-extractable PRF keys. It has no dependencies;just clienttype-checks and tests it. passkey.Passkeys.AcceptedCredentialsanswers the client's Signal API sync.- Purpose-scoped elevation:
Service.Elevatesteps a session up for onePurpose(for exampleauth.For("secrets.edit", "repo:acme/api:prod")) without rotating it or making it generally fresh, and aNeedwith thatPurposepasses only through it, within 10 minutes by default.Service.Elevationreports when, for a labeled timer. Challenges for such needs carrypurpose. Elevations last at mostMaxElevation, 1 hour, and are recorded as session_elevated. - Action-bound approvals. An agent asks its human to approve one exact
ActionwithService.RequestApproval; the human reviews it withService.Approvaland approves with one passkey tap throughpasskey.Passkeys.BeginApprovalandFinishApproval, whose WebAuthn challenge isApprovalChallengeover the action's digest;Service.Approverecords theReceiptin the approval_granted event, andpasskey.Passkeys.VerifyReceiptchecks it later.Service.RedeemApprovalspends the approval once, only for the agent that asked and the same action.Service.Denyrefuses it. authhttp.Approvableturns an agent's refusal into a challenge withapproval(id,urlfromWithApprovalURL,summary,expires_in), and runs the route once when the agent retries with theTensile-Approvalheader.FactorStore.CeremonyByIDreads a ceremony without consuming it, in every store.- Agent claim previews:
Service.PeekClaimshows the unclaimed agent behind a claim code, with four pairing words, without spending the code. The agent prints the same words withPairingWords, so the person can check they're claiming the agent in front of them.SignupStore.AgentByClaimCodesupports it in every store. Service.CollectClaimWaitholds a collect open for up to 60 seconds and returns as soon as a person claims the agent.DelegateSpec.Namelabels a delegated token, for example "Claude Code, task 14"; it appears asSessionInfo.Name.- Safe hints after identification, through
auth.HintFactor: a TOTP code reused within its step returnscode_reusedwith the seconds until the next code and doesn't count toward the lockout; a locked TOTP factor returnsfactor_locked. A step-up with another account's passkey records the reasonwrong_accountin the audit log. Failures before sign-in stay identical. totp.TOTP.Statusreports whether a user has TOTP, and whether it is confirmed or locked.- Sessions people can read:
StartOptions.DeviceandStartOptions.UserAgent, whichauthhttp.SignInfills from the request withauthhttp.DeviceLabel("Chrome on macOS"), appear onSessionInfo.Service.SessionTreereturns live sessions as a tree of devices with the agents delegated from each. Every store has a migration for the new columns. authhttp.WithRotationrotates a browser session's token on the first request after an interval.Principal.IssuedAtandSessionInfo.RotatedAtsay when the current token was issued, andSwap.Atrecords it.- HTTP helpers:
authhttp.SignInstarts a sign-in and sets the session cookie, or a pending cookie when the account needs another factor;authhttp.CompleteSignIn,authhttp.StepUp, andauthhttp.SignOutfinish the rest without raw-token plumbing. authhttp.WithClientIPsets the client key from the connection, or fromX-Forwarded-Forthrough trusted proxies only, with IPv6 keys as /64 prefixes.authhttp.WithClientKeytakes a custom function.authhttp.Mux: every route declaresauthhttp.Publicorauthhttp.Need(...), andMux.Checkrefuses 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.Routescalls every route of aMuxas 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, andService.RevokeOthers("sign out other devices"), which checkNeedRevokeOwnorNeedRevokeOthers, record the caller as the actor, and answerErrNotFoundfor another account's session or agent.RevokeOthersrefuses recovery mode, so a stolen recovery code can't sign the person out of the devices that could undo the recovery.Service.ListSessionsfilters 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 markedHoldAfterRecovery: creating personal access tokens, OAuth grants and approvals, and agent claims. The refusal has the coderecovery_holdand aretry_after. - "That wasn't me":
Service.RecoverySignInslists recovery sign-ins from the last 72 hours, andService.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 recordsrecovery_undone. - Pending sign-ins:
Service.BeginSignInrecords a first proof and returns what else the account needs, andService.CompleteSignInstarts 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 afterPendingTTL, 5 minutes. recovery.Codes.Checkverifies a code without spending it. Its proof carries the code inProof.Reserved, and the service spends it only when a session starts or steps up, so leaving at the TOTP prompt keeps the code.FactorStore.RecoveryCodeOwnersupports it in every store.- Declared needs:
Need,Service.Require,Service.Meets, andWithNeeds. A need names an action and sets a minimumAssurance(none,recovering,single, ormulti), 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 asNeedCreatePAT,passkey.NeedRemove, andoauth.NeedApprove, andWithNeedscan tighten any need by its action but never loosen it.Principal.Assurancereports a session's level. Refusal, the errorRequirereturns. 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:
ProblemandDescribeturn every library error into RFC 9457 problem details with a stablecode, afixfor people,retry_after, and achallenge.NewErrorgives packages built on the library the same shape. authhttp.Error,authhttp.WriteProblem,authhttp.RequireNeed,authhttp.RequireHuman,authhttp.WithStepUpURL, andauthhttp.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, notgithub.com/tensile-tools/tensile-auth, and the tools module istensile.tools/auth/tools. Replace the old path in your imports and ingo.mod, then rungo get tensile.tools/auth@v0.3.0. Versions up to 0.2.2 used the old path. SignupPolicy.SessionIdledefaults to 24 hours orClaimWindow, whichever is shorter, so a claim window under 24 hours no longer fails validation unlessSessionIdleis also set.RegisterAgentstores an empty agent type asunknowninstead of refusing it.ratelimit.DefaultRuleshas anagent.registerrule: each client gets a burst of 5 sign-ups, then 5 an hour. It used the default of 10 a minute.- Breaking:
authroutes.Mountserves email and password sign-in by default, and panics unless exactly one ofConfig.PasswordsandConfig.PasskeyOnlyis set. To keep serving passkeys only, addPasskeyOnly: truetoauthroutes.Config. To serve passwords, create apassword.Passwordsand setConfig.Passwords. - Breaking:
Service.DeviceBoundreturns(bool, error)instead ofbool, so a store failure is no longer read as "not bound". - Breaking:
authroutes.Config.DisableDeviceBoundis removed. DBSC is opt-in: setConfig.DeviceBoundto turn it on. - Breaking:
leakscan.Handleris no longer comparable with==, becauseleakscan.WithRevokeradded a function field. approval_pending's fix tells the agent it can wait in one request withPrefer: wait=60, andhuman_requiredwith an approval tells it to show the link and retry with theTensile-ApprovalandPreferheaders.ratelimitjoins the parts of its counter keys with the ASCII unit separator instead of NUL, which PostgreSQL refuses in text, sopgstore.RateLimitsworks withratelimit.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.Codeis the typed code; the link code moves toMessage.Token, andMessage.Linkcarries it in a link toConfig.Linkswhen that is set.Message.ValidForsays how long the code works in plain words.ForgottakesForgotOptions{Binding}, andResetOptions.Bindinglets 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, whichauthroutesreads 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.CodePurposeandpassword.NeverSharegive the words every email shows next to a typed code. password.Config.CodeTTLis replaced byConfirmTTLandResetTTL. 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, renameCodeTTLtoResetTTL; leaveConfirmTTLunset for 24 hours, or set it to the old value to keep confirmations as short as before.emailcode.MaxTTLis 72 hours, andemailcode.MaxProofTTLis the 10-minute ceiling for reset codes.authrouteskeeps the sign-up binding cookie forConfirmTTLand sets a__Host-resetbinding cookie forResetTTLon forgot-password, so the browser that started can type the code.ratelimit.DefaultRuleslimitspassword.confirmandpassword.resetfor each device that types a code: a burst of 10, then 10 an hour.authroutesservesGET /auth/password/confirmandGET /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.Linksreturns them forpassword.Config.Links. Thecode_invalidproblem 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
factorListnames 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 oftsp_…, which personal access tokens use, so secret scanners and logs tell them apart. Service.RequestApprovalandService.RedeemApprovaltake the action'sNeed, andFactorStore.ConsumeCeremonytakes the kinds it may consume.totp.TOTP.Confirmreturns a TOTP proof, so finishing enrolment can also step the session up.Service.Meetstakes a context, because it also checks the recovery hold.authadminanswers every error as RFC 9457 problem details (application/problem+json) with the same codes as the core.fresh_session_requiredbecomesstep_up_required, and agents gethuman_required. Refused changes carry a challenge.WriteErrorwrites the same shape for routes added withWithRoutes.authhttpwrites every refusal asapplication/problem+jsoninstead of plain text. A step-up refusal also carries an RFC 9470insufficient_user_authenticationchallenge inWWW-Authenticate, and a throttled one aRetry-Afterheader.authhttp.RequireFreshrefuses a session whose only factor is a recovery code, and records agents asnot_humaninstead ofnot_fresh.- Sensitive operations return a
*Refusal. It matchesErrStepUpRequired,ErrStrongerFactorRequired, orErrScopeMissingas before, and is recorded asaccess_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 newGET /auth/totp/statusroute 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.MountservesGET /totp/statusandPOST /totp/removewithConfig.TOTP, for a human session and its own account only; removing needs a sign-in from the last 10 minutes. The browser client gainstotpStatus,removeTOTP, and theTOTPStatustype, and the element dispatchestwo-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 addsagent_id,agent_name,approved_by, andapproved_by_name, from migration002_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--helpprint 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:
cachestoredroppedauth.FactorStore,auth.DeviceStore, andauth.TransferStore, and claimedauth.EmailStore,auth.IdentityStore,auth.SignupStore, andauth.SignupSettingsStoreeven 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/checkorauthhttp.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.Setupreported no factors, step-up challenges offered no methods, the password cap never applied, andPruneleft expired ceremonies and device codes. The store thatcachestore.Newreturns implements each optional interface exactly when the wrapped store does, andstoretest.RunWrapperchecks a wrapper for this. This is an incompatible change:cachestore.Storeis an interface instead of a struct, so writecachestore.Storewhere you wrote*cachestore.Store, and use a type assertion, such ascache.(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
WithNeedsmarksHuman:RequestApproval,RedeemApproval, andauthhttp.ApprovableappliedWithNeedsagain after removing the parts only a person can meet, and gothuman_required. The agent meets the scopes and the recovery hold of the tightened need, and the approver meets all of it. Delegatewith a scope that the parent holds butAgentSpec.Scopesdoesn'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 matchesErrScopeExceededwith the codescope_exceeded.authhttprefused 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 andauthhttp.WithResource.authhttp.Middleware,authhttp.NewMux, andauthhttp.Bridgediscarded 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.Newerrors name the field and the fix, for example anRPIDwith a scheme, a port, or a path.authroutes.Mountpanics with a message for each case: noPasskeys, neitherPasswordsnorPasskeyOnly, or both.- Step-up, approvals, and
AcceptedCredentialsfailed onsqlitestoreandpgstorewith aNOT NULLconstraint error. They read the passkey user handle withFactorStore.UserHandle(ctx, user, nil), and the SQL stores tried to insert the nil handle before resolving the conflict. A nil handle only reads:UserHandlereturns the stored handle, orErrNotFoundwhen there is none, and stores nothing. ThestoretestcaseNilUserHandleOnlyReadscovers every store. - Passkey sign-up failed with
factor_invalidfor providers that return PRF outputs at registration, such as iCloud Keychain and some password managers, and for clients that serialize those outputs withJSON.stringify, which turns each into{}. Registration asks only whether PRF is available, soFinishRegistrationdrops the outputs unread. A sign-in still rejects PRF outputs. Registration rejections also name their cause:passkey.ReasonResponseUnreadablewhen the response isn't a WebAuthn response, andpasskey.ReasonNotVerifiedwhen the passkey was made without user verification. FactorStore.PutCeremonyoverwrote an existing ceremony inmemstorebut failed with a raw database error inpgstoreandsqlitestore, so elevating twice for the same purpose failed on those stores. Every store answersErrConflictfor an existing ID, andElevatereplaces an earlier elevation for the same purpose.- The client's
enter()failed in browsers that report immediate mediation ingetClientCapabilitiesbut reject the value; it falls back to the normal prompt. A prompt cancelled by a timeout signal reads asno_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).
govulncheckfound 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.WithSignInPageand the elements'return_tofollow 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-servernever readTensile-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 byTensile-Client-IPonly 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/checkwith arequest.client_ipthat isn't a single IP address counts against the app's address instead of a shared0.0.0.0.authhttp.ClientIPandauthhttp.ClientKeyexpose the rule thatWithClientIPuses, for aWithClientKeyfunction.passkey.Passkeys.VerifyReceiptchecked 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.FinishApprovalalready refused such an assertion.VerifyReceiptrequires 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
Bearerheader 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;RegistrationChallengeandRefreshChallengekeep separate namespaces, the first refusing a bound session and the second refusing anything but a current binding; and binding a bound session is refused. agentbenchstarted the app an agent built with the whole environment of the person running it, including API keys and tokens; let the agent run anygosubcommand, includinggo run; and pointed the agent at the live checkout. The app starts with a minimal environment, the agent may run only exactgo build,go vet,go mod tidy, andgofmtcommands, since a prefix such asgo 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;syncPasskeysalone tells password managers which passkeys exist. RedeemApprovalwasn'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.Elevatetrusted 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 returnsErrParentInactiveotherwise.- 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.
RequestApprovaltakes 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.ConsumeCeremonydeleted 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_accountbefore 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.Muxchecked 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 withAssuranceMulti, whichever route serves it, andMux.Checkparses patterns the wayServeMuxdoes.- 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
UndoRecoveryrefuses 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.RequireNeednamed a need without anActionafter the raw request path when noServeMuxpattern matched. A client controls that path, so a rule set withauth.WithNeedsfor 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 namedauthhttp.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 matchesErrStepUpRequired, and recordaccess_deniedwith the reasonrecovery_only;authadminanswers 403stronger_factor_required. The session can still add a passkey and make new recovery codes, so recovery keeps working.Principal.RecoveryOnlyandPrincipal.CheckStrongexpose the rule.
CHANGELOG.md in the library repository is the source.