Skip to content

Secure Token Service

Restricted credentials limit each eval or scan execution to approved model calls, input and output data, and runner infrastructure. A key mounted from a Kubernetes Secret authenticates JWT issuance and completion reports. Hawk stores its hash and an immutable grant. Middleman accepts the JWT for inference; Token Broker combines it with projected Kubernetes identity to issue scoped AWS sessions. Hawk's human-facing data APIs, including warehouse queries and presigning, reject restricted execution tokens; the one exception is POST /sources/index, a warehouse query scoped to the token's grant. Delegated tokens are accepted only on the allowlisted read routes. Restricted executions read and write their own output through brokered S3 and read source eval sets' logs and per-sample artifacts through the API's /sources routes (signed URLs).

POST /sources/index streams one row per readable sample as Arrow IPC (application/vnd.apache.arrow.stream): the sample's transcript id, sample id and epoch, its eval's id, eval set, log location, size and S3 ETag, and a few summary fields. Human tokens see the eval sets they may read; restricted tokens see their grant's sources. A body of {"eval_set_ids": [...]} narrows the result, and asking a restricted token for an eval set outside its grant is refused.

Credential mode

The operator's restricted_credentials_by_default AppConfig flag selects the default for hosted evals and scans; its packaged default is false (user credentials). Override the default per submission with --restricted-credentials or --user-credentials. API clients use credential_mode="restricted" or "user"; omission or null uses the server default. Explicit choices do not read AppConfig; an unavailable configured store returns 503 for an unspecified choice. Packaged defaults do not overwrite an existing AppConfig value. Registered human evaluations retain their existing route.

With explicit restricted mode, the CLI and Python client omit the user's refresh token from submission and resume requests, including grouped scans. The access token still authenticates the submission. User or omitted mode still forwards the refresh token because the server may select user credentials.

A resume must use the job's existing credential mode. If the server default differs, pass the matching flag. A different mode returns 409; use a new job ID to change modes. Deleting a job does not reset its mode. A reservation that has never committed a grant or attempted a launch may still use either mode. Switching the default does not convert existing jobs: user-mode jobs need --user-credentials to resume after the default becomes restricted.

With user credentials, nonempty eval transcripts.sources and any non-null access_groups (including []) return 422. Empty eval sources and omitted/null access groups are allowed; ordinary scan sources remain supported.

Deploy compatible issuer, Middleman, token broker and runner images before accepting restricted submissions. Middleman must resolve accounting attribution even for model-free restricted executions. Restricted launches and resumes require a configured token_service_issuer, nonempty token_broker_url (HAWK_API_TOKEN_BROKER_URL), and trusted HTTPS runner_token_service_api_url (HAWK_API_RUNNER_TOKEN_SERVICE_API_URL). The API URL must be a bare origin with a hostname, no credentials, query or fragment, and no path except an optional /. If token_service_issuer is absent, restricted launches and resumes return 422, "Restricted credentials aren't enabled on this deployment." With an issuer configured, a missing broker URL or a missing or invalid runner API origin returns 503, "Restricted launch is not configured". Pulumi normally supplies these URLs; custom deployments must configure them. These requirements do not apply to submissions using user credentials or registered human evaluations, except that every scan launch and resume needs runner_token_service_api_url: scan runners read their sources through /sources. Without it, scans return 503, "Scan launch is not configured". User-credential scans accept any absolute URL: Pulumi supplies an http:// origin on HTTP-only (hawk:skipTlsCerts) stacks, and local development can use http://api:8080. Custom images and execution virtualenvs must contain the updated Hawk package, its hawk_credentials entry point and hawk.runner.restricted_startup module. Updating an image does not update already-running workers.

Restricted Token Broker requests always require a valid projected Kubernetes token as well as the restricted JWT. Configure the broker's projected-token issuer, audience, and verification keys before enabling restricted launches. The requireJobToken / REQUIRE_JOB_TOKEN setting controls enforcement on the legacy broker path; it does not disable verification for restricted requests. Changing enforcement does not revoke already-issued AWS sessions.

See the credential-testing guide for local coverage and live validation.

Online scan: configuration is rejected in restricted mode; submit a standalone scan. Tasks using Hawk's human-facing APIs must use declared inputs (read through /sources) and brokered S3 for their own output instead. Direct SDK token refresh and Scout's cross-pod resume-buffer persistence remain separate concerns.

New logical job IDs matching ex- plus exactly 32 lowercase hexadecimal digits are reserved, including IDs derived from names and explicit resumes. Other ex- names remain valid. Legacy Helm operations separately reject names that normalize to ex- plus 32 lowercase hexadecimal digits, including historical aliases. Restricted execution names are fresh on every launch; logs, status and metrics retain the logical job ID.

Provision database users before applying the normal migration chain.

Credentials and permitted access

Each restricted execution has one immutable grant with the SHA-256 hash of the complete mounted key. The key format is hawk_rc_v1.<grant UUID>.<secret>: a canonical lowercase UUID and 43 unpadded base64url characters encoding 32 random bytes, 91 ASCII bytes in total. The grant UUID is also the credential selector, OAuth client_id and JWT grant.grant_id. Plaintext keys never enter Helm values, saved configuration or the database.

Grant snapshots and signed payloads use schema version 1. The mounted key format is versioned independently. Never edit a saved grant to change its permissions or version. Permissions use sorted, deduplicated service:action@subset strings:

Atom Capability
middleman:call@models/<public-name> Invoke the exact approved public model name.
hawk:read@eval-sets/<id> Read the whole named eval set, including later files.
hawk:read@scan-runs/<id> Read this scan's own output.
hawk:write@eval-sets/<id> Write this eval execution's own output.
hawk:write@scan-runs/<id> Write this scan execution's own output.
hawk:use@runner Use execution-bound infrastructure capabilities.
s3:read@<storage-name> Read approved named external storage; evals only.

Unknown combinations, group selectors, wildcards and brace expansion are rejected. Resource names use urllib.parse.quote(name, safe="/"); decoding once and re-encoding must reproduce the spelling. Escaped characters are literal. Model names retain case; eval/scan IDs use existing validators. Storage names are 1–32 lowercase alphanumeric/hyphen characters from the deployment catalog, never literal buckets or paths. Callers cannot supply arbitrary atoms.

Models, attribution and output restrictions

At launch, Middleman authorizes each requested public model name against the submitter's current groups and returns its name and access group. Hawk captures those groups in the output restrictions and saves exact model-call atoms. Grants and JWTs contain no separate model-binding records or upstream target names. Model-free grants have no model-call atoms. Reading transcripts never approves model calls.

Public names are stable codenames and must not be reassigned to other models. Middleman allows a signed name while it exists in the registry and is not marked dead. It does not compare saved target, group or lab metadata. Declassification therefore does not interrupt an existing execution or weaken its saved output restrictions. Renewal copies the approved atoms; the 30-minute token lifetime does not recheck the submitter's access. An explicit resume gets fresh approval.

