mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-28 16:06:22 +00:00
* feat: flag risky tokens in the tokens drawer and add a superadmin token review Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: load the whole token review at once and pin the risk rules in a test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: a job tag filter alone does not narrow a privileged token Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: flag the rights a token carries, not the rights of its owner Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: flag tokens that work in every workspace and filter the review by flag Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * perf: compute token risks in a view and page the review with a cursor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: trust only reserved labels or short lifetimes as server-managed, keep the review cursor on raw rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: leave a day of clock skew on the server-managed token lifetime Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: make the instance-wide token list and deletion an EE feature Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep the token list EE in the CE image, which builds private Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: update ee-repo-ref to b3c5cbb7edcc42f3db92865896d472cdd8842cf9 This commit updates the EE repository reference after PR #1020 was merged in windmill-ee-private. Previous ee-repo-ref: 51a2425e60989d727d40330bdfa7b2d302224c9c New ee-repo-ref: b3c5cbb7edcc42f3db92865896d472cdd8842cf9 Automated by sync-ee-ref workflow. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: windmill-internal-app[bot] <windmill-internal-app[bot]@users.noreply.github.com>
29 KiB
29 KiB
Auth surface: facts that are easy to get wrong
Symbols, not line numbers, are cited: they drift less.
- Credential precedence (
windmill-api-auth/src/auth.rsextract_token):Authorization: Bearer→tokencookie →?token=query param. A URL with?token=is a credential on every route, but an existing cookie silently wins over it. AUTH_CACHEcaches a token's identity for 120 s. Deleting a token row purges it only for some rows: the delete trigger (notify_token_invalidation, last replaced inmigrations/20261106141303_mcp_oauth_token_delete_revokes_grant.up.sql) notifies every instance forsessionandmcp-oauth-*rows, within the notify poll (≤10 s), anddelete_tokenalso evicts at once on the instance serving it. Other labels deleted by other paths stay cached until the TTL, which ignores the token's own expiration.- Deleting a live MCP OAuth access token revokes its refresh grant, by whatever path: the same
trigger marks the
mcp_oauth_refresh_tokenrow issued with it (access_token_hash) revoked, so only that client's connection ends. A token past its expiration keeps its grant, since the expiry sweep deletes it and its client must still refresh. A client idle past its access token's 7 days therefore has no row left to delete: what ends a user's access callsrevoke_mcp_oauth_grants(windmill-api-users), which also deletes grants without a live token and codes not yet exchanged — a password change or reset, disabling or deleting the account, leaving the instance, offboarding, SCIM deactivation and removal, and (for the grants bound to that workspace) removal from a workspace. The grant lock (lock_mcp_oauth_grants) is the user'spasswordrow, shared while issuing a grant and exclusive while revoking, because every path that changes a user locks that row before their tokens: a refresh takes it, then its access-token row, then its grant, the order the trigger also follows. A new path that writes a user's tokens and may revoke must lock that row first too.leave_workspacedeletes no tokens and revokes nothing;leave_instancedeletes every token of the account, asdelete_userdoes. - Two-factor (TOTP) guards
POST /auth/loginonly (windmill-api-users/src/totp_ee.rs, with a stub intotp_oss.rs; a build withoutenterpriseallows it for one user). The password is checked first, so "Two-factor code required" tells only someone who knows the password that a code is needed. Every other way into a session skips it on purpose: OAuth and SAML (the provider owns the second factor), login links (minted by a superadmin, who can reset the second factor anyway, and never for a superadmin or devops account), andGET /users/refresh_token(a session already exists). Authenticator codes are single-use (totp_last_step), and so are the ten recovery codes, stored as salted argon2 hashes (a code carries about 52 bits, too few for a plain digest) and are accepted wherever a code is. Wrong codes are capped per account at 5 a minute on thepasswordrow, so the cap holds across servers; the caller commits the count even when it refuses the code. Without that cap, a known password leaves a 6-digit code as the only barrier. Enrolling (setup) asks for the password again, so a stolen session cannot add its own authenticator and lock the owner out of password login. A superadmin removes a lost second factor withPOST /users/totp/reset/{user}. The secret is encrypted under theadminsworkspace key, and rotating that key re-encrypts it (set_encryption_key); a secret left under an old key locks its user out. The global user export leaves it out, as its files end up in git: an overwrite keeps the second factor of every account it reinstates, and a push to another instance arrives without one. - Sessions are
tokenrows withlabel='session'plus the HttpOnlytokencookie, minted only bycreate_session_token(windmill-api-users/src/users.rs).GET /api/users/refresh_tokenmints one for any non-job token but returns plain text, no redirect. - The readable
wm_sessioncookie is a hint of the session (a salted hash of the token, so it grants nothing), mirrored onto every response that sets or clearstoken, by middleware (windmill-api/src/session_hint.rs) rather than at each cookie site, so a new site gets it for free. The frontend renders a reload as the userwhoamilast confirmed only while the hint still matches the one stored with them (frontend/src/lib/lastSession.ts): logout, expiry or another login changes or drops it. A session revoked server-side keeps its hint, so untilwhoamianswers that browser still renders as its own last user. tokens/impersonate(superadmin) returns a multi-use token and sets no cookie.- Token risk flags (rights the token was minted with and no scope narrows, not bound to a
workspace, no expiration, unused 90 days) are computed once, by the
token_riskview, which also marks the tokens the server expires or renews on its own (self_managed, no flags). The user'stokens/listandtokens/risk_countsand the superadmin review read it: its counts (tokens/risk_counts_as_super_admin) in CE, its list (tokens/list_as_super_admin, cursor-paged on(last_used_at, token_prefix)) andtokens/delete_as_super_admin/{email}/{prefix}in EE (users_ee.rs);frontend/src/lib/components/settings/tokenRisks.tsonly words the flags. GET /api/tokens/introspectdescribes the credential presenting it, never one named in the request, and resolves it in the handler rather than throughApiAuthed: the route layer would refuse a scoped token there, and a workspace-bound one resolves on no global route. Its route verdict ischeck_route_layer(windmill-api-auth/src/auth.rs), the function the auth extractor runs, plus the runnable scope of the run-by-path endpoints (run_by_path_scope); a handler that checks a scope of its own and is missing there gets an over-reported "allowed".max_token_expiration_dayscapsPOST /users/tokens/createandtokens/impersonate, by shortening the stored expiration (cap_token_expiration), never by refusing:wmill user create-tokenand the editor's language-server token pick a lifetime without reading the setting, and CLIs already installed never will. The CLI authorization page (/user/cli) reads it only to offer the lifetimes that would be kept (30 days by default). The CLI signs in again on its own when its token expires, which is why the authorization page labels itcli-login:<username>, reserved inis_user_tokenso its expiry does not email the user.wmill workspace loginreplaces a profile's token before it expires, and revokes the previous one only when that label shows the browser login minted it. A token owned by a service account is exempt: one in the workspace the token names, or in any workspace for a workspace-less token (fortokens/impersonate, the impersonated account). Any workspace admin can therefore create and impersonate a service account to hold an uncapped token, so the ceiling bounds personal tokens only. Only the stored expiration is capped: the auth lookup never reads the setting, so tokens that exist when it is turned on or lowered keep theirs, including none. Deliberately outside it: server-side mints (create_token_internalcallers such as native trigger webhook tokens, which never expire for GitHub and Nextcloud), and tokens with their own fixed lifetime that outlive a short ceiling: sessions (MAX_SESSION_VALIDITY_SECONDS, 3 days, and re-mintable throughGET /users/refresh_token) and MCP OAuth access tokens (7 days, with a rotating 30-day refresh token). Any logged-in user can read the setting throughGET /settings/global/{key}, which the token form uses to offer only expirations within it. The settings API and config sync reject any valueparse_max_token_expiration_dayscannot read, since the token routes would read it as no ceiling;parseMaxTokenExpirationDaysin the frontend must accept exactly the same values.- A token's label decides whether its expiry raises alerts. When
delete_expired_itemsremoves an expiredtokenrow, the monitor emails the owner and raises a critical alert (if enabled); rows registered byregister_token_expiry_notificationalso get an "expiring soon" warning first, except a token whose whole lifetime fits inTOKEN_EXPIRY_WARNING_DAYS(7), which gets no row since the warning would arrive minutes after it was created. Neither happens whenis_user_token(windmill-common/src/auth.rs) reserves the label, so a token the system mints for itself, whether from the backend or from the frontend throughtokens/create, needs a reserved label. Anephemeral-prefix needs no other change (keep it clear ofis_server_minted_labelif minted throughtokens/create); a new prefix also goes into the SQL and Svelte mirrors that function's doc lists. - A token carries its owner's superadmin and workspace admin rights only when minted with
them (
token.super_admin,token.admin).super_adminlets a token into a workspace its owner is not a member of and makes a workspace-less MCP token list every workspace; on any row but a session it also decides the superadmin routes, which otherwise key off the account's email: the auth lookup setsApiAuthed::super_admin_withheld, read byrequire_super_admin,is_super_admin_authedandrequire_devops_role, andadmin = falsecapsis_adminthere (admin_withheld, also read by the cross-workspaceusr.is_adminchecks).POST /users/tokens/createandtokens/impersonatewithhold both unless the request sets them;create_token_internalcalled directly (server-side mints) inherits them from the owner, except for an MCP token's superadmin. Either way a token never gets rights the minting credential withholds, andGET /users/refresh_tokenrefuses one that withholds rights the account holds, since a session carries them all. A job started by such a token runs with its cappedis_admin(and a$WM_TOKENcannot reachtokens/create); but what the token deploys or schedules runs later as its owner (fetch_authed_from_permissioned_as), with every right of the account, as with scoped tokens. Losing superadmin follows the owner without help from the caller: the deferred triggerpassword_superadmin_demote_tokensclears the column on every token of an address that, at commit, no longer has a superadminpasswordrow (demotion, deletion, an import's delete-and-reinsert), and evicts each throughnotify_token_invalidation. An email change does not fire it, since SCIM's rename leaves the tokens under the old address. A promotion grants it to no existing token. The MCP OAuth approve stores thesuper_adminrequest on its code and refresh rows, and each exchange re-checkspassword. A new path minting a token must ask the same questions, or it reaches a different set of workspaces than the others. - Editing a token widens it only as far as the caller could mint it
(
tokens/update_scopes,tokens/update_limitsfor expiration andallowed_ips). Narrowing is always allowed; a change that widens any of them (scopes outside the stored ones, a later or removed expiration, networks outside the stored list or none) must leave a tokenensure_grant_within_calleraccepts: scopes within the caller's, no superadmin unless the caller is unscoped and carries it, no admin the caller withholds, networks within the caller's. A later expiration goes throughcap_token_expiration, and changing it re-registers the expiry warning. Only user tokens (is_user_token) take limit edits, and only they or an MCP OAuth sign-in widen scopes: a system token is minted narrow for wherever it is handed. Every job token is refused, since$WM_TOKENis unscoped and narrowing breaks whatever holds the token. - A token's history replays from the audit log.
users.token.createandusers.impersonaterecord everything the row holds (TokenAuditGrant), and each edit records its fields before and after (update_limitsalso which fields were asked for, and the requested expiration when the ceiling shortened it). A new token path or column must keep both, or the chain breaks. Not audited: the superadmin-demotion trigger, the expired-token sweep, and refused edits. - Every superadmin route refuses a job token:
require_super_admin(windmill-api-auth/src/lib.rs) errors onauthed.job_id.is_some(). A script that needsusers/create,tokens/impersonate,set_login_type, … must use a dedicated superadmin user token stored as a secret, never$WM_TOKEN. Token scopes cannot narrow superadmin routes. - Write access to a folder steers its readers' AI chat. An
ai_instructionresource's body is delivered to the global chat of everyone who can read the resource, with no opt-in, whenever the chat touches a path under its folder (copilot/chat/folderInstructions.ts); the chat then acts with that reader's permissions, outside the folder too.ai_skillbodies are likewise in play for every reader until turned off. Anai_review_instructionsteers the AI review of every deployment request touching its folder, for anyone who can read it in the parent workspace (deploymentRequest/aiReview.ts); a fork's own copy is never read. The prompt tells the model to keep reporting secrets and unintended deletions whatever they say, but that is a request to the model, not enforcement: an instruction body can still talk it out of them. The resource ACL is the only control, so granting write on a folder grants that influence. - Restricted job tokens (
job_token_scopeson scripts and flows): a job's effective scopes are stored on itsjob_permsrow at push and minted into its token (create_token_for_owner); an empty set is minted asNO_API_ACCESS_SCOPE, sincescopes: Some([])reads as unscoped. Everypushtakes ascope_ceiling, and the job gets the ceiling ∩ the target's own setting: flow steps take their flow job's, agent tools their agent's, WAC children their parent's, retries the run they replace, and API pushes the calling job's (caller_scope_ceiling) — a scoped user or webhook token caps nothing. The row is swept once a job leaves the queue, so a restart of a completed flow takes the flow's current setting. Schedules, triggers and error/success handlers start from the target's own setting. A restricted token keeps only the runtime routes about its own job (is_own_job_runtime_route) and the reads of its own flow run (flow_run_read_route_job, checked against its lineage: the orchestrator evaluates a step'sresults.xwith the token of the step that just finished). That lineage is trusted, so a restricted job token, even an admin's, can only place a job it starts in its own run (unclaimable_run_lineage); a route that authenticates a token itself instead of through the route layer must callcheck_job_token_scope. A restricted job never runs on a dedicated worker, which uses its own unscoped token for every job.$var:/$res:args are resolved through the API with the job's own token, so they need read scopes. A deploy that omits the setting keeps the deployed value andnullclears it, so an unaware client cannot drop a restriction; setting one is refused until every worker supports it, since an older worker mints without it. The OIDCjob_token_scopesclaim is the presented token's scopes, not the runnable's setting, so a verifier sees what the job could reach and a token minted without the restriction shows as unrestricted. The setting belongs to the deployed version: an older script hash run by hash runs with that version's setting (a restricted caller still caps it). Write scopes on scripts, flows, schedules or triggers let a job escape its restriction. - A remote deploy token is a credential for another instance, held per account and workspace
(
remote_deploy_token, encrypted under the workspace key, re-keyed byset_encryption_key). Itsemailreferencespassword(email)withON DELETE/UPDATE CASCADE, so whatever deletes or renames an account takes the token along and a recycled address cannot inherit it; removal from a workspace deletes it explicitly (delete_workspace_user_internal, bothleave_workspace). The row records the target it was granted for, andremote_deploy::proxyonly sends it to a target still matching the workspace setting, so re-pointing the setting cannot redirect anyone's token to a URL of the admin's choosing.require_own_credentialsrefuses job, scoped and read-only tokens (onset_targettoo): the stored token carries none of their restrictions. The proxy turns the local session into a remote bearer credential, so every ambient-cookie vector becomes one on the remote: its URL carries the row's randomproxy_key(a link riding theSameSite=Laxcookie cannot know it; a header would do, but the frontend's only per-call hook is the globalOpenAPI.HEADERS, whose mere presence switches every download to in-memory blobs). The key is servedno-store, withheld from the credentialsrequire_own_credentialsrefuses, and masked in this instance's own request logs (RedactedUri, used by the request span and the log context); a reverse proxy in front still writes the full path to its access log.connectnames the target the token was obtained for and is refused, before the token is sent anywhere, if the workspace now points elsewhere; the token only ever goes to that target. It takes no lock against what clears these rows (a removal from the workspace, a target change, a key rotation): their writers take the account, membership, key and settings rows in every order, so any lock held there could close a deadlock. A row can therefore land after one of them ran, however long its remote call took, and every read (load_connection) voids it instead, by identity rather than by comparing times: the connect records, before its remote call, the target setting's version (remote_deploy_target_changed_at) and thecreated_atof the owner's membership, and the row counts only while both are still the same (or the owner is a superadmin) and it decrypts. So a target set A → B → A, or a removal and re-add, voids it whatever the clocks say. A superadmin with no membership is bound through the credential making the request instead: the insert requires itstokenrow to still exist, anddelete_user,leave_instance, offboarding and SCIM removal delete an account's tokens, so an address deleted that way and re-created during the call does not inherit the connection (a JWT, having no row, cannot connect a workspace its owner is not a member of). A member's connect across an account re-creation is not covered: an address is not expected to pass to another person. A disconnect empties and stamps the row (inserting one if needed) rather than deleting it,connected_atis when a connect started, and the connect's upsert leaves a row stamped after that alone, so an older connect cannot undo a disconnect or a newer connect. Connecting by redirect: the remote's/user/remote_deploy_authorizepage mints a token bound to the one remote workspace (remote-deploy:<source host>, a label reserved inis_user_tokenso its expiry emails nobody) only on an explicit Authorize, only for a callback whose path is/remote_deploy/callback, and refuses to render inside a frame; the token travels in the fragment, and the callback checks a single-usestatethe drawer stored, so no other page can plant a token as the user's. The proxy also refuses a path the URL parser would rewrite, serves every response underCSP: sandbox+nosniff, forwards only the method, query, body, content-type and accept — never this instance's cookie or token — and turns the target's 401 into a 502, because the browser logs the user out of this instance on an unhandled 401. login_type(passwordtable) is a free-formVARCHAR(50). Password login and password reset requirelogin_type = 'password';set_passwordalso acceptspending_oauthand turns the account into apasswordone in the same statement (an account created ahead of its owner gets its first credential that way, or through the OAuth claim below).RequireSsoprotection rule (workspace-level,check_new_member_sso/check_password_login_allowedinwindmill-common/src/workspaces.rs): apasswordaccount held by it (not a service account, not a bypasser by username or group, admins included) cannot join the workspace, and no member it holds can become apasswordaccount. It gates both transitions, never sign-in: password members already in the workspace keep logging in, which only the instance'sdisable_password_loginstops. A new path that seats a member or writeslogin_type = 'password'(or a password on apending_oauthaccount) must call the matching check in the transaction that writes. The two checks take no lock, so a join and a password switch of the same account at the same instant can both pass; the automatic joins (domain auto-add and auto-invite, instance groups) skip the user instead of failing, and a git sync pull into a fork fails rather than seat a held sync identity. The superadmin instance import (POST /users/overwrite) restores accounts as given, unchecked.- Login links (
login_linktable,POST /users/login_linkssuperadmin-only,GET /auth/login_link/{token}unauthenticated): single-use, ≤15 min, a session cookie and a 302 to a same-originrd.require_login_typeon the mint refuses (409) an account whoselogin_typehas moved on — the way a caller re-entering an account it created stops being able to once the owner has a password or a provider. - Pre-approved trial offer (
cloud_trial_offer, cloud-only routes under/users/cloud_trial_offer): written by a superadmin at provisioning, consumed by{consumed: true}or by the portal's refusal;…/gois the one Windmill→portal hop that mints a portal login, over the sameCUSTOMER_SERVICE_TOKENtrust the onboarding hook uses (users_ee.rs, the portal's admin token). It never expires on its own. - OAuth login (
oauth2_ee.rslogin_externally, decision inexisting_login_decision) matches an existing account by lowercased email only. Same provider → login; apending_oauthaccount (seePENDING_OAUTH_LOGIN_TYPE) is claimed by the first login whose address the provider itself asserted and did not mark unverified —login_typebecomes the client key and the hash is nulled; otherwiserequire_preexisting_user_for_oauthdecides: on, every existing account is loggable-into by any provider; off, "exists but with a different login type". A new account getslogin_type = <client key>. - OAuth email trust:
LoginUserInfo.email_verifiedis read leniently (bool or "true"/"false" strings) and is only consulted for the claim above; only GitHub is filtered toprimary && verified; a missing email is fabricated fromnameas<name>@windmill.devand reacheslogin_externallywithemail_asserted = false. - SSO claim names (
sso_email_claim,sso_username_claim, instance-wide, OIDC and SAML alike): a configured claim absent from a login falls back to the protocol default (OIDCemailand the chain above, SAML NameID;preferred_username/ the SAML username list), so one setting serves providers that name it differently. A configured email claim counts as asserted and can claim apending_oauthaccount, so it must name an attribute users cannot edit at the IdP;email_verifiedis only read when the claim isemail(the MCP external IdP instead refuses any token marked unverified, whatever its email claim: it never creates or claims an account, so the stricter rule costs nothing there). GitHub and Nextcloud keep their own email source. Accounts stay keyed by email: the username claim only names an account at creation, and an email change at the IdP signs in as a different account. - MCP access tokens from an external issuer (
mcp_external_idp, EE,mcp/external_idp.rs): taken only for a JWT whose unverifiedissis the configured issuer, then verified against its discovery JWKS. With no audience configured, only a token typed as an access token (at+jwtheader, or aBearertypclaim) is taken, so a client's ID token cannot stand in for one; an instance-deactivated account (password.disabled) is refused, since this path has no Windmill token for deactivation to revoke. The token's client claim (azpby default) must name a configured client, and its email claim an existing, enabled member of that client's workspace: no account is created, and a client-credentials token (no user) is refused with 403. Whensso_groups_claimis set, the instance groups with anexternal_idcome from that claim of the token alone, for that request only (nested paths counting for their ancestors): nothing is written, unlike an SSO login, and an absent claim means no IdP groups, so removing a user from every group revokes at the next token. Roles (admin, superadmin, operator) are not derived from the token: they stay as stored, which SCIM and SSO login keep current. Entra's overage pointer (_claim_names) is refused rather than read as no groups. The resolved identity is cached per token for at most a minute. Runs record the client injob_perms.mcp_client(and the job-start audit entry), from the pushing identity rather thanjob_authed, so a run on behalf of another identity still names it; the session toolset reaches the API through a JWT minted for the caller, which carries the client in itsmcp_clientclaim for the same reason, and so does a job'sWM_TOKEN. GET /api/oauth/login/{client}is an unauthenticated 302 to the provider — a plain link from any page starts SSO.CLOUD_HOSTEDis presence-tested (windmill-common/src/worker.rs):CLOUD_HOSTED=falsestill enables cloud mode. Of the routes above only the cloud trial offer and onboarding profile routes are cloud-gated; for the rest, cloud only adds quotas.CREATE_WORKSPACE_REQUIRE_SUPERADMINdefaults totruewhen unset; only the literal"true"enables it when set.- The client IP (
windmill-common/src/client_ip.rs, theClientIpextractor) is the TCP peer unless that peer is inTRUSTED_PROXIES(comma-separated CIDRs; unset means loopback, plus the private ranges on cloud; empty ornonetrusts nothing). Audit entries record the same address (request_origin.rscalls it), so a login refusal and its audit row agree. A self-hosted instance behind a reverse proxy on a private address must list that proxy, or the proxy is every request's client: trusting private ranges by default would let anyone on the network in front name any address. Behind a trusted peer,X-Forwarded-Foris read from the right up to the first untrusted hop, or, withCLIENT_IP_HEADERset, only that header (CloudFront-Viewer-Address,CF-Connecting-IP, an nginxX-Real-IP).X-Real-IPis never read implicitly: Caddy and most ingresses pass a client's own through. A CDN in front of the load balancer (CloudFront on app.windmill.dev) needsCLIENT_IP_HEADERor its ranges inTRUSTED_PROXIES, or its edge address is the client. On cloud, the private-range default also trusts job containers that can reach the server directly. Only the main API server carries the peer: a router called without connect info (tests, internal dispatch) seesNone, and per-IP decisions skip or refuse it. token.allowed_ipsis EE. A CE build drops a stored list when it loads the token, so it neither checks the list nor passes it on, and refuses a request that sets one. An EE build keeps enforcing stored lists when its license lapses; only setting a new one needs a valid license. The rest of this bullet describes an EE build. The column (cidr[],NULL= anywhere) restricts where a token row may be used.AuthCache::get_opt_job_authedtakes the request's client IP and refuses the token outside its networks, or when the IP is unknown, so every path that resolves a request's token passes that request'sClientIp(MCP's multi-workspace mode carries it inMcpToken). The list rides on the cachedApiAuthed, checked per request, never folded into the cache entry. A restricted token cannot lift its restriction: every mint from the caller's identity holds the new row within the caller's networks (the caller's list when none is asked for). That iscreate_token_internal(tokens/create, app SDK and embed tokens, native trigger webhook tokens, which then only work from those networks),tokens/impersonateand service-account impersonation.refresh_token, the MCP OAuth approve andlogin_linksrefuse a restricted caller, since what they lead to is a session with no restriction. Not inherited, by design: a job'sWM_TOKEN(a JWT; starting the job already passed the check) and JWTs the server mints for its own loopback calls.