Submission resolves Inspect descriptors to public registry names while preserving the original runner configuration. none and none/none remain placeholders; other descriptors that resolve to a placeholder, such as openai/none, return 422. Use a different registry alias for a remote model.

Local hardcoded and mockllm providers need no remote invocation approval. Their named output classifications and inherited restrictions remain, and a configured remote default still needs approval. mockllm/... keeps its full identity. A remote descriptor such as openai/mockllm/model still needs remote approval. Local-only restricted executions still resolve submitter/team attribution; cross-lab validation uses the same shared policy for eval inputs and scans.

Every restricted submission and resume requires complete code inventory, source and named storage authorization, and Middleman attribution for the current submitting user. Resolution requires a user token and team attribution. Teams are the canonical list extracted under the authenticated provider's configuration. An empty list means no attributable teams under that configuration, including disabled extraction or a missing claim. Missing authentication returns 403, invalid or mismatched accounting identity 502, and resolver timeout 503, before launch writes.

Required usage_attribution holds the submitter's user_id and normalized teams, plus optional authenticated user_email; its user must match submitted_by. Missing/null attribution or teams is invalid. Renewal keeps this snapshot despite later ownership/team changes; a resume gets the new submitter's attribution while preserving output ownership. Accounting grants no permissions to the execution. Middleman's traffic-log user_id remains the signed execution subject; usage_user_id/usage_teams identify accounting and priority admission, and Hawk's /traffic API files the request under usage_user_id, so submitters can read their runs' model calls. The EMF display label uses an ASCII email when available, falling back to user ID, for both restricted and direct traffic. Authorization, accounting joins and priority flow identity continue to use IDs. The user's direct requests and executions share a priority flow within each priority class and quota group; restricted executions gain no user groups or admin rights.

transcripts.sources declares eval inputs for both evals and scans. All scan sources are candidates; after deduplication and excluding an eval's own output, there is no source count limit. Evals reject source filters; scan filters and limits select work, while authorization covers whole folders/files, including CoT. The runtime helper exposes source identities and directories in declaration order, including duplicates, before factories load and on resume. Scout's selected transcript files are carried separately and remain its scanning worklist. HAWK_TRANSCRIPT_SOURCES is metadata, never authority, and does not widen that worklist. Input bytes stay in S3.

A scan of every readable eval set (transcripts.all_readable) has a rule grant instead of a list. At launch the API records every eval set the launcher can read as the scan's sources in its code policy, so later code-rule changes reach the scan. It also sets the output floor to the union of their groups. The runner may read those recorded eval sets that the floor can still read, decided on each request and never while the scan's own inventory is pending. The checks are the same ones a launch makes: every eval visible in the warehouse, a complete code policy that allows the floor, and a .models.json asking for nothing outside it. There is no owner or admin exception, and the index re-checks every eval as it lists it. The scan inherits every recorded source's code groups, so it stays hidden while any of them is pending or deleted.

A scan of a selection (transcripts.selection, from hawk scan run --transcripts) uses the same rule grant over the eval sets its uuids belong to, recorded at launch under the rules lock; if the readable set changes first, the launch fails with 409. Launch and resume also check each source model name against Middleman, as an ordinary scan's launch and resume do, and the output needs those names' current groups too. A resume refuses (403) when a name fails, since the runner's reads check only stored groups. An eval set that stops being readable by its stored groups, mid-run or before a resume, is treated like a transcript that disappears: its transcripts are reported as transcript errors, which a later resume retries. The runner scans only the selected transcripts and fails if its index lacks one. The selection itself is an immutable S3 object bound to its owner by key prefix, and launch refuses any uuid that can't be scanned. The refusal is the same 404 whatever the cause, but not the same speed: a uuid in an eval set the caller can't read costs the launch a few more reads than an unknown one, so someone who already holds a uuid can tell that it exists.

With scanner_models, either scan is split into one scan per scanner model, and each of those has a recorded grant (kind: recorded) instead. It approves only its own scanner model and reads only the .eval logs recorded for it at launch, each pinned to its imported ETag with If-Match, and no sample artifacts; the same live checks apply to the eval sets holding them. A selection's scan scans only its share of the selected transcripts. A resume re-judges the recorded evals and keeps the recorded grant.

Saved filtered-scan configs without separate source metadata must be regenerated through an explicit resume.

The restricted eval example combines transcript sources and declared access groups. Replace its source ID, model and groups with values available in your deployment before running it.

Runners read inputs through the API, and every scan runner reads its sources this way, a user-credential one with the user's renewed token: /sources lists a folder's eval logs or one sample's artifacts and signs 15-minute S3 URLs for them, checked on every request. For a restricted execution the check is membership in the sources approved at launch (plus an eval set's own output); later changes to a source's .models.json, code policy or warehouse visibility don't revoke its reads. Its reads stop when the execution ends, though URLs already signed stay valid for up to 15 minutes. A user's token is checked against the user's read access. Grants carry no per-source read atoms, so broker sessions carry no slot_N tags. Older restricted grants without sources keep reading through S3 slot credentials until those executions finish.

Eval and scan inputs follow the shared cross-lab policy and operator-controlled override. These checks run before launch writes or resume cleanup. They are separate from inherited output restrictions; source-read access never grants model invocation.

The API must be able to read every requested source's stored classification. A database role subject to row-level security can approve sources that are fully visible to it. Sources with hidden classifications are refused even if the submitting user has broader access. Membership in rls_bypass is not a blanket requirement for restricted launches.

Output restrictions include invoked-model groups and source model/code groups. Omitted access_groups inherits the required union; explicit [] asserts that none are required. Declared groups must cover the union, including previous output restrictions, and may add restrictions. The submitter must be authorized for the full set of output restrictions, including extras, before saving the grant. Resume saves these prior restrictions before replacing code inventory, so a refused declaration cannot weaken existing outputs. Users reading outputs need the inherited model and code permissions; later policy changes do not rewrite grants. The snapshot stores effective groups, without per-input/declaration copies.

An input-folder approval lasts for that consumer execution, including credential renewal. It covers files written later under the same source eval-set ID, even if a new source execution adds model or code restrictions. New and resumed consumers must satisfy the current source restrictions. Successful eval submissions that add restrictions under an existing ID warn about these earlier approvals; use a new eval-set ID when the new results must be isolated from already approved consumers. The warning compares the prior output restrictions with the final approved model and code groups, including inherited and explicitly added restrictions.

Every eval resume reminds users to declare models called by code. A missing declaration requires a config update and another resume. Declarations do not change a monitor's failure policy; task owners must configure it separately.

Relay attachment requires write access to every output model group and code-access-<group> for every output code group, including inherited restrictions. The API copies the approved output floor to the Job and runner Pod's inspect-ai.metr.org/restricted-access-groups annotation. Restricted Pods with an execution-ID label and a missing or malformed floor cannot be attached to. Ordinary unlabelled user Pods retain their existing model-access checks.

Brokered data and inference

Every grant includes reads of its own output; evals and scans can additionally read their declared eval-set inputs. Read atoms include object reads and scoped listing; own-scan reads include tag reads needed for finalization. Writes require a separate atom for the exact own output and job type; a read-only grant never gains writes. Writes permit output replacement/deletion and scan finalization tagging, with denies on API-owned metadata. The runner profile supplies configured KMS, ECR, telemetry and existing task-secret namespace capabilities, not data reads/listing or new secret isolation. It is required for broker eligibility together with projected identity.

The broker derives policies from signed data/storage atoms. For user-credential scan runners from older Hawk versions, and older restricted grants without sources, it also uses every signed source eval set as a read slot. Scan runners send no eval_set_ids and restricted grants with sources get no source slots. Non-null request eval_set_ids lists, including [], are rejected for restricted executions. Evals can also use runner.storage_grants / runnerStorageGrants: approved names are intersected with the current deployment catalog. Restricted sessions do not reread .storage-grants.json; changing that file does not revoke their storage access. Removing a catalog entry excludes it from new sessions; resume obtains fresh approval. Sessions using user credentials retain the storage-gate and current-permission checks. With publicModelsOnly, the broker checks a restricted execution's own output at every session: it must hold only public model groups, though a verified scan can ignore the dynamic __unresolved__ marker on its own output so it can finish writing. It applies the same check, without that exemption, to every source an older grant without sources holds a read slot for. A grant with sources is checked once, at approval: the API narrows every token to public models on such a deployment, so only public-only sources are approved, and /sources reads check membership in that list, not the sources' current model groups. Other groups and immutable output floors are enforced as for every restricted session. Eval/scan base policies cover infrastructure and approved reads/listing; separate write policies require an own-output write atom. Secret and named-storage policies retain their own gates.

Middleman supports these restricted routes:

Route Restricted behavior
/anthropic/v1/messages, /anthropic/v1/messages/count_tokens Exact authorized model.
/openai/v1/chat/completions, /openai/v1/completions Exact authorized model.
/openai/v1/responses Exact authorized model; foreground/streaming only.
/openai/v1/responses/input_tokens, /openai/v1/responses/compact Exact authorized model.
/gemini/v1beta1/publishers/{publisher}/models/{model}:{operation} Generate/stream/count for exact authorized model.
/google-ai/{api_version}/models/{model}:{operation} Generate/stream/count for exact authorized model.
/openai/v1/models Only live models named by signed model-call atoms.
/permitted_models_info Delegated tokens only: details of the models they can call (below).

File uploads, legacy unified inference and other catalog/query/control/admin endpoints require user credentials. Batch and background follow-up routes are not exposed. Responses require background absent or literal JSON false, checked before provider work. Restricted requests reject Anthropic fallbacks and OpenAI-compatible chat/Responses models (OpenRouter model fallbacks), including empty or null values, before credential lookup or upstream dispatch. Inline media remains supported; Inspect's Google Files API workflow does not. There is no conversion or fallback to user credentials. Clients must send the current JWT. Expiry is checked at admission; an admitted stream can finish. The mounted key cannot authenticate inference.

Restricted requests may declare tools the caller executes and a reviewed set of provider-run tools. Tools that call a model no grant approves (Responses image_generation, Anthropic's advisor, OpenRouter plugins) or read data stored with the provider by reference (file search and retrieval stores, stored prompts, cached content, containers reused by ID, files or skills attached to a container) fail with 400 before credential lookup, on token-counting routes too. So do nested model selectors (Vertex routingConfig and modelConfig), Gemini extras on Vertex's OpenAI-compatible endpoint (extra_body or google, which can carry cached content and Gemini tools), remote MCP servers and types Middleman does not recognize, which stay unavailable until reviewed. Provider-run web search, web fetch, URL context and code execution in a new container are allowed: runners can reach the internet themselves, so these add no new outbound path. The per-provider allowlists live in restricted_tools.py.

Anthropic container IDs are accepted, because Inspect resumes its own container when web search with dynamic filtering or code execution pauses a turn. Like other provider object references in request content (OpenAI previous_response_id, conversation and file_id parts, Anthropic file sources, Gemini fileData URIs including Vertex gs:// paths), they are not yet bound to the execution that created them.

Delegated tokens

A delegated token is a restricted JWT that acts for a user with reduced access, so an agent or script can read part of the user's data or call models without the user's own login. Delegated sessions (below) mint them.

A delegated token is signed like execution tokens (same issuer, audience and keys), has subject delegated:<jti>, records the minter's sub and email, and carries its permissions: reads and model calls. Its reads are hawk:read@model-groups/<group> and hawk:read@code-groups/<name>, and it reads exactly what a read-only login holding those groups reads. On publicModelsOnly deployments its model groups are intersected with the public group. Its calls are described in Calling models with a delegated token. The read atoms and the group call atoms are the only permission atoms that name a group, and they are allowed only on delegated tokens; the group-selector ban above still applies to execution grants. Request logs and presigned-download events carry the minter's sub (minter_sub), never the token.

The API accepts delegated tokens only in the Authorization: Bearer header, never a cookie, and only on these routes; every other route returns 401:

  • GET /meta/eval-sets, /meta/jobs, /meta/evals, /meta/samples, /meta/samples/{uuid}
  • GET /view/logs/logs, /view/logs/log-download-url/{log}
  • POST /view/logs/log-download-urls

/sources and the token broker refuse them. Visibility is exactly that of a read-only user holding the token's model groups (as :read) and code groups. A mixed eval set (public and restricted models) is handled per route:

  • /meta/eval-sets, /meta/jobs and /view/logs/* are decided on the whole eval set. A mixed set is absent from eval-set and job listings, and its log listing and downloads are refused (403).
  • /meta/evals, /meta/samples and /meta/samples/{uuid} are decided per eval. A mixed set's public evals are listed and their metadata is readable; the restricted eval's samples return 403. The per-eval checks also enforce restrictions inherited from the whole job, so a restricted execution that mixed public and private models can hide even its public evals.

The subject is never an owner, so owner exceptions do not apply; list with hawk list jobs --all, since the default owner filter matches nothing.

The CLI uses any explicit HAWK_ACCESS_TOKEN as-is: it is never refreshed and never replaced from the keyring login. An expired one fails with "HAWK_ACCESS_TOKEN is set, and has expired", and one that is set but empty fails with "HAWK_ACCESS_TOKEN is set but empty" rather than falling back to your own login.

Delegated sessions

A delegated session is a server-side record (token_service.delegated_session) that lets a logged-in user fetch short-lived delegated tokens without handing out their own login. It has a scope, an owner and an end time 12 hours after creation. Each token lasts 30 minutes, clamped to the session end. Only OIDC logins can use the endpoints, under /token-service/sessions:

  • POST / creates a session and returns its first token. It returns 403 if the scope grants nothing the caller can read or call, 422 for a provider that serves no model the caller can read or call, and 429 if the caller already has 20 active sessions (laptop profiles and devboxes together).
  • POST /{session_id}/tokens returns a fresh token. It returns 404 for an unknown session or another caller's, 410 for an ended one, and 403 if the scope grants nothing the caller's current login can read or call. Creating a session and fetching a token count as uses.
  • GET / lists the caller's active sessions.
  • DELETE /{session_id} deletes a session; repeating it succeeds for the owner, and anyone else gets 404.

The scope sets the model groups the session reads and the models it calls. It is expanded when the session is created and again for every token, against the caller's current login and Middleman's current registry. A group is readable through an unsuffixed or :read grant, and callable through an unsuffixed or :execute grant:

  • {"kind": "public"} (hawk login --public) reads model-access-public and calls every model in it (middleman:call@model-groups/model-access-public).
  • {"kind": "provider", "provider": "<provider>"} (hawk login --provider <provider>) also reads every other group the caller can read whose models all pass the cross-lab rule for a reader served by <provider>. That reader holds no reader tags and isn't ZDR, so a group is left out if any of its models has a tags or zdr_only read policy, is served by another provider under the default policy, or has a provider Middleman doesn't know. Public models are exempt. Models that are no longer available still count, since their transcripts remain. Each read a non-default read policy opens writes the same audit line as for scans and search, with the session and token IDs, for every token issued. It calls the models served by <provider> (middleman:call@model-groups/<group>/providers/<provider>) in every group the caller can call, model-access-public included, that holds an available one. Calls ignore read policies and the group's other models: a <provider> model with a tags or zdr_only policy, or one in a group that also holds another provider's models, is callable although the session can't read that group's transcripts. Expanding asks Middleman for the caller's models, so creating a session or fetching a token fails with 503 while Middleman is unreachable.

Every token carries the reads and calls the scope expands to now, plus the login's current code groups (hawk:read@code-groups/<name> for each code-access-<name>). A group's read or call that the login loses, or that a registry change disqualifies (for a read, a model from another provider added or a read policy tightened; for a call, the group's last available <provider> model retired), is gone from the next token; one that newly qualifies, such as a new codename model's group once the login holds it, is added without a new hawk login. Registry changes reach new tokens within about 15 minutes (the API caches Middleman's model list for that long).

A token with calls also carries the minter's usage attribution, which the API asks Middleman for (/model_approvals/resolve) at creation and for every token, so usage is attributed as for the minter's own calls (see Calling models with a delegated token). If Middleman attributes it to anyone else, the request fails with 502 and no token is issued.

Deleting a session stops new tokens at once. CLI commands under a deleted session stop working within about 15 minutes; a key helper that caches tokens can keep using its last one until it expires, at most 30 minutes. A raw access token someone copied keeps working until it expires (at most 30 minutes, plus the verifier's 60 second leeway), and presigned URLs it obtained work for up to 15 minutes more. Session tokens last as long as execution tokens, so the key-rotation steps below do not change.

Devbox logins

A devbox login gives a machine, such as a devbox reached over SSH, a delegated session without the researcher's login ever being on it. The box asks; the researcher approves in the viewer.

  1. hawk login --provider <provider> (or --public) on the box generates a secret and sends its SHA-256, the scope and the hostname to POST /token-service/devbox/requests, which needs no login. It returns a user code (XXXX-XXXX), the link <viewer>/approve?code=<code> and a poll interval. A request lasts 10 minutes, and an address may have 10 pending at once (429 beyond that). The endpoint returns 503 unless the viewer URL (HAWK_API_VIEWER_URL) and the token service are configured.
  2. The box polls POST /token-service/devbox/requests/poll with Authorization: Bearer <secret> and gets pending, approved (with the session ID and end), denied or expired.
  3. The viewer page calls /token-service/devbox-approvals: GET /{code} previews the groups the box would read, the models it would call and the groups withheld, with why; POST /{code}/approve and POST /{code}/deny decide. Only OIDC logins can use these endpoints: delegated and execution tokens get 401, so nothing on a box can approve its own request. Unknown, expired and used codes get 404, and each code is approved or denied once.

Approving expands the scope against the approver's login, as creating a session does, and creates a session of kind devbox, owned by the approver, that ends 12 hours later (429 if the approver already has 20 active sessions). Unlike a laptop profile's session, it stores a snapshot of that expansion (the permission atoms, the withheld groups and the usage attribution) and the secret's digest. The box has no login to expand the scope against, so its tokens carry the snapshot, and a change to the approver's login or to a group's judgement reaches the box only at the next approval. The box's key is hawk_dk_v1.<session id>.<secret>. The box keeps it in the OS keyring (on a headless box, keyrings-alt's file backend, which hawk installs); the short-lived token cache stays in a private file.

To extend, the box sends POST /token-service/devbox/requests/extend with its key as Authorization: Bearer, which asks with the session's own scope (401 for a bad key, 410 for an ended session). Only the session's owner can preview, approve or deny it (403 otherwise). Approving expands the scope again against their current login, replaces the snapshot and moves the end to 12 hours from then.

Requests, approvals, extensions and denials are logged (devbox_login_requested, devbox_login_approved, devbox_login_extended, devbox_login_denied) with the request ID; these events never carry the secret, the key or the code. The access log does record the approval paths, which carry the code; a code is valid for at most 10 minutes. Creating a request deletes requests that expired over a day ago.

The box exchanges its key for 30-minute session tokens with POST /token-service/devbox/token (Authorization: Bearer <key>; 401 for a bad key, 410 for an ended session) and ends its own session with DELETE /token-service/devbox/session (204, logged as devbox_session_ended). The key's secret never appears in logs or Sentry events: the box paths are redacted like the other credential mounts.

Calling models with a delegated token

Middleman accepts a delegated token on its restricted routes only if it carries at least one call grant; one without any gets 401. A token may carry three kinds, and Middleman allows a call, and lists the model, when any of them matches:

  • middleman:call@models/<name>: the named model.
  • middleman:call@model-groups/<group>: every model in the group.
  • middleman:call@model-groups/<group>/providers/<provider>: the group's models served by <provider> (the provider Middleman records for the model, or its lab's default). A model with no recorded provider never matches.

GET /openai/v1/models lists those models, and POST /permitted_models_info (the token as api_key) lists their details, hiding a secret model's as it does for a login; hawk proxy setup-client uses it under a profile. That route refuses execution tokens and for_read, and /permitted_models stays human-only.

Provider grants keep a session scoped to one lab from calling another provider's models, public ones included, since a group such as model-access-public mixes providers. A model that is no longer available (dead) is never callable, whatever the grant. Calls run under exactly the restricted-route limits an execution token gets (the exact-model routes, the tool allowlists and the background/fallbacks rules above). So provider object references in request content are not bound to the token either (see Brokered data and inference). Usage, cost metrics, the traffic log's usage fields and the per-user priority round-robin are attributed to the minter, using the attribution the token carries, which must name the minter. The traffic log's requester is the token's delegated:<jti> subject, and the request channel is direct. Because hawk traffic lists only rows whose requester is the caller's own sub, these requests do not appear in the minter's hawk traffic view. Named grants are not re-checked against a model's group at call time, so they stay valid for the token's lifetime even if the model's group changes. Group and provider grants are matched against Middleman's current registry on every call: a model moved into the group becomes callable, and one moved out of it, or to another provider, stops being callable. On Anthropic routes Middleman takes the token as x-api-key or Authorization: Bearer.

Configure and rotate

Set hawk:tokenServiceEnabled to true to provision signing resources and configure token issuance. It defaults to false, including in development environments; development stacks do not inherit enablement from staging. Provisioning does not select restricted credentials for new launches. Without issuer configuration, token issuance and JWKS return 503 temporarily_unavailable. Completion and cleanup remain available and require the database.

Pulumi manages RSA-2048 SIGN_VERIFY KMS keys and aliases, with a 30-day deletion window. Only the API runtime role gets kms:Sign, scoped to the active ARN and RSASSA_PKCS1_V1_5_SHA_256. Provisioning exports public keys; requests need no kms:GetPublicKey, and Python never receives a private key.

Every generation's key policy also restricts signing to the API tasks role and that algorithm, including signing authorized through KMS grants. The API's IAM policy selects the active key. Account administrators retain policy-management and deployment permissions, including public-key reads, alias management and scheduled deletion. This protects against broad signing permissions; a trusted administrator can deliberately change the key policy. Key-policy changes require checking issuance, deployment administration and rotation before rollout.

Keys and aliases follow hawk:protectResources. Non-development stacks default to protected; development stacks are unprotected. The teardown procedure disables protection before destruction and removes the stack only after destruction succeeds.

Pulumi setting Default Constraint
hawk:tokenServiceEnabled false Provision signing resources and configure issuance. Development stacks must opt in locally.
hawk:tokenServiceSigningKeyGenerations [v1] Nonempty list of unique, nonempty generation names.
hawk:tokenServiceActiveSigningKeyGeneration v1 Must be published.
hawk:tokenServicePublishedSigningKeyGenerations All managed generations Optional nonempty, unique subset of managed generations.

All API replicas share HAWK_API_TOKEN_SERVICE_ISSUER with issuer, audience, jwks_uri, kms_key_arn, kid and jwks. For canonical <api-url>:

Field Value
issuer <api-url>/token-service
audience <api-url>/token-service/services
jwks_uri <api-url>/.well-known/jwks.json
kid Immutable KMS key UUID, never an alias.

Middleman's MIDDLEMAN_TOKEN_SERVICE_AUTH and broker's TOKEN_SERVICE_VALIDATION carry the same flat issuer/audience/jwks_uri object. There is one restricted audience; user OIDC and projected Kubernetes audiences are independent. Missing Middleman configuration permits only user credentials; malformed settings or an issuer also configured for user credentials fail startup.

Signing-key rotation and JWKS caches

Follow the deployment procedure, including logging in to the S3 Pulumi backend before Pulumi commands. Rotate in separate deployments:

  1. Publish a never-used generation such as v2 alongside v1, keeping v1 active. Verify every API replica publishes both keys.
  2. Wait at least five minutes after replicas agree before switching signers.
  3. Activate v2; verify old signers have stopped and old-key signing permission is removed. Keep the old public key published for at least one hour after the last old signer stops. IAM changes can precede rolling task replacement, causing transient 503s; clients retain valid JWTs and back off. An ECS rollback alone does not restore old signing permission: finish the rollout or revert the active generation and redeploy.
  4. Remove old public-key publication while retaining its managed key. To schedule deletion later, explicitly unprotect both key and alias if protection is enabled, then remove the managed generation; the key enters its 30-day deletion window.

Never reuse a generation or kid. Emergency removal requires stopping old signers and removing their public key from every replica; caches and issued capabilities mean this is not instant revocation.

Both consumers fetch only their configured JWKS URI, fetching keys on demand and caching parsed RSA keys locally per process/worker. They do not trust general shared Valkey, whose other writers could otherwise forge restricted identities. A successful fetch is fresh for 300 seconds; known keys can survive an outage until an absolute 3,600-second hard deadline. Cache hits extend neither deadline; a successful replacement removes keys missing from the new document. Unknown kid refreshes are throttled to once per 30 seconds per instance. A successful fetch proves absence, including during the cooldown while that document remains fresh. A failed refresh reports issuer unavailability for unknown keys even if an older document remains fresh; usable known keys retain the outage fallback. Fetches are limited to ten seconds and 64 KiB. Middleman returns provider-shaped 503s with Retry-After: 5 for issuer outages, not invalid-key errors.

Broker warm invocations reuse one event loop and verifier runtime. Replacing that runtime starts a fresh JWKS cache; cache entries and refresh throttling are not transferred between clients or loops.

Hawk formats the fixed RS256 restricted access token header and validated claims, then awaits KMS signing directly. KMS signs the SHA-256 digest of that exact input; Python never receives a private key. The signer checks the returned key ARN, signing algorithm and RSA-2048 signature length. Prelaunch and issuance size checks use the same serialization and fixed signature length. joserfc imports public keys and verifies JWT signatures and registered claims.

JWTs use RS256, typ: at+jwt, strict claims and configured issuer/audience, a maximum 8,192 encoded bytes, and 60 seconds of clock skew. The broker validates both JWT and projected token locally without reading execution lifecycle. It matches saved namespace/ServiceAccount names and checks projected signature, issuer, audience, expiry and subject. ServiceAccount UID and Pod name/UID claims must be nonempty strings; these are token-shape checks, not stored Hawk UID bindings.

Decommissioning

Disabling hawk:tokenServiceEnabled removes the signing resources, JWKS publication, and consumer validation configuration in the same deployment. There is no separate drain switch: changing the default for new launches does not prevent explicit --restricted-credentials launches. Coordinate a maintenance window with submitters, and leave the setting enabled until the final step.

  1. Confirm no restricted execution is live. Run this query as a database administrator with access to all execution and grant rows. It must return no rows; otherwise, let those executions finish or end them through Hawk before proceeding.
SELECT e.pk AS execution_id, e.job_pk, e.namespace_name, e.kubernetes_job_name
FROM public.job_execution AS e
JOIN token_service.execution_grant AS g ON g.execution_pk = e.pk
WHERE e.lifecycle_state = 'active';
  1. Wait the maximum token lifetime plus one hour. With the current 30-minute JWT lifetime, wait at least 90 minutes after confirming that no restricted execution is live. Keep issuance and verification enabled throughout the wait. If another restricted execution starts or resumes, repeat step 1 after it ends and restart the wait. Recheck before proceeding.
  2. Unprotect only the signing keys and aliases. Follow the deployment procedure to log in to the Pulumi backend. List the resources, then copy the key and alias URNs for every managed token-service signing generation, including retired generations. Replace the placeholders below with the target stack and those URNs:
pulumi stack --stack '<stack>' --show-urns
pulumi state unprotect --stack '<stack>' '<signing-key-urn>'
pulumi state unprotect --stack '<stack>' '<signing-alias-urn>'

Repeat the unprotect commands for each generation. Do not set hawk:protectResources=false or use --all: that would also unprotect unrelated resources such as RDS and S3. Do not deploy between this step and disabling the token service, because a deployment can restore protection. 4. Deploy with the token service disabled.

pulumi config set hawk:tokenServiceEnabled false --stack '<stack>'
pulumi up --stack '<stack>'

Scheduling KMS key deletion stops signing immediately. The 30-day deletion window is a recovery period, not an additional serving period, and re-enabling is not guaranteed to restore the same key identity.

The setting does not delete database authority records. Issued JWTs and acquired AWS credentials retain their separate expiry bounds after issuance stops.

Operate and recover

Launch, bootstrap and renewal

Under the logical launch lock, the API commits a restricted execution and grant, publishes output restrictions, installs Helm, then creates the required immutable key Secret in the execution namespace. Active means authority is open, not that its Pod started. Runner failures require explicit resume.

Failed or cancelled launches close authority and request cleanup. Cancellation cannot advance from Helm to key publication. Uncertain cleanup blocks replacement; confirmed cleanup preserves the logical job for resume. See Delete and resume.

The launcher protects these settings from user overrides and preserves them across installation and exec:

Variable Value
HAWK_RUNNER_RESTRICTED_API_URL Trusted HTTPS origin, no user info/query/fragment or path except /.
HAWK_RUNNER_RESTRICTED_EXECUTION_ID Canonical execution UUID.
HAWK_RUNNER_RESTRICTED_KEY_FILE Absolute path to the read-only mounted key.
HAWK_RUNNER_RESTRICTED_ISSUER Configured issuer, independently of API URL.

User-supplied environment variables and secret declarations may not use the HAWK_RUNNER_RESTRICTED_ prefix. The API returns 422 before launch in either credential mode. This includes request secrets, runner.environment, and the target variable names of AWS-backed secrets. A saved scan config containing such a name must be corrected and submitted under a new ID; scan resume cannot replace that config.

If all four are absent, the runner uses user credentials. Partial or invalid restricted settings fail startup. The launcher also provides:

Variable Value
HAWK_RUNNER_RESTRICTED_MIDDLEMAN_URL Trusted Middleman base URL, required by bootstrap.
HAWK_RUNNER_RESTRICTED_MANAGED_KEYS JSON [] initially; bootstrap records generated API-key environment variable names. Preserve across exec.
HAWK_RUNNER_RESTRICTED_CACHE_DIR Chart default /tmp/hawk-restricted; otherwise a hawk-restricted-<uid> directory under the system temporary directory.

Before task/scanner construction, HAWK_RUNNER_REQUEST_CONTEXT carries job type, job ID and priority to workers for request headers. This metadata contains no credentials and grants no access, and is available with telemetry disabled.

Bootstrap acquires credentials before secrets, dependencies or work. Bootstrap and post-install reacquisition each retry transient failures for up to 15 minutes. Recognized permanent OAuth rejections fail without falling back to user tokens; unexpected intermediary 4xx responses are transient. Persistent 404/405 responses suggest a wrong API origin.

Hawk does not automatically forward the submitter's human access or refresh token to restricted runners. Explicit provider credentials and base-URL settings retain precedence over generated provider settings. Those explicit credentials retain their own permissions and renewal requirements; the restricted grant governs Hawk-issued credentials.

Startup, Inspect hooks and the AWS helper share private credential storage. Restricted renewal is on demand when a token has at most ten minutes remaining; transient failures retain valid tokens with backoff. Inspect hooks return without waiting for network or peer locks; asynchronous authentication retries pick up credentials published by the background refresh. Startup and AWS helpers wait for acquisition. Scheduling budgets and socket timeouts are soft limits.

Provide writable private cache storage. Paths use numeric UIDs on POSIX, so a passwd entry is unnecessary. A storage failure may reuse a previously published, still-valid restricted token, except after authentication rejection or permanent OAuth refusal. Without one, startup fails immediately with a safe path diagnostic. The standard chart requires writable /tmp/hawk-restricted. Custom launchers can set HAWK_RUNNER_RESTRICTED_CACHE_DIR in the runner environment to another writable absolute directory; it is not a user config override. User refresh-token rotation requires successful publication. Process exit, network failure or failed publication after rotation may require fresh user credentials. A stuck living lock holder must finish or be restarted; process death releases the lock. The separate AWS session cache can return acquired AWS credentials even if its cache write fails.

Scout workers and fresh-process resumes discover the installed Inspect hooks. Changing mode, issuer, execution, key path or provider configuration requires a new process. Managed keys are replaced only for the configured issuer/execution; services still verify the JWT. Parent preparation supplies initial provider keys. Direct SDK clients that copy a token need their own renewal mechanism and may fail construction without an initial key.

Job checks and credential lifetime

Before each issuance, the API authenticates key/client ID, validates the saved grant and requires active state, then closes that database session before an exact Job GET through the monitoring provider's long-lived client. Final Complete=True / Failed=True or a Kubernetes 404 Status response with reason NotFound and details identifying batch/jobs and the saved Job name conditionally closes that execution while active, commits, and returns 401 invalid_client; it preserves an earlier terminal result and cannot close a replacement attempt.

A live Job leads to an execution-row lock and active-state recheck before claim capture. Closure during the GET prevents signing. Queueing, suspension, deletion timestamps and early FailureTarget / SuccessCriteriaMet conditions are not terminal proof; removing a ServiceAccount alone does not close authority. Unrecognized 404 responses, malformed/conflicting observations, read failures and timeouts return 503 without signing or permanent closure. Each GET has five seconds within the ten-second capture budget. Kubernetes remains a renewal dependency when launches are disabled. Timeout cancels and drains the read; the shared monitoring client remains open for other requests until API shutdown.

Claims and expiry are captured once; the transaction/session close before KMS signing. Signing consumes the 1,800-second JWT lifetime; expires_in reports what remains, and expired signing results are discarded. An issuance already authorized can finish after closure. Valid JWTs can still obtain AWS sessions: with the default one-hour session, nominal residual access is 90 minutes after recorded closure, plus skew and in-flight work. Reporting delays postpone closure itself. This is neither immediate revocation nor a universal AWS-session cap. Capabilities expire on their own schedules.

There is no periodic authority reconciler or launch-expiry timer. Without another token request or delivered completion, authority can stay active indefinitely; explicit deletion recovers it. The hourly janitor performs resource housekeeping, using inspect-ai.metr.org/helm-release for physical releases and job-id as the legacy fallback. Job checks never adopt, repair or delete resources.

Completion and retained runners

The hosted process wrapper reports after work, final writes and teardown finish or unwind; scan reporting follows closure of the work event loop. Startup failures use the same exit guard; successful exec transfers ownership to the replacement. Direct Python work-function calls do not report process completion.

Restricted runners stop accepting new CloudWatch metric records at shutdown and wait at most five seconds for their daemon. Unsent buffered metrics are discarded (normally up to the 60-second flush interval); an already-running flush or credential operation can finish after completion. Evals using user credentials flush buffered metrics at eval-set completion. Eval results and Middleman token-usage accounting are unaffected.

Completion rereads the mounted key each attempt, sends exact {}, and needs no JWT/STS session. Redirects and environment HTTP proxies are disabled. A valid acknowledgement names the same execution, ended state, a nonempty terminal reason and an aware ended_at; additional response fields and new reasons are accepted. The first terminal result wins. runner_completed means finished authority use, not successful work or stopped resources. Delivery failure does not rerun work or change its result. KMS/issuer configuration is unnecessary for completion, but the database must be available.

The synchronous delivery loop starts immediately, retries after 1/2/4/up-to-five seconds, and stops scheduling work after 30 seconds or a validated acknowledgement. HTTP attempts use five-second socket-phase timeouts, read at most 16 KiB and check the remaining budget between response chunks. An operation already underway can exceed the budget. Ctrl-C stops reporting immediately and can replace an earlier work failure with exit 130. Failed client cleanup can cause a harmless idempotent retry. A validated acknowledgement stops further reports.

Restricted evals with cleanup: false report before retained debugging. A stop during reporting prevents idle entry. Until acknowledged, idle retries once every 60 seconds even after JWT/STS expiry, without S3 stop polling or consumer renewal. No new consumer renewal starts after final writes; an already-running refresh may finish. Leaving idle opens no new 30-second window. Retention has no automatic deadline: use hawk delete <job-id> when done. Scans gain no retention; retained runners using user credentials keep S3 stop behavior. If all reports fail, a retained live runner may stay authorized until delivery or deletion.

A sharded --all scan reports completion only from its orchestrator Job, which keeps the Helm release name and is the execution's bound Job. Worker pods never report completion, and a worker refused at bootstrap exits 0.

Delete and resume

A DELETE that overlaps a launch or another deletion returns 409. No deletion is queued: retry the same hawk delete command after the other operation finishes. The client does not automatically retry this conflict. Retryable cleanup failures remain separate and use the existing 503 handling.

Select the matching credential mode when resuming. The following tracked cleanup checks apply to restricted executions.

Resume checks the previous Job even when its execution is still active because the runner crashed without reporting completion. A terminal or missing Job with physically stopped Pods can be cleaned during resume. Cleanup commits authority closure and deletion intent before removing resources; an active execution ends with deletion_requested, and an existing terminal reason is preserved. A Kubernetes observation failure returns a reportable, retryable 503 without starting cleanup. For a sharded scan, the Pod check covers the worker Pods too, through the shared job-id, execution-id and helm-release labels; the <release>-workers Job itself is not read, so a suspended worker Job with no Pods passes and is removed with the rest of the release. Live retained runners or unrecoverable execution history (such as a failed launch with no deletion intent) require hawk delete <job-id> before cleanup can begin. Once deletion intent is committed, another resume can continue cleanup, including after the previous cleanup timed out. If cleanup remains pending, resume returns 503 with Retry-After: 5; retry resume or use hawk delete. The CLI does not automatically retry resume submissions. Every restricted resume gets a new execution, key and release only after confirmed cleanup. A scan whose accepted config was never published still cannot be resumed.

Under the launch lock, known output, model and input restrictions are checked against declared access_groups before resume cleanup. Missing groups are named only after the submitter is authorized for every required group. Final approval checks current code policy and database floors again after inventory certification. The config and its associated metadata are published only after final approval, grant-size validation and effective-floor publication, before Helm. Rejected approvals preserve the saved config. Physical resume cleanup records resource absence without marking the logical job deleted, including after a failed replacement launch; explicit deletion still does. Later failures can leave physical cleanup or conservative access gates in place.

Delete commits closure before external cleanup, validates saved layout/namespace ownership, uninstalls the saved release and removes surviving expected namespaces. Namespace deletion removes the Secret; cleanup does not separately read/delete it, the Job or ServiceAccount. Any surviving resource subset is recoverable, including authority committed before Helm created anything.

A successful DELETE means authorization closure is committed, the saved release was uninstalled or absent, and namespace deletion requests succeeded. Namespaces may still be terminating. The logical job is marked deleted and ancillary cleanup is attempted; success does not assert that all resources are gone.

Confirmed absence requires every expected namespace to be gone and an exhaustive execution-label listing to show none remaining. That separate record permits a restricted replacement launch. Wrong ownership or read/delete/list failures remain reportable 503s. Repeating an accepted DELETE preserves its timestamps; confirmed cleanup requires no further Helm/Kubernetes calls.

Resume waits for confirmed absence and returns 503 with Retry-After: 5 if cleanup remains pending. Retry resume as described above. Normal public DELETE does not return this pending-cleanup error.

Expected termination-in-progress responses log at WARNING without a Sentry error event, including inline resume cleanup. Waiting stops on a successful observation of surviving namespaces after 55 seconds, leaving a five-second request allowance inside the overall budget. Dependency failures, ownership mismatches, and ambiguous timeouts remain reportable and retain the retry header. Resume conflicts retain their 409 status; they are not converted into cleanup retries.

The CLI and Python client's delete_job automatically retry 503 responses, honoring numeric or HTTP-date Retry-After within the client's timeout (300 seconds by default). HTTP dates without a timezone are interpreted as UTC. Persistent failures still surface for repair and retry. Never delete the shared Helm namespace. Execution namespaces, including sandboxes, carry inspect-ai.metr.org/execution-id; listing proves absence, not permission to delete/adopt arbitrary namespaces. Eval monitors are removed best effort; preserve legacy human-eval assignments, jump-host cleanup and job-level monitoring.

Helm uninstall is not UID-conditional. Safety relies on never-reused execution names, launch/delete locking, deletion barriers and control-plane RBAC. Runners cannot mutate their runner namespace, Job or ServiceAccount. Trusted administrators recreating identical names are not detected by stored UID comparison; direct namespace deletes use the UID observed during that attempt.

Completion/delete preserve the logical Job, execution/grant history, saved names and outputs. They cannot narrow restricted_access_groups inside .models.json; there is no separate access-groups file.

Endpoint and failure reference

Use TLS and authorization headers, never credentials in URLs. Both credential endpoints limit bodies to 4,096 bytes and return Cache-Control: no-store and Pragma: no-cache, including errors.

Endpoint Authentication and request Success
POST /oauth/token HTTP Basic: grant UUID username, complete mounted key password. application/x-www-form-urlencoded body grant_type=client_credentials. 200: access_token, token_type: Bearer, expires_in; no refresh token.
POST /token-service/executions/{execution_id}/complete Bearer mounted key, not JWT; application/json body {}; no query parameters. After commit, 200: execution_id, lifecycle_state: ended, end_reason, ended_at; repeats return the original terminal result.
GET /.well-known/jwks.json Public. Configured public JWKS; Cache-Control: public, max-age=300, no DB/KMS request.

OAuth Basic form-encodes each component before joining with : and base64 encoding; ordinary OAuth clients support it. Posted credentials or combined auth methods are rejected. Empty/missing grant type is invalid; empty scope is accepted, any nonempty scope (including whitespace) rejected. Unknown form and harmless query parameters are ignored; credential-bearing queries and duplicate form fields are rejected before flattening. Limits: 64 form fields and a 1,024-byte token Authorization header. The saved grant supplies permissions, not negotiated scopes.

Forwarded HTTPS is trusted only through accepted proxy middleware. The deployment trusts forwarded peers broadly and relies on restricted ingress to limit them to the proxy; preserve that boundary. Plain HTTP token requests fail even on loopback. Each Uvicorn process allows eight issuance requests, including directly awaited KMS signing. Capture has ten seconds; cancellation waits for rollback/session cleanup and can exceed that budget. Normal Uvicorn shutdown drains requests before closing dependencies; forced shutdown is best effort. Limits are initial defaults, not measured production capacity.

Errors have JSON error; 401 includes Basic/Bearer challenge as appropriate with realm hawk-token-service. Every credential 503 below has Retry-After: 5.

Condition Status error
Missing/malformed/wrong key or identity; issuance for ended execution 401 invalid_client
Invalid/duplicate/missing fields, forbidden query, malformed/nonempty completion JSON 400 invalid_request
Plain HTTP token request 400 insecure_transport
Other grant type 400 unsupported_grant_type
Nonempty scope 400 invalid_scope
Wrong content type 415 invalid_request
Body over 4,096 bytes 413 invalid_request
Missing config, DB/KMS/Kubernetes outage, uncertain Job evidence, signing expiry 503 temporarily_unavailable
Corrupt saved grant or captured claims 500 server_error

Absent JWKS configuration also returns 503. Fix request errors before retrying; for transient renewal failures keep a valid token and back off. An unavailable issuer does not establish that an unknown signing key is invalid.

The broker uses separate error responses. For restricted AWS, GitHub and task image pull requests, invalid or expired JWTs return 401; identity-binding or permission denials return 403; unavailable issuers, JWKS, or authentication configuration return 503. A restricted token on the human-only /validate route still returns 403.

Database authority and diagnosis

The hawk_api NOLOGIN role has SELECT/INSERT, no UPDATE/DELETE, on the private grant table. Hashes/snapshots are immutable. Runtime membership goes only to the actual API database login selected from the normalized first writer, without RLS bypass; public-only parent restrictions remain. Importers can write public and bypass RLS, but cannot read or forge grants in the separate token_service schema.

With publicModelsOnly, warehouse-backed API reads currently hide outputs with inherited private-code restrictions, even from callers with matching code grants. Code-only access in this mode is deferred. This limitation is specific to warehouse-backed reads; it does not change S3/folder authorization.

On PostgreSQL 17, the provisioner/migration administrator may retain membership with ADMIN=true, INHERIT=false, SET=false. Deployment audits all grantors; unexpected memberships or API delegation fail deployment and require explicit administrator repair. Remove old API-login membership before changing login. Inspect the grants before repair:

SELECT member.rolname AS member, grantor.rolname AS grantor,
       membership.admin_option, membership.inherit_option, membership.set_option
FROM pg_auth_members membership
JOIN pg_roles member ON member.oid = membership.member
JOIN pg_roles grantor ON grantor.oid = membership.grantor
WHERE membership.roleid = 'hawk_api'::regrole
ORDER BY member.rolname, grantor.rolname;

Execution, private-authority and output-access migrations extend the normal migration history as one chain.

Logger hawk.api.token_service emits bounded token_service_request events. CloudWatch EMF namespace Hawk/TokenService uses request_count/duration_ms with operation and result dimensions. Operations are issuance, completion, jwks; results are the error categories above plus success, not_found, method_not_allowed. OpenTelemetry spans are token_service.<operation>. Responses with 5xx status emit at ERROR with an allowlisted failure_stage: configuration, database, kubernetes_job, signing, or unknown. These events include the observed exception type and authenticated execution ID when available. Every event includes the generated request ID returned in X-Request-ID; IDs and exception types are not metric dimensions. Other responses remain INFO. Kubernetes dependency failures retain their original exception type and, when available, numeric dependency_status_code, so an RBAC 403 can be distinguished from a service 503 or timeout. Exception messages and response bodies are omitted. Cleanup failures add the same bounded diagnostic fields as warning breadcrumbs while reporting a sanitized error. Failures continue to produce Sentry events; this path does not suppress repeated failures during an outage.

Restricted AWS role sessions use hawk-<execution_id> from the verified signed claims. CloudTrail attribution follows the role session to the execution, its grant and submitted_by. Renewals of the same execution reuse the session name; individual credential issuance events are distinguished by AWS event and access-key identifiers. This attribution covers broker-issued sessions and does not promise propagation through subsequent AssumeRole calls.

Sentry retains credential events and transactions, but removes request bodies and query strings from /oauth and /token-service/executions requests. Its built-in scrubber removes authorization and named secret fields recursively. Generic key fields are scrubbed on credential routes; ordinary storage-key diagnostics are retained. Explicit restricted_key and credential_key fields are scrubbed on every route. Frame-local capture remains disabled; ordinary endpoints retain body/query diagnostics. Dependency logs are not suppressed. Restricted diagnostics never log exception messages, mounted keys, hashes, JWTs or Secret data. Do not put credentials in URLs or log messages: field scrubbing does not sanitize arbitrary text, and ALB and other edge logs are unaffected.