Security¶
This page covers Hawk's security architecture, access control, audit logging, and optional AWS security services.
Authentication¶
Hawk uses OIDC (OpenID Connect) for interactive user authentication. JWTs are validated at authenticated HTTP boundaries, including the API server, Middleman (LLM proxy), and token broker. AWS-native integrations use IAM and resource policies instead. The web viewer is a static single-page app: it performs the OIDC login in the browser, and every request it makes to Hawk's data APIs is validated by the API. API-issued presigned S3 URLs act as short-lived bearer capabilities for direct downloads.
Default: Cognito¶
When no OIDC provider is configured, Hawk creates a Cognito user pool automatically. Users are managed via the AWS Console or the helper scripts.
Managing Users¶
Managing Model Access Groups¶
Cognito automatically includes group memberships in the cognito:groups claim of access tokens. Create groups matching the model groups configured in Middleman:
# Create a model access group
scripts/dev/manage-cognito-groups.sh <stack> create model-access-openai
# Add a user to the group
scripts/dev/manage-cognito-groups.sh <stack> add-user model-access-openai user@example.com
# List all groups
scripts/dev/manage-cognito-groups.sh <stack> list
Users who aren't in any group fall back to hawk:defaultPermissions (default: model-access-public), which grants access to models that belong to the group model-access-public.
External OIDC Provider (Okta, Auth0, etc.)¶
For production deployments, we recommend using your organization's identity provider. Use the autodiscovery script to generate Pulumi config from your issuer URL:
This prints the full set of hawk:oidc* config values to add to your Pulumi.<stack>.yaml. See Pulumi.example.yaml for the complete list of OIDC settings.
OIDC App Requirements¶
Your OIDC application must:
- Use PKCE (Proof Key for Code Exchange) — no client secret
- Support the
authorization_codegrant type - Issue access tokens that live at least 30 minutes: with shorter ones, a runner's model calls can get 401 on every retry
- Include these redirect URIs:
http://localhost:18922/callback— Hawk CLI loginhttps://viewer.hawk.<your-domain>/oauth/complete— web viewer login. A dev stack registershttps://viewer-<name>.hawk.<parent-domain>/oauth/completeinstead (domainalice.staging.example.comregistershttps://viewer-alice.hawk.staging.example.com/oauth/complete).http://localhost:5173/oauth/complete— web viewer run locally against a deployed API (see Using a deployed API server)
Required JWT Claims¶
Hawk extracts permissions from the permissions claim (IdP group-derived) and cognito:groups. It also reads scp, but because those are scopes the client requested — which an IdP may grant to anyone — only public model-access values (model-access-public, model-access-public:read) are honoured from it; any other scp value grants no permission. The claim value can be either a JSON array of strings or a space-separated string:
{
"sub": "user123",
"iss": "https://login.example.com/oauth2/default",
"aud": "your-audience",
"permissions": ["model-access-openai", "model-access-anthropic"]
}
Or equivalently:
The group names must match the groups assigned to models in Middleman (see Model groups).
No permissions claim?
If the JWT carries no honoured permission (its permissions and cognito:groups claims are missing or empty, and scp holds no allowlisted value), Hawk falls back to hawk:defaultPermissions (default: model-access-public). An scp claim holding only non-public scopes counts as no permission, so it gets the fallback too. The fallback isn't merged into other claims: a user whose permissions or cognito:groups holds any value, such as an admin group, sees public-model results only with a model-access-public grant in those claims or in scp, unless the deployment sets hawk:publicModelsOnly.
Setting Up Your Identity Provider¶
The exact steps vary by provider, but the general approach is:
-
Create an OIDC application in your IdP (Okta, Auth0, Entra ID, etc.) with PKCE and the redirect URIs above.
-
Create groups in your IdP for each model access level you need (e.g.,
model-access-openai,model-access-anthropic). These must match the group names you assign to models in Middleman. -
Add a custom claim named
permissionsto your access tokens that includes the user's group memberships. Most IdPs support this via:- Okta: Custom claim on an authorization server using a Groups expression
- Auth0: Post-login Action that adds groups to the access token
- Entra ID (Azure AD): App roles or group claims in the token configuration
- Keycloak: Protocol mapper for group membership
-
Configure Hawk with your IdP's client ID, audience, and issuer URL in your Pulumi stack config.
Access Control¶
A person's access comes from two kinds of group in their token: model groups (model-access-*) for models and the results that used them, and code groups (code-access-*) for code and the runs that used it.
- Model access:
- model groups and read-only scopes;
- how a result gets its groups: model names in logs, declared and observed models, models found during import and provider-discovered models;
- the endpoint audit;
- the cross-lab rule and its override;
- sensitive model protection.
- Code-access rules: the code groups each source needs, how admins manage rules, and the sources a run declares.
- Protected task images: private tasks' images, kept under their repositories' rules.
- Restricted credentials: runs and agents that act without their submitter's login.
How Group Membership Flows¶
flowchart LR
IdP["Identity Provider<br/>(Okta, Auth0, Cognito)"]
JWT["JWT with<br/>permissions claim"]
API["Hawk API"]
MM["Middleman"]
TB["Token Broker<br/>(Lambda)"]
S3["S3 (eval logs)"]
DB["PostgreSQL<br/>(RLS)"]
IdP -->|"issues"| JWT
JWT -->|"validates"| API
JWT -->|"validates"| MM
JWT -->|"exchanges for<br/>scoped credentials"| TB
TB -->|"scoped access"| S3
API -->|"checks user<br/>groups"| DB
- Identity Provider issues JWTs with model and code group memberships in the
permissionsorcognito:groupsclaim - Middleman validates the JWT and checks the user's groups before routing model API calls
- Token Broker checks the user's model and code groups (with an exception for the run's own job), then exchanges the JWT for scoped AWS credentials tied to a specific job via AWS session tags
- Hawk API checks the user's groups before returning eval and scan results; PostgreSQL RLS (Row-Level Security) restricts direct SQL readers to the groups their login holds
One caller does not come from the identity provider: a stack can let named GitHub Actions workflows call Middleman with GitHub's OIDC token, and their model groups then come from the stack's configuration rather than an IdP claim (GitHub Actions workload identity).
SCIM provisioning¶
Direct SQL readers can connect to the warehouse as themselves. An identity provider
provisions people and groups over SCIM 2.0 to /scim/v2/ on the Hawk API. Hawk turns
each active person into a Postgres LOGIN role named for their SCIM userName (an
email address). That role is granted warehouse_member plus the role of every group
that maps to one:
model-access-<slug>maps to the role of the same name, when it is a Middleman model group.code-access-<name>maps tocode_group_<name>.
Other groups are stored but grant nothing. Deactivating or unassigning a person removes
their login and every membership. Deleting a person (Entra ID does this; Okta only
deactivates) drops their role. People and groups live in the identity schema, which
keeps what each identity source asserts apart
(Database: People and personal logins).
Reachability. The endpoint is served on the API's normal host, so it is only as reachable as the API. A deployment with an internal load balancer exposes it only to the VPC and Tailscale. An identity provider in the cloud reaches it through an agent inside the network, such as Okta's On-Premises Provisioning agent.
Authentication. There is no stored SCIM credential. Requests carry
Authorization: Bearer <JWT>, a token from AWS IAM outbound identity federation that
the provisioning agent's IAM role mints for each call. The API checks its ES384
signature against the issuer's JWKS, and requires the configured audience and the
agent role's ARN as its subject (HAWK_API_SCIM_FEDERATION_ISSUER, _AUDIENCE,
_SUBJECT). It also requires an issue time (iat) and an expiry at most five minutes
after it, so a token minted with a longer lifetime is refused. With those unset, every route answers 404; a wrong or missing token gets a
401. HAWK_API_SCIM_ALLOWED_SOURCE_CIDRS further limits SCIM to clients whose address,
as the load balancer saw it, falls in the listed networks; others get a 404. So does a
request with more than one X-Forwarded-For header while the list is set: AWS documents
where the load balancer appends the client address only for a single header.
The stack sets these itself when its own Okta provisioning agent
serves it. Any other agent that can mint these tokens (in this account or another)
is configured with hawk:scimFederation: the account's outbound-federation issuer
(aws iam get-outbound-web-identity-federation-info), the agent's IAM role ARN as
subject, and optionally the networks it calls from as allowedSourceCidrs. The
audience is always <api url>/scim/v2. If that agent reaches the load balancer by
security group, hawk:albSecurityGroupIds adds groups to it.
Threat model. Whoever can mint that token (the agent's task role) can provision any
person and add them to any mapped group, so it is as powerful as an identity-provider
admin for those groups. Tokens last five minutes and are bound to one API's audience.
The API's own database role, hawk_api, can switch into both writer roles, so the API
(and whoever controls it) can do the same; it is trusted to the same degree.
How the roles are protected. The database bounds what a SCIM caller can do:
- The roles are created and granted by
identity_manager. It is a NOLOGIN role that only alters roles it created and memberships it granted, from triggers that run on every write and record each change inidentity.role_change. - It refuses to adopt any role that already exists. SCIM writes run as
scim_writer, which can't write the columns that bind a person to a role, nor any other source's data. - Only memberships the identity provider pushed over SCIM confer roles.
- It only grants group roles that confer nothing beyond warehouse reads: no role
anywhere in a group's membership chain may be elevated (superuser, CREATEROLE,
CREATEDB, REPLICATION or BYPASSRLS) or be held
WITH ADMIN. It grants them withoutINHERIT, and revokes a group from every holder once it stops qualifying. - If
warehouse_memberever holds more thanrds_iam,rls_readerand the sharedcode_group_*roles readers get, reconciling turns every personal login off instead of handing that access out. - It only accepts email-shaped names, and refuses prefixes the deployment reserves
(
model-access-,code_group_,pg_,rds_,rdsadmin,rls_,hawk_).
Logging and redaction. Every authenticated request logs a scim_access line
(method, path, status, client address, duration), and every refusal a scim_refused
line with its reason. Every write also logs one scim_request line with the resource,
the operation, the status and the role changes it made, at WARNING with a failed
count when the reconciler couldn't bring someone's role into line. None of them carry a request
body, query string or token. Sentry events for /scim/ paths drop the request body, query
string and headers, because filters and bodies carry email addresses.
Interface endpoints¶
hawk:vpcInterfaceEndpoints, or hawk:oktaProvisioningAgent, creates interface endpoints for
ECR, CloudWatch Logs and Secrets Manager in subnets of their own, with private DNS. Private DNS
applies to the whole VPC, so every workload in it, including other stacks sharing the VPC, then
reaches those services at the endpoints' private addresses instead of through the NAT:
- Callers must use this account's credentials: the endpoint policy refuses every other account's.
- Callers must be able to reach the endpoints' subnets on 443. The tailnet peer relay and Middleman's tailnet connector are allowed through their network ACLs. Sandbox pods are not: Cilium denies them the primary VPC CIDR, so a sandbox calling ECR, Logs or Secrets Manager directly would time out.
No current workload does either. Before turning on the agent in a shared VPC, enable
hawk:vpcInterfaceEndpoints alone and deploy, so a workload that breaks shows up without the
agent in the way.
Okta provisioning agent¶
With hawk:oktaProvisioningAgent, the stack that owns the VPC runs Okta's On-Premises
Provisioning agent as a single ECS task, so Okta can provision internal-only APIs. One
agent serves every environment in environments: that stack itself and any of its dev
envs. The stack must create its own VPC and run its own API, and every served API
must sit behind an internal, TLS-terminating load balancer (hawk:albInternal,
hawk:skipTlsCerts false); config validation enforces all three. The account must already have
AWS IAM outbound identity federation enabled (aws iam enable-outbound-web-identity-federation, once per
account, as Middleman's aws_sts profiles also need); the deploy reads its issuer rather than enabling it.
Okta serves the agent's package only to a signed-in admin, so the image build can't download it. The stack
creates an ECR repository for it (<stack>/hawk/okta-provisioning-agent-package, exported as
okta_provisioning_agent_package_repository), and runs the agent only once package names a version staged
there (see Upgrading below). Turning the agent on takes two deploys: one with orgUrl and environments
creates the agent's subnets, the interface endpoints and the repository, and one after staging adds package.
Only orgs in Okta's US production cells (ok<N>, published as us_cell_<N>) are supported: for an org in
another cell (EMEA, APAC, preview and the rest) the egress resolver finds no published ranges, fails, and
the deploy fails with it. The agent long-polls Okta and relays each SCIM
call to the right API. It runs vendor code that sees provisioning traffic, so it is
contained:
- No ingress, narrow egress. It runs in its own subnets, one /28 in each of up to four availability zones from its claim in the VPC's address plan, with no inbound rules. Its security group allows HTTPS to exactly five destinations:
- the Okta org's addresses;
- the load balancers of the environments it serves (those in the SCIM-targets security group);
- the ECR, CloudWatch Logs and Secrets Manager interface endpoints, created with the
agent (as with
hawk:vpcInterfaceEndpoints), which accept only this account's principals (see Interface endpoints for what they change for the rest of the VPC); - an STS endpoint of its own, which serves only
GetWebIdentityTokento the task role; - S3 through a gateway endpoint that serves nothing but ECR image layers.
- It holds no SCIM secret. The agent sends SCIM calls without credentials to a
sidecar,
scim-identity-proxy, on127.0.0.1:8080. The sidecar uses AWS IAM outbound identity federation to get a five-minute JWT for the task role, with the audience<api url>/scim/v2of the environment named by the path's first segment, and forwards the call to that API with it as the bearer token. The API checks the token's signature against the account's STS issuer, and its audience and subject (HAWK_API_SCIM_FEDERATION_*). A stolen token stops working within minutes and can't be replayed against any other audience. - Okta's addresses are maintained every five minutes. A small Go Lambda resolves the org's host
name and keeps only addresses inside the published ranges of the cell
/.well-known/okta-organizationreports. If none match, it leaves the prefix list unchanged and fails, so a spoofed DNS answer can't widen egress. It fetches both documents over HTTPS without following redirects. It and the identity proxy share the Go module inhawk/services/okta_provisioning_agent/go; the deploy builds the Lambda with Docker, reproducibly, so unchanged source never updates the function. - One agent per account serves several environments. Each account's VPC-owning stack (production, staging, testing) runs its own. Staging's can provision staging and every dev env it lists; no agent reaches another account.
- SCIM accepts only the agent's subnets. The API requires the load balancer's
client address (the last
X-Forwarded-Forentry) to fall inside them (HAWK_API_SCIM_ALLOWED_SOURCE_CIDRS). Anything else, bearer token or not, gets a 404. - Its credentials are write-only to operators. The registered agent's config and
keystore live in
<env>/hawk/okta-provisioning-agent, encrypted with a dedicated KMS key. The secret's policy deniesGetSecretValueto every principal except the task execution role. The task role can only mint identity tokens for the listed environments' SCIM audiences. - The container is locked down. It runs as UID 10001 with all Linux capabilities dropped, a read-only root filesystem and ECS Exec disabled. It keeps state only in its task volume, and only one copy runs at a time.
- Its outages alarm.
<env>-hawk-okta-provisioning-agent-downfires after five minutes with no running task, and<env>-hawk-okta-provisioning-agent-okta-egress-errorsafter fifteen minutes of resolver failures. Both are on the alerts dashboard. Okta doesn't retry a failed push on its own, so after an outage retry the app's failed pushes in Okta. - Everything it does lands in CloudWatch Logs. No log carries a token, a request body or a SCIM query string.
| Log group | What it records |
|---|---|
<env>/hawk/okta-provisioning-agent (agent/ streams) |
The agent's own log, using Okta's stdout-only logback-container.xml |
<env>/hawk/okta-provisioning-agent (proxy/ streams) |
One line per SCIM call (method, path, status, duration), each token minted, upstream failures, refused paths |
/aws/lambda/<env>-hawk-okta-provisioning-agent-okta-egress |
Each resolver run: the cell, the addresses resolved, entries added and removed, any address rejected for falling outside the cell |
<env>/hawk/okta-provisioning-agent/flow-logs |
VPC flow logs for the agent's subnets, accepted and rejected |
| The API's log group | scim_access for each authenticated SCIM request, scim_refused with its reason, scim_request with the role changes a write made |
AWS API calls on these resources (reads of the agent's secret, GetWebIdentityToken,
prefix-list changes, ECS service changes) are recorded by CloudTrail when the account
has a trail logging management events. ECS keeps a stopped task, with why it stopped,
visible for about an hour.
Registering. After the deploy that sets package, run
scripts/ops/register-okta-provisioning-agent.py <stack>. An Okta admin approves the
code it prints. One registration serves every listed environment. The script turns on
the agent's allowHttp for the loopback hop to the sidecar. Pass --replace to
re-register, then delete the old agent in Okta.
Serving an environment. Each environment has its own Okta app (infra-shared creates
them). Okta has no API for an app's on-premises connector, so once per app, in its
Provisioning settings: enable On-Premises Provisioning; base URL
http://127.0.0.1:8080/<env>/scim/v2/; authorization None (the sidecar adds it);
unique field userName; select the stack's agent; enable Create Users, Update User
Attributes and Deactivate Users. To opt a dev env in:
- Add it to the parent stack's
hawk:oktaProvisioningAgent.environmentsand deploy the parent. -
On the dev env, set
hawk:scimEnabled, and pointhawk:scimFederationandhawk:albSecurityGroupIdsat the parent's agent, whose stack outputs carry the values:out() { pulumi stack output -s stg "okta_provisioning_agent_$1" --json; } pulumi config set -s dev-alice --path 'hawk:scimFederation.issuer' "$(out federation_issuer | jq -r .)" pulumi config set -s dev-alice --path 'hawk:scimFederation.subject' "$(out federation_subject | jq -r .)" pulumi config set -s dev-alice --path --json 'hawk:scimFederation.allowedSourceCidrs' "$(out subnet_cidrs)" pulumi config set -s dev-alice --path --json 'hawk:albSecurityGroupIds' \ "[$(out scim_targets_security_group_id)]"
Then deploy the dev env (twice the first time). 3. Add the environment to infra-shared's Okta config and deploy it; then configure the new app as above and turn on its group pushes.
Removing. In this order:
- Remove the parent's SCIM-targets group from every dev env it serves (drop it from
hawk:albSecurityGroupIds, unsethawk:scimFederation) and deploy each one. EC2 won't delete a security group a load balancer still uses, and the parent's deploy retries for 15 minutes before failing. - With
hawk:protectResources, the agent's KMS key and credentials secret are protected and its four ECR repositories, the package's included, aren't force-deleted: unprotect the first two (pulumi state unprotect) and empty the repositories. - Unset
hawk:oktaProvisioningAgenton the parent and deploy it. Delete the agent in Okta. Outbound identity federation stays enabled in the account.
Upgrading. The image installs package.version from the stack's package repository and checks
it against package.sha512. To stage a version, download Okta Provisioning Agent (x64 RPM) from
Settings > Downloads in Okta and run
scripts/ops/stage-okta-provisioning-agent-package.sh <stack> <rpm> <sha512> with the stack's AWS profile,
where <sha512> is the hash Okta shows beside the download. It refuses an RPM that doesn't match, pushes it
to the repository with an immutable version tag (or checks the one already there), creating nothing, and
prints the package value to set.
Token Broker Job Identity¶
For runs with user credentials, the broker validates the user's access token, and runners also send a projected Kubernetes ServiceAccount identity token so the broker can bind the request to a specific job. Restricted requests send the execution token instead, and always need the projected token (Restricted credentials):
| Factor | Header | Proves | Issued by |
|---|---|---|---|
| User access token | Authorization: Bearer |
Permission — the caller's grants authorize the requested operation | Your OIDC provider |
| Job identity token | X-Hawk-Job-Token |
Identity — the caller really is the job whose job_id it requests |
The EKS cluster's OIDC issuer |
The job identity token is a Kubernetes projected ServiceAccount token mounted
into the runner pod, scoped to the hawk-token-broker audience and rotated by
kubelet. The broker validates its signature against the cluster's JWKS endpoint,
then checks that the token's sub equals the full
system:serviceaccount:<runner-namespace>:<runner-service-account> it derives
for the requested job, and that the token carries a pod binding.
With hawk:requireJobToken: "true", both tokens are required and the user token
alone is insufficient. This prevents a runner with broad permissions
from requesting credentials session-tagged for another eval set's job_id and
gaining access to that eval set's S3 prefix. The default is currently permissive,
as described below, so deployments do not get this two-factor guarantee until
they explicitly enable enforcement.
Output credentials without verified worker identity require write and execute access
to every result group. Workers without those grants need a matching, pod-bound
job token even when requireJobToken is false.
Enforcing (requireJobToken)¶
hawk:requireJobToken controls requests made with user tokens and is false
(permissive) by default:
- Permissive — a missing, invalid, or mismatched job token is logged as an
audit warning and emits a
JobIdentitySkippedCloudWatch metric, dimensioned byerror_type(missing,invalid,mismatch,unbound,error). Credentials may still be issued if the caller independently satisfies the required permissions above. If it doesn't, aninvalidorerrortoken can get503, also counted asJobIdentityDenied, so the runner retries. - Enforce (
true) — the same conditions return403(503forinvalidanderror, which a retry can pass) and emitJobIdentityDeniedwith the same dimensions.
For runs with user credentials, /github and /images/pull always need a matching
job token, so a mismatch there gets 403 and emits JobIdentityDenied in either
mode.
Before setting requireJobToken: true, check the "Token broker: job identity
(permissive skips)" widget on the Hawk platform overview dashboard: each skip
becomes a refusal once enforcement is on, at the runner's next credential refresh.
A persistent non-zero error usually means the broker's JOB_TOKEN_*
configuration is wrong rather than that a runner misbehaved.
mismatch is the one reason that is never benign — it means a caller asked for
a job it does not hold the identity token for. In permissive mode credentials
can still be issued to callers with sufficient direct permissions. When
hawk:enableProdAlarms is true, the
matching <env>-hawk-token-broker-identity-mismatch-permissive or
<env>-hawk-token-broker-identity-mismatch-denied alarm fires on the first
occurrence. Subscribe a receiver to their shared SNS topic before enforcing. The
flag controls alarm creation regardless of the stack name; alarms
are not created merely because a stack is named prd.
In enforce mode the broker refuses to start a request with empty JOB_TOKEN_*
configuration.
EKS OIDC configuration is required when the token service, requireJobToken, the
GitHub App or protected task images are enabled. API networking
also requires the EKS cluster security group. For external clusters, Pulumi
discovers missing externalEksOidcProviderUrl and externalEksClusterSgId values
from externalEksClusterName with eks:DescribeCluster; supply the values to skip
discovery.
Runner Git access¶
With a GitHub App configured (see new environment),
runners never hold a long-lived Git credential. Each runner's GIT_CONFIG_* routes
GitHub's challenge for a private repository to python3 -m hawk.runner.git_credential,
which asks the token broker's /github with the pod's projected ServiceAccount token, the
one it already sends for AWS credentials. For this the broker accepts only that job's own
pod-bound token (issuer, the job's full sub, pod binding), whatever requireJobToken says.
It then mints an installation token for that one repository with contents: read, valid
for an hour, and Git downloads directly from GitHub.
The broker mints only for repositories the App is installed on, and only if no code-access rule restricts the repository or the run recorded it at launch, even with an incomplete inventory. A recorded repository grants nothing else in its group: a run's code groups restrict who reads it and can grow after launch. Launches check that the user may use each restricted repository the run declares; the broker then keeps out restricted repositories it didn't declare, such as a task's private dependency. Each token is logged with the job, the repository and why it was allowed, and no two requests share one, since any holder can revoke it.
Public repositories are the exception: with hawk:githubAppPublicRepository, which the App
requires and only dev stacks may lack, runners ask before every GitHub fetch, and the broker answers a public repository with one token per
broker instance, minted for that public repository and refused if it isn't public. Any
GitHub token reads public repositories, so this one holds only metadata: read and reads
no private code, even if its repository turns private. A run holding it can revoke it,
failing other runs' public fetches until the broker's next visibility check finds it
revoked, within five minutes. Likewise, a repository made private keeps getting the
shared token, which can't fetch it, for up to five minutes.
Job tokens are checked offline, so a copied one works until it expires, up to an hour after it was issued, as it does for the AWS credentials; each GitHub token works for an hour.
For repositories no rule restricts, the App's installation scope, not Hawk, bounds what
runs can read: every user who can launch a run can read every such private repository the
App is installed on, through a run. The App's private key can mint tokens for all of them,
with every permission the App holds, so register it with Contents: read-only alone.
It lives only in <env>/hawk/github-app-key, whose policy lets only the token broker
read it, plus any break-glass principals listed in hawk:githubAppKeyBreakGlassPrincipals.
The broker re-reads it every five minutes, so to rotate it, generate a
second key in the App's settings, write it to the secret, wait five minutes, then delete
the old key.
Without the App (hawk:githubAppId unset), runners receive the
<env>/inspect/api-git-config credential instead. Every runner could copy that credential,
so once no stack hands it to runners, write back the secret's placeholder and revoke the
token on GitHub. Keep every key, with GIT_CONFIG_COUNT at 0 and the rest blank: the API
task references each key, and ECS refuses to start it if one is missing.
Repository downloads¶
With the App and hawk:enableCodeDownloads on (it's off unless set), people can download a
repository they may use without GitHub access of their own:
hawk code download github.com/<owner>/<repo>, or --path <file> for one file. The
API decides as for a run's clone: the repository's rule (the longest matching
prefix, else *) must assign it to one of the caller's code groups, with no admin
exception. Unlike a clone, a repository no rule covers can't be downloaded.
The API then invokes the broker's function directly and streams what GitHub sends from
the short-lived link the broker returns; neither the link nor the App's token leaves Hawk.
The broker refuses download requests that reach it through the ALB, which routes its name
for anyone who sends it, and trusts whoever invokes it to have decided: a principal in the
account that may invoke the function itself, such as an admin role or a CI role allowed
lambda:InvokeFunction on every function, gets a link for any repository the App can
read, and an archive link reads any commit in the repository's fork network. Grant that
permission on the broker narrowly. The files stay
on the person's machine, so grant a repository's group only to people who may keep its
code. GitHub builds the archive with git archive, so files marked export-ignore are
left out, export-subst placeholders are filled in and submodules are empty folders; a
file read with --path is checked against its blob.
The broker logs each link it issues: who asked for it, and the repository, commit and file.
Its log is kept for hawk:cloudwatchLogsRetentionDays (14 days unless set).
A runner launched with user credentials holds its launcher's token, so its code can
download what the launcher may, and the run doesn't record it; restricted credentials
avoid this. --ref takes the repository's branches and tags, and commits in its default
branch's history: GitHub serves any commit in a fork network through every repository in
it, so the broker refuses other commits, which may exist only in a restricted fork. For
archives this holds only because the link never leaves Hawk: an archive link downloads any
of those commits. A branch or tag downloads the commit it points at, so a commit outside
the default branch's history that no branch or tag points at, such as one below a release
branch's tip or a squash-merged pull request's deleted head, can't be downloaded. A run
pinned to a commit isn't held to this: see
Prefixes and matching.
Administrative Roles¶
Hawk has two administrative roles. Middleman Admin can:
- Create, update, and delete model configurations
- List every model in the admin API, whatever its group
- Manage provider API keys
They do so with hawk proxy, or, for models and labs, in the viewer's LLM
proxy tab, which the Hawk API relays to Middleman with the admin's own token
(Middleman makes every admin decision). The tab puts admin power and secret
models' real names in the browser session: script running in the viewer could
act as that admin. As for Hawk admins, prefer separate day-to-day and admin
identities, or short-lived admin membership.
To grant it, follow Granting admin: a boolean claim, or a group listed in hawk:middlemanAdminGroups.
Hawk Admin¶
Hawk admins can stop, delete, purge and resume other users' runs, update imports and sample scores/invalidation, manage human-registry entries, and author code-access rules. Admin status bypasses ownership checks, not model access or named code groups; on reads it passes missing or incomplete code inventories (a run with no policy and no rows is refused). To author rules, admins can read the whole code registry, sources outside their code groups included: every inventoried source and its code items' names, subdirectories and refs. The endpoint audit lists the checks and legacy exceptions.
There are two OR-ed sources of admin status; both are disabled by default:
| Config key | How it works |
|---|---|
hawk:hawkAdminClaim |
Name of a JWT claim. When the claim is present and its value is boolean true, the bearer is treated as a Hawk admin. |
hawk:hawkAdminPermissions |
List of permission/group names. If any entry matches a value in the token's permissions or cognito:groups claim, the bearer is treated as a Hawk admin. Values from scp cannot confer admin — only public model-access scopes are honoured from scp, and those may not be admin names. |
hawkAdminPermissions entries must be disjoint from defaultPermissions: tokens that carry no honoured permission have the defaults substituted in, so any overlap would make every such caller an admin. The API refuses to start if it detects an overlap. The entries must also not be OAuth scopes that users can self-request from your IdP.
Ownership overrides emit a warning-level admin_override event with the action, actor and recorded owner (null when unavailable). Job events include job_id; human-registry events include human. Actions are stop, delete, resume, edit, update_import or update.
With user credentials, runner pods receive the launching user's access token. An admin's token lets task code exercise these same powers—including resume, import updates and destructive sample edits—while model-access checks still apply. Prefer separate day-to-day and admin identities, or short-lived admin membership.
The same token lets eval-set code read that user's whole Middleman traffic history through the API's /traffic endpoints: the metadata of every request they made with a token, direct and coding-agent traffic included, and the stored bodies too when body access is on.
Example: using hawk:hawkAdminClaim with an Okta custom claim:
For Cognito deployments, hawk:hawkAdminPermissions is simpler — create a Cognito group (e.g. hawk-admin) and add it to the config:
Browser approvals¶
Browser approval WebSockets validate the API session cookie/JWT and viewer
Origin before upgrading, and close when the credential expires. Content access
and write capability are rechecked before sending each decision. approval_decision
logs record the actor's subject and email, the run, session, tool call, offered
choice, delivery or application status and the shard a review names; tool
arguments and credentials are not included. Browser approval sessions do not
expose general ACP commands or arbitrary relay ports. These audit records identify
an account, not proof of human intervention.
Where the answerer's token carries an email, each browser decision also sends
the part of it before the @ to the runner, which records it in the run's log for
anyone who can read the run. A client connecting to the relay directly can send
any name there, so the approval_decision log is the authenticated record.
A review holds one relay connection. A review of a sharded eval set names one
worker (?shard=K), and the relay connects to a running pod with that index; a
caller without the run's groups can't tell which workers run.
Browser approval review requires an HTTPS/WSS relay outside localhost because
the API forwards the reviewer's bearer token to the relay. HTTP-only testing
deployments using hawk:skipTlsCerts: "true" must enable TLS to use this feature.
The adapter parses runner-controlled ACP messages, capped at 2 MiB each. A review
retains at most 10,000 samples and 64 pending approvals, with a 4 MiB total limit
on serialized pending approval data. Exceeding a limit closes the review without
answering pending requests; use hawk acp (with --shard K for a worker of a
sharded eval set) for runs exceeding these limits.
Your own Middleman traffic¶
People can read back every Middleman request made with their own token, through
the API's read-only /traffic endpoints: direct traffic (coding agents, scripts)
and the model calls of the evals and scans they launched, which the runner makes
with the launcher's token (or, with restricted credentials, its own execution
token). See the user guide.
- Ownership is the only check. A record is visible to its caller if and only
if its
user_idequals the caller's tokensub. There is no model-group check: people keep access to their own past traffic after a model grant is revoked, including response bodies that may name a secret model's real upstream (danger_name), since Middleman stores responses verbatim. For their own runs that includes the prompts (task content) and responses, even where the warehouse would now hide the run's results from them. They received all of it at the time. There is no admin or team view, and people who can read a run's results can't see its traffic unless it's theirs. There is no write path. - Restricted runs. A request made with a restricted credential
has the execution as its subject (
execution:<id>), so the record goes to the submitter in the token's signed grant (Middleman'susage_user_id; Hawk requires it to equal the submitter) and keeps the execution inrestricted_execution_id. Itsjob_idandjob_typelikewise come from the signed grant, not the runner's headers. A restricted request is dropped unless its subject isexecution:plus itsrestricted_execution_idand it carries a submitter and job. A resumed run has a new grant naming whoever resumed it, so its requests are theirs. - Correlation headers. Each record keeps a capped bag of request headers
(
correlation): Hawk's and Inspect's own, plus coding agents' session ids (Claude Code'sx-claude-code-session-id; Codex'ssession-id,thread-idandx-codex-parent-thread-id, all UUIDs; opencode's, Kilo CLI's and Crush'sx-session-idand opencode'sx-opencode-session-id; goose'sagent-session-id). Only these exact names are kept, and an agent header longer than 256 characters is dropped, since several names are generic and any client may send them. Codex's otherx-codex-*headers are deliberately left out:x-codex-turn-metadatacarries the client's working directory, workspace paths and git commit hash. Full-level bodies still store every request header except credentials. - Not anyone else's. Anonymous requests and requests with no recorded user are
never ingested, and neither are requests whose user is a placeholder
(Middleman's
unknown, or blank) rather than a real subject. The API answers403to a token whosesubis missing or is one of those placeholders, so rows that were stored under one before can't be read. Someone else's request id answers404, like one that doesn't exist, so ids can't be probed. - Database. Records live in
middleman_traffic.request, in a dedicated schema that no broad grant reaches; only the API's role canSELECT(row-level security limits it to thesubthe API sets per transaction) and only the ingester's role (and the table owner) canINSERT. See Database. - Body access trusts the traffic log as ingested. A record's owner, model and
s3_keycome from the event Middleman logged, and the API serves the body at that key to the record's owner. So a principal that can write to the Middleman traffic log group (logs:PutLogEvents) could forge a record claiming another person's request that hasn't been ingested yet (an anonymous request, a batch that went to the dead-letter queue, a request older than the backfill window, or one that loses a race with the ingester) and read its body, or plant records in someone's history. Treat write access to that log group like read access to the bucket: keep it to Middleman's task role. Hawk's own Lambdas, and the viewer's ECS task execution role, may write only their own log groups (logs:CreateLogStreamandlogs:PutLogEventson them alone, instead of AWS's managed execution policies). Account administrators and deploy roles can write it too, but once body access is on they can also reach bodies through the API's role. Other workloads in the same account with any policy grantinglogs:PutLogEventson every log group (for example AWS's managedAWSLambdaBasicExecutionRole, orCloudWatchAgentServerPolicyon an instance role reachable from workloads) widen this; scope them to their own log groups. The ingester rejects any event whoses3_keyisn't exactly the one Middleman derives for that request, and the API reads only that exact key (the row's request id under its UTC receive date), so a forged record can point only at the request it names. The same holds for anyone who can writemiddleman_traffic.requestdirectly (database administrators, e.g. running the backfill as the database owner); the ingester's exact-key check doesn't apply to direct inserts, but the API still only reads the key derived from the row's own request id andreceived_at, so a fresh row can't point at an older body to get past the 180-day cutoff. - Serving a body. The API reads it at the
s3_keyon the caller's own row, never a key from the request, and streams it as stored, decompressing it unless the client accepts zstd. Bodies older than 180 days (Deep Archive) are not served. An object whose frame declares more than 256 MiB decompressed is refused (body_state: too_large), and one that declares no size is cut off at 256 MiB when the API decompresses it. A download fails with a 503 if S3 doesn't start it within 30 seconds, and lasts at most 5 minutes. Responses carryCache-Control: private, no-storeand bodies are never cached server-side. Bodies can contain secrets the person sent; it's their own data. - Raw chain-of-thought. A body (either side) is served only when the record's
model currently resolves to
raw_cot: false. An active registry config decides when there is one, even if a catalog also lists the name; otherwise models discovered from public provider catalogs are assumed not to return raw chain-of-thought. A model recorded astrue, one whose status is unknown or that Middleman no longer knows, and a request that named no model are withheld (body_state: withheld_raw_cot); metadata stays listed. The withholding targets reasoning that labs don't publish. Catalog models are public models, including open-weight reasoning models whose raw reasoning is public by design, so serving their bodies doesn't leak anything a lab keeps hidden. The assumption still rests on the catalogs: a catalog entry for a model whose lab does hide its reasoning is served until an admin recordsraw_cot: truefor it. Requests are covered because multi-turn requests resend earlier assistant turns with their reasoning. The flag is read at request time; a cached answer can withhold a body for up to a minute after the flag changes, but never releases one. Any lookup failure withholds the body. The rule is applied to the model the record names, so the same log-group and database writers could have a body served under a model it didn't come from. - Self-hosted models. A body is never served for a model served on the
deployment's own infrastructure: a config for the name, active or not, names a
lab with provider
self-hosted(active or not) or recordsprovider: self-hosted(body_state: withheld_self_hosted), whatever itsraw_cot. Inactive configs count so that deactivating such a model never releases its past bodies, even if a provider catalog lists the same name. Such a model can be an internal reader, sent other models' raw chain-of-thought, so its requests and responses are as sensitive as raw reasoning. It is read and cached likeraw_cot. Models discovered from provider catalogs with no config are never treated as self-hosted, so don't setprovider: self-hostedon a catalog lab's row. - Known gap: re-routing a self-hosted model. Like
raw_cot,self_hostedis read from the model's current config and lab, not recorded per request. So if a model name is moved from a self-hosted lab to an external one, or its lab'sprovideris changed away fromself-hosted(which Middleman allows, since it only lapsesinternal_reader), its past bodies become servable (when itsraw_cotisfalse), though they may hold other models' raw chain-of-thought sent while it was self-hosted. Don't re-point a self-hosted model name at an external lab, and don't relabel a lab that has served self-hosted models: register a new name (or lab) for the external route, and deactivate the old model (which keeps its bodies withheld). - Known gap: other models' output in a request. The raw-CoT check applies to the
model a record was sent to, but a request body can carry other models' output: a
scanner's request holds the scanned transcript, a model-graded scorer's or judge's
request holds the evaluated model's output, and multi-model evals do the same. So
reasoning from a model that returns raw chain-of-thought can appear in a served
request body when the called model is
raw_cot: false. The person who ran the job can generally already see those transcripts in Hawk; this makes them easy to pull into another model's context. - Known gap: other output-handling restrictions. Restrictions on who may process
a model's outputs other than
raw_cot(for example, zero-data-retention-only readers) aren't checked. - Audit. Every body read logs
traffic.body_readwith the caller'ssuband the request id, in the API's log group, whose retention ishawk:cloudwatchLogsRetentionDays(default 14 days). With body access on, keep it longer or forward it to a longer-lived store, and enable CloudTrail S3 data events on the bucket for an independent record.
Enabling body access¶
The traffic-log bucket's policy (with hawk:middlemanTrafficBreakGlassPrincipals
set) is deny-only: Middleman may put objects and break-glass principals may do
anything. hawk:middlemanTrafficApiBodyAccess: "true" (default off) adds the
Hawk API's task role as a reader: the policy then lets it s3:GetObject under
traffic/ and nothing else, and the role gets an IAM grant for exactly that (no
ListBucket). It makes the API able to read every stored body, so treat turning
it on as a change to the bucket's access model that needs security review. With
break-glass principals set, only a break-glass pulumi up can apply the bucket
policy change. Without the flag records say body_state: body_access_disabled,
the body endpoint answers 409 with that state, and listing still works.
Once it is on, anything that can act as the API's task role can read every stored
body, whoever it belongs to: the per-person checks are in the API's code, not in
AWS. That includes an operator with ECS Exec into the API's tasks
(hawk:ecsExecEnabled), any sidecar in the task, and code execution or SSRF in the
API that reaches the task's credentials. Running with both ecsExecEnabled and
body access on is an accepted operator risk; the deployment doesn't refuse it.
The /traffic endpoints have no per-person rate limit.
Sandbox Isolation¶
Evaluations run in isolated Kubernetes pods with:
- Separate namespaces — each evaluation gets its own namespace for the runner and sandbox pods
- Pod Security Admission — runner and sandbox namespaces enforce Kubernetes Baseline v1.35. The API server rejects privileged containers, host-path volumes, host namespaces and other Baseline violations, including Pods created directly by task or runner code. Warning and audit modes use the same policy version. This covers eval runners and scan orchestrators/workers in both credential modes, and sharded eval sets' orchestrators/workers. The one exception is the sandbox namespace of an eval set that sends the whole internet or an address range through its sandboxes' nodes, which warns and audits only.
- Network policies — Cilium network policies block egress to VPC infrastructure (primary subnet CIDR, EC2 IMDS, EKS Pod Identity) from sandbox pods, and can restrict no-internet pods to DNS-only egress
- No io_uring — on Kubernetes 1.33 or later,
defaultnodes and Karpenter's GPU nodes boot withkernel.io_uring_disabled=2and gVisor nodes with1:io_uring_setupfails withEPERMin every sandbox that runs on those nodes' kernel. Hawk doesn't boot EKS Hybrid Nodes, so set the sysctl on those yourself - Resource limits — CPU and memory constraints per pod
- StatefulSets — sandbox pods auto-restart on failure
Sandbox egress is deny-by-default; internet access is opt-in per task. For how to configure it per evaluation (and the main use case, cyber-related evals), see Sandbox Network Isolation.
With that one exception, Baseline applies at every Hawk isolation level, including standard, and allows
root users and writable root filesystems. The runner's sandbox-value validation
adds stricter checks, but admission enforces the Baseline floor independently of
that process. The policy version is pinned so upgrading Kubernetes does not
silently change the requirements. Use Kubernetes 1.35 or later to enforce all
v1.35 checks; older API servers only implement their own version's checks.
Runner Pods need no host cgroup mount: the hawk-memory-high-agent DaemonSet in
kube-system sets their soft memory limit from a Pod annotation. Runner namespace
policies do not apply to that node agent.
Runner Job templates are also checked by a ValidatingAdmissionPolicy using a
versioned CEL translation of Kubernetes' Baseline v1.35 checks. Template
violations fail submission with 403 Rejected by cluster policy and the policy's
explanation. This includes scan workers; a rejected launch cleans up the partial
release. Existing runner namespaces opt in when they acquire the v1.35 PSA labels.
PSA checks the final Pods, including changes made by Pod-only injectors after Job
admission. Hawk's existing five-minute failure sweep observes runner Jobs'
explicit PSA FailedCreate events, persists the
explanation and fails the run. It closes restricted credentials before cleaning
up the whole run, including siblings of a rejected scan worker. Status, logs and
the platform timeline retain the reason after Kubernetes cleanup. Cleanup is
retried independently of event retention; fix the template or injector and resume
explicitly. Other creation errors, such as quota or webhook availability failures,
keep their existing retry behavior. The sweep observes Kubernetes' actual rejection.
When updating the policy version, review the CEL translation against the matching
upstream checks
and update the namespace labels together. Focused real-cluster admission cases run
in infrastructure CI. To run them locally against a disposable Kubernetes 1.35+
cluster, set HAWK_ADMISSION_TEST_KUBECONFIG to its kubeconfig and run
uv run pytest infra/tests/test_runner_pod_security.py from the repository root.
Helm labels workload namespaces when it creates or upgrades an eval or scan release. Existing releases do not change just because the API is deployed. Applying the labels does not evict existing Pods, but subsequent Pod creation, including Job and StatefulSet replacements, must comply. See the upgrade notes.
Where the stack creates the EKS cluster, each job's chart also binds the hawk-operator Kubernetes group to
pod-log read (pods/log get) in that job's runner and sandbox namespaces, whatever its model groups. Only jobs
launched after the deploy get the binding; existing namespaces are not backfilled.
A sharded eval set's chart also gives its runner pods' service account a Role that can read (get) the release's
two Jobs, the orchestrator's and the workers', by name, and nothing else: the orchestrator learns from them which
worker pods have ended, and the workers whether the orchestrator has.
On Kata and Nitro Sandboxes, Hawk adds two init containers to each sandbox's default service that can take
them (see the upgrade notes), at every isolation level, to install
Inspect's sandbox tools before the sandbox starts (see Container images). The first runs the task's image as the task's
user: it records that user and the image's C library. The second runs Hawk's
sandbox-tools image (or, in a Nitro sandbox, the execd image built on it) as root, with every capability dropped except CHOWN, no privilege
escalation and a read-only root filesystem: it copies the tools into a memory-backed
volume and gives it to the task's user, and, where it runs the execd image, copies execd
into the pod's execd volume. Both have exited before the task's container
starts. The stage_sandbox_tools runtime flag turns them off.
Alternative Sandbox Providers¶
While Kubernetes is the default sandbox environment, Hawk's architecture does not strictly require it. EC2-based sandboxing and other providers (e.g., Modal) can be used as alternatives. The sandbox provider is configured per evaluation.
gVisor RuntimeClass and CNI mode¶
Set hawk:enableGvisor: "true" to install the gvisor RuntimeClass. Pods opt into gVisor with runtimeClassName: gvisor; the RuntimeClass uses the pinned runsc runtime. Enabling it adds an AL2023 node class and pool for gVisor pods, so the runtime can be installed during node bootstrap; the default node class stays on Bottlerocket. The AL2023 node configuration preserves single-process OOM killing for workload containers.
The default hawk:ciliumExclusive: "false" keeps Cilium chained to AWS VPC CNI and retains the default RFC 1918 Cilium pod pool. Exclusive mode makes Cilium the node CNI, uses an RFC 1918 overlay pod pool, and retires the aws-node DaemonSet after Cilium is ready. Treat that as a CNI migration for existing clusters: plan node recycling and a rollback path before enabling it.
Nitro Sandboxes¶
With hawk:enableNitroSandbox, sandboxes whose eval set names runtime_class: nitro run in AWS Nitro Sandboxes, and so do strict sandboxes that name no runtime_class while the strict_runs_on_nitro runtime flag is on, with the exceptions listed there. Each pod is its own Firecracker microVM, on dedicated node pools (see Configuration). Cilium's policies apply at the pod's host-side interface. The guest itself answers instance metadata requests for its region and zone, where no network policy reaches, so the runner adds a Cedar policy annotation (sandbox.amazonaws.com/policy) that denies them; tasks can't set pod annotations. The guest answers EKS Pod Identity requests itself too, and no Cedar action denies those: a sandbox gets no credentials because its service account has no Pod Identity association. On the node, a per-pod shim and the CRI proxy run as root and parse what the guest sends. Each node downloads the runtime at boot from AWS and GitHub, checked against hashes pinned in the repository, and installs erofs-utils from Amazon Linux's package repository.
On a cluster Hawk creates, root in a guest can load only kernel modules AWS signed, and no UIO or VFIO driver; it cannot replace the running kernel or write to its memory. A process can write to read-only memory through /proc/<pid>/mem only in a process it traces. io_uring is off, and the kernel loads no module on a process's request, until root in a guest turns either back on. 32-bit programs are off in a nitro guest unless hawk:nitroRefuse32Bit is false, and on in a nitro-32bit one: a process in a guest that runs them can open an AF_VSOCK socket with a 32-bit system call, which the runtime's default seccomp profile does not refuse. The nodes' kubelet gives that profile to every unprivileged container that names none.
In a Nitro sandbox, the runner sends commands and files over TLS on port 14601 to execd, a daemon an init container copies into each pod. A network policy admits only the eval set's runner namespace to that port, and denies it to the sandbox's own pods whatever another policy admits; the runner pins the certificate fingerprint execd prints when an exec starts it, and authenticates with a key generated for each start. A root process in the sandbox can stop or impersonate execd only for its own sandbox. A sandbox with no network card has no such port or policy: the runner reaches execd through one Kubernetes exec, with the same pinned certificate and key, and a Cedar rule has the guest start no container unless AWS denies it all egress. Its commands and files then cross the API server, and a call in flight fails if the runner cannot reopen that exec within 5 minutes of losing it. The runner writes to that exec at most 64 KiB at a time, a millisecond apart: a Nitro Sandbox can reorder or drop an exec's stdin above that (aws/containers-roadmap#2913).
A runner image from before it supported a Nitro class adds neither execd nor the Cedar policy. The API refuses an eval set that names nitro or nitro-32bit and pins a runner image, but not one whose task names the class in its own sandbox values: pinned to such a runner, that task runs in a Nitro Sandbox whose guest answers instance metadata.
strict without a network card¶
Unless hawk:nitroWithoutNetworkCard is false, a strict sandbox in a Nitro Sandbox
boots with no network card if all of these hold:
- no two of its services share a network, or they take the route below;
- it names no host or address range, none of its services is on a network (
network_mode: none), or what it names takes the route below; - it has no HTTP, TCP or gRPC probe;
- it asks for no extra DNS record (
additionalDnsRecords).
Off that route, such a sandbox's VM is up to one vCPU and 128 MiB smaller, the DNS sidecar's share, so
results from before and after the change are not directly comparable. The VM keeps its vsock,
a channel to processes on its node
(AWS's note,
Firecracker's vsock).
The runtime's default seccomp profile, which every strict container but a forwarder (below) runs under, refuses a
socket on it, except through the 32-bit socketcall where
the guest runs 32-bit programs. From containerd 2.3.7, which the node
image of a cluster Hawk creates carries, it refuses that socket's family written with a high
bit set too; an older profile lets that through.
With hawk:egressOverVsock on, a
sandbox with no network card reaches its sample's
egress proxy and its sibling services through its node,
over TCP alone. What takes that route:
| What a sandbox uses | Takes the route |
|---|---|
The hosts it names (allow_domains, allow_requests) |
Always |
The whole internet (allow_domains: ["*"]) or an address range (allow_cidr), on a task item that names runtime_class: nitro or nitro-32bit and grants no GPU |
In an eval set as below. In any other, the launch is refused |
| Services of its own that share a network | In an eval set as below. In any other, the sandbox keeps its card |
Such an eval set grants a task item the whole internet or an address range, and every one of
its task items is strict, grants no GPU and names nitro or nitro-32bit, while
strict runs on Nitro. An item that names no runtime_class
does not count, since its sandbox may run under gVisor: like one that grants a GPU, it keeps
* on its card, which the network policy opens, and is refused a range.
A sandbox also keeps its card if one of its services:
- takes the route and declares TCP or UDP port 3128, which its forwarder (below) holds;
- shares a network with another and declares a port that is not TCP, which a compose file does with
expose("9000/udp"); - shares a network with another and has no DNS record or port (
dnsRecord,ports; a compose file's services always have one): a sibling is reached by its name alone.
A sandbox whose whole internet or address range takes the route has no card to keep: a probe, an extra DNS record, or either of the first two conditions here refuses it as its eval set starts, and a service with no DNS record or port is only out of its siblings' reach.
A pod on the route runs vsock-egress's forwarder in its DNS sidecar's place, an init container
that requests 500m of CPU and 256Mi of memory: its VM is larger than with a card, by 128 MiB
and up to one vCPU. A pod with a sibling to reach, or of a sandbox granted the whole internet
or a range, also runs an init container named
egress-redirector-with-a-name-too-long-for-any-service-to-share as root with NET_ADMIN,
before any of the task's containers. Pod Security's Baseline refuses that capability, so the
API creates the sandbox namespace of an eval set as above, and of no other, with
pod-security.kubernetes.io/enforce: privileged, and warn and audit at Baseline. Hawk's
final Pod admission
alone then holds its pods, and admits none there that is not a Nitro Sandbox.
A stack that creates its cluster runs these for the route:
- A launcher on every Nitro node but the egress proxies', the DaemonSet
kube-system/hawk-vsock-egress, as root withSYS_ADMIN. It puts the forwarder's seccomp profile on its node, and starts a worker for each pod on the route. - A startup taint,
hawk.metr.org/vsock-egress-not-ready, on each new node of those pools, which no sandbox may tolerate. The Deploymentkube-system/hawk-vsock-egress-tainttakes it off once the node's launcher is Ready, and a ValidatingAdmissionPolicy of that name holds its credential to that one change.
Two ValidatingAdmissionPolicies guard the forwarder's profile, which allows sockets on the VM's vsock. Every stack that creates its cluster with Nitro Sandboxes has them, whatever the setting:
hawk-vsock-egress-seccomprefuses every pod that names the profile. With the setting on, it admits the sandbox chart's forwarder alone, as the chart renders it and from the cluster's<env>/hawk/egress-over-vsockrepository, and does not hold in a namespace labelledhawk-vsock-egress-gate: "true": label only the one thatvsock-egress/gate.shof the pinnedinspect-k8s-sandboxruns in.hawk-vsock-egress-execrefuses, in every namespace, a command run (exec) in a container named as the chart names its redirect's or its forwarder's, all but/vsock-egress canaryin the forwarder's, whichgate.shruns.
They keep other pods and other commands from the profile, not a guest that runs 32-bit programs from the vsock: there the node's worker refuses a stream that lacks the forwarder's key.
Every deploy with the setting on needs kubectl. The first one also:
- stops before it creates the DaemonSet if any pod names the forwarder's seccomp profile, listing them: delete those pods and deploy again;
- remakes the label the Nitro RuntimeClasses select nodes by: a Nitro node from before it takes no new sandbox, and Karpenter replaces it as it empties.
If you run your own admission policies, allow the DaemonSet's pod: root, with SYS_ADMIN,
SETUID and SETGID, and the node's /var/lib/kubelet/seccomp,
/var/lib/nitro-sandbox/firecracker, /var/lib/cni/results and /run/netns, under the
Localhost seccomp profile profiles/vsock-egress-launcher.json. Allow each sandbox pod on
the route its forwarder init container too, under the Localhost profile
profiles/vsock-egress.json, with the egress-forwarder-key emptyDir it mounts, and its
redirect init container: root with NET_ADMIN, the command /vsock-egress redirect or
/vsock-egress capture, and no arguments, environment or mounts.
New launches take the route once the DaemonSet exists; a stack on another stack's cluster
takes it once it is deployed after that cluster's owner has the setting on: until then its
sandboxes keep their card, and it refuses what only the route carries. While the two stacks
pin different inspect-k8s-sandbox commits, it carries named hosts alone.
A new node whose launcher does not become Ready keeps its taint and takes no sandbox.
A launcher pod keeps the template it was created from: where one cannot start, fix the
cause, deploy, and delete that pod.
Where Datadog is on, shared monitors alert for a node with no ready launcher, a taint that is
not being lifted, a launcher that cannot serve a sandbox, and a worker the kernel ended for a
system call no worker makes. Treat the sandbox of that last alert as having run code on its node.
Setting it back to false and deploying removes the DaemonSet and the image, and a sandbox
still on the route loses its egress: stop the eval sets that use it first. Like turning it
on, that deploy leaves the Nitro nodes from before it taking no new sandbox, and a sandbox
pending across either deploy may get no node. A stack that
shares the cluster keeps handing its runners the removed image until it is deployed with the
setting off, so turn it off there first. The profile stays on a node for the node's life,
and the policies stay, the first in a namespace labelled for the gate too: it goes on
refusing every pod that names the profile. Turning hawk:enableNitroSandbox off removes
them while the Nitro nodes drain: stop the eval sets on Nitro before that deploy.
Egress proxy for strict sandboxes¶
hawk:egressThroughProxy (true by default where hawk:enableNitroSandbox or
hawk:enableGvisor is on) puts a proxy pod
between a strict sandbox and the hosts its eval set names.
The egress proxy says
which sandboxes get one and what the proxy refuses. Setting it to false and
deploying sends later launches and resumes back to the network policy, and refuses
those whose eval set sets allow_requests, grants an address range, or grants the whole
internet to a strict item that names a Nitro class and grants no GPU.
- Image. Upstream's Envoy, which nodes pull from Docker Hub. Admission runs only the
images in
EGRESS_PROXY_IMAGES(infra/hawk/pod_security.py): on a bump, keep the previous one there until no running eval set uses it, and remove an image to retire it. - CA. Unless the sandbox is granted the whole internet or an address range, each
service, except one with
network_mode: none, carries the sample's CA and a wget configuration in the pod annotationsinspect-ai.metr.org/egress-proxy-caandinspect-ai.metr.org/egress-proxy-wgetrc, which the kubelet writes to adownwardAPIvolume,egress-proxy-trust. Allow both annotations and the volume if you run your own admission policies. - Request log. Best effort: it can lose records, and enforcement doesn't depend on
it. The proxy's output, which
hawk logsleaves out. The pod log archive (hawk:podLogArchiveEnabled) keeps it: log group<env>/hawk/pod-logs, streams ending in-egress-proxy-0.egress-proxy. So does Datadog, where its agent collects container logs. Each line carries the sample's UUID. A request the proxy would send on waits while its line can't be written, and gets a 503 if the write fails. Past a budget, refusals and a named host's tunnels write no line: each of the proxy's two workers records 1,000 of each at once and 10 a second, and counts what it leaves out in theunrecordedfield of its nextRequestline. Requests it sends on have no budget, nor has a connection it carries for the whole internet or an address range, and the archive drops its oldest lines past its buffer: a sandbox that floods the log can push lines out of it. - Credentials and keys. A rule's
credential, and the key the proxy answers the sample's HTTPS with, sit in the sample's Secret, in Helm's record of the sample's release, which is a Secret of the same namespace, and in its proxy pod. On gVisor that pod shares nodes with other eval sets' sandboxes. As a Nitro Sandbox it runs on nodes that take no sandbox: the runner places it there, and admission keeps sandbox pods off those nodes but does not hold a proxy to them. Whoever takes a proxy's node can read them, and whoever takes a sandbox's node can still send requests through the proxies of the samples running there. The runner pod holds both too, in the values file it gives Helm. A sample's epochs share one CA and key, each on a proxy of its own. Pod admission lets a sandbox namespace's Secret only to that Pod: one container on an imageEGRESS_PROXY_IMAGESlists, with the proxy's own arguments, and no volume but the Secret named for it. A task's code in the runner could start such a Pod; an agent cannot. - Placement and cost. One pod per sample, in the sandboxes' Kueue queue. Where the
deployment runs
strictin Nitro Sandboxes, it is a Nitro Sandbox of 1 CPU and 2Gi of memory, which also requests 10Gi of disk and counts a Nitro pod's 768Mi of overhead, whatever its own sandbox runs on. Otherwise it runs on gVisor, requests 150m of CPU and 512Mi of memory, and may hold 2Gi. Where that class isn't installed, astrictsandbox that names hosts is refused.
Audit Logging¶
Application-Level Logging¶
- Hawk API — all API requests are logged to CloudWatch with user identity,
action, and resource context (the eval set or sample a request resolved).
Query strings are not logged, with two exceptions, each cut to its first 256
characters: transcript search (
/meta/searchand a sample's/matches) records the search term, so an access review can see what was searched, not only that a search ran, and a run's file listing (/eval_sets/{id}/files,/scans/{id}/files) records theprefixit listed. A submission with a floating package source logsFloating package sourceswith the caller, the job, each source and whether the deployment refused it, so the warn mode still leaves a record of every launch whose code its submitter can change later. Eachapi_requestrecord names its caller withauth_kind(user,m2mfor a client-credentials token,delegatedfor a token a user minted to share their read access,restrictedfor an execution's token,anonymouswhen no credential was sent,auth_failedwhen one was rejected, including a delegated or execution token on a route that doesn't take it),user_sub(the token's stable subject),user_email, anduser_label(the email, else the M2M client id, else the subject). The two token-service kinds differ in whose emailuser_emailholds: a delegated token acts as its minter, so it carries the minter's email, with the minter's subject inminter_sub; an execution's token carries none, and the user the execution runs for is only theuser_label, so filtering onuser_emailnever counts an execution's requests as that user's own. Request spans carry the same ashawk.auth.kind,hawk.user.id,hawk.user.emailandhawk.user.label, and Sentry events carry the caller's id, email and label. Tokens are never logged. - Presigned downloads — a download from a presigned link goes straight to
S3, so issuing the link is the record Hawk keeps. Every route that issues
links logs
presigned_download_issuedwith the caller, the eval sets or scans, every path issued and the request log'srequest_id. Most also log a refusal aspresigned_download_denied, with the first 50 paths; a refused sample artifact link, and a refusal by Inspect's own viewer routes, appear only in the request log. A link isn't proof of a download, and it works for whoever holds it until it expires: 15 minutes, or an hour for links Inspect's viewer routes issue. - Middleman — at the default
summarytraffic-log level, model API calls are logged with user identity, public model name, token usage, and body sizes, but request/response bodies are not retained. Athawk:middlemanTrafficLogLevel: full, bounded raw bodies are archived in S3: known headers and the exact top-levelapi_keyfield in a parseable JSON request object are redacted, but other request values and response bodies are not value-scrubbed. Treat this archive as sensitive. Each entry also carries Middleman's cost estimate for the request (cost_usd,cost_partial) and the service tier and speed the provider reported, and CloudWatch receives the estimate asEstimatedCostUSDper model only. Every request made with a token is also copied to the warehouse, readable through the API only by that token's person (database administrators can read every row); see Your own Middleman traffic. - Token Broker — credential exchanges are logged with user identity and requested scope; GitHub tokens with the job, the repository and why it was allowed, since no user token backs them
Warehouse database log¶
Aurora exports the warehouse's PostgreSQL log to the CloudWatch log group
/aws/rds/cluster/<cluster>/postgresql. With hawk:dbLogAllStatements it holds
every statement from the read-only roles and the admin (service roles are
excluded per role), and with hawk:dbPgAudit it also holds pgaudit's AUDIT:
lines. Every login people use (the read-only users and the admin) is audited in
full, and so is the token broker's code-policy login (inspect-log-reader), whose
statements are its access decisions. The importer, the Middleman traffic ingester and the model-group audit
login aren't audited at all: their statements are bulk ingest and per-row
lookups that would swamp the log. The API's and Middleman's shared logins are
audited for writes, DDL and role changes, not reads: the API's reads were about
99% of the audit volume in a trial, and a shared login can't say who read what,
which the API's own request log records. These per-login settings are applied
by the deploy that follows the writer reboot; between the reboot and that
deploy every login is audited at the cluster-wide classes, so don't leave a gap
between them. Together the lines record who
read which evals, so treat the group as an access audit that only break-glass
principals may read.
Hawk cannot enforce that on the log group itself, and nothing in this repository tries to:
- Resource policies don't bind reads. CloudWatch Logs accepts a log-group
resource policy that denies
GetLogEventsto the account, but enforces resource policies only for AWS service principals; IAM users and roles read the group as before. - A KMS key doesn't either. With a customer-managed key on the log group,
CloudWatch Logs decrypts as the service. A role that has
logs:GetLogEvents,logs:FilterLogEventsorlogs:StartQueryreads the events with nokms:Decryptgrant on the key at all.
Both were tested against a scratch log group in a staging account. The control
that works is an identity-policy Deny on every principal that isn't
break-glass, or an SCP where the account isn't the organization's management
account. Deny logs:GetLogEvents, logs:FilterLogEvents, logs:StartQuery,
logs:GetQueryResults, logs:GetLogRecord, logs:StartLiveTail and
logs:CreateExportTask on
arn:aws:logs:*:<account>:log-group:/aws/rds/*/postgresql* (the trailing *
covers the :* and log-stream ARN forms and leaves iam-db-auth-error readable),
plus rds:DownloadDBLogFilePortion and rds:DownloadCompleteDBLogFile on the
cluster's instances for the on-instance copy. GetQueryResults and
GetLogRecord authorize against the queried log group, so a denied role can't
read the log through someone else's Insights query either. Reads aren't the
only way out: deny logs:PutSubscriptionFilter on the same group ARN, or a
role streams it to a Lambda, Firehose or cross-account destination it controls
without calling any read API, and deny logs:PutAccountPolicy on *, since an
account-level subscription policy isn't scoped to a log group at all. METR's
private infra-shared repository attaches the read deny to every
non-break-glass permission set in production and denies the per-group
subscription filter organization-wide through an SCP.
Keep the group out of log forwarders. Datadog's AWS integration subscribes every
RDS log group to its forwarder when rds is among its log sources, which copies
the log to everyone with Datadog log access and bills its volume there. Check
aws logs describe-subscription-filters on the group after enabling pgaudit.
AWS CloudTrail¶
Hawk does not provision a CloudTrail trail. Configure organization- or
account-level trails, destinations, retention, and optional CloudTrail Insights
outside this repository. In METR's deployment, AWS Control Tower supplies the
organization trail and its existing destinations; METR's private
infra-shared repository adopts that trail to configure Insights and selected
data events and adds query and monitoring integration. Infra-shared does not
create the Control Tower log bucket/log group or control their retention.
VPC Flow Logs¶
Hawk does not provision VPC Flow Logs. If you need network-level audit logging,
enable VPC Flow Logs separately and choose a CloudWatch Logs or S3 destination
and retention policy that fits your deployment.
hawk:cloudwatchLogsRetentionDays (default: 14 days) does not control a
separately managed flow-log group. METR's infra-shared deployment enables
all-traffic flow logs for staging and production at
/aws/vpc/flowlogs/<env> with 365-day CloudWatch retention; production also
uses an S3 destination.
Endpoint Protection (CrowdStrike Falcon)¶
Hawk optionally deploys the CrowdStrike Falcon sensor to protect infrastructure hosts. Enable it with hawk:enableCrowdstrike: "true" and a Secrets Manager secret containing your CrowdStrike API credentials (see Configuration).
What's Protected¶
| Target | OS / Arch | Installation Method |
|---|---|---|
| All EKS nodes (Karpenter) | Bottlerocket and AL2023 | DaemonSet via falcon-sensor Helm chart (requires Falcon Images Download scope) |
| Tailscale subnet router | AL2023 / ARM64 | Sensor RPM installed via cloud-init at boot |
EKS nodes get the sensor from the DaemonSet and only from the DaemonSet. GPU nodes once also installed it as a host RPM from EC2NodeClass userData; they no longer do, because a node cannot run both — the containerized sensor exits immediately on a host that already owns /opt/CrowdStrike, leaving its pod in CrashLoopBackOff. Hosts outside EKS have no DaemonSet to rely on and still install the RPM.
Falcon node sensors up to 7.30 stop detecting on kernel 6.18, which Bottlerocket ships from Kubernetes 1.36. With Falcon enabled on 1.36+, the default Karpenter pools boot the Bottlerocket 1.35 variant (kernel 6.12) instead, whatever sensor version the secret's image_tag names. The AL2023 pools for gVisor, glovebox and Nitro Sandboxes run kernel 6.18, so such a sensor runs blind on them.
The DaemonSet pulls a container image from registry.crowdstrike.com, which requires the Falcon Images Download: Read scope — part of the Falcon Cloud Security with Containers add-on. The subnet router downloads its RPM from the CrowdStrike API at boot using the Sensor Download: Read scope.
Tailscale ZTA Integration¶
With the Falcon sensor on the subnet router, you can enable CrowdStrike ZTA with Tailscale to gate tailnet access based on device posture. This requires a separate API client with Hosts: Read and Zero Trust: Read scopes, configured in the Tailscale admin console under Device Posture Integrations. Note that ZTA scores apply to the router instance itself, not to traffic routed through it.
Runtime feature flags¶
Operators can change runtime flags without a merge, deployment, or API restart.
Each deployment gets an AWS AppConfig
feature-flags profile from Pulumi: application <env>-hawk-api-feature-flags,
environment <env>, configuration profile feature-flags. The API reads the
deployed configuration on demand and caches it for ten seconds, so a toggle reaches
every replica within about that long. Requests that already read the flag finish
under the previous value, and changing a flag does not stop running jobs.
| Flag | Section |
|---|---|
restricted_credentials_by_default |
Credential mode |
allow_sensitive_cross_lab_scan_override |
Cross-lab scan overrides |
refuse_floating_package_sources |
Floating package sources |
stage_sandbox_tools |
Staging sandbox tools |
strict_runs_on_nitro |
Which runtime strict uses |
strict_refuses_server_side_tools |
Provider-side tools at strict |
allow_job_purge |
Purging jobs |
Purging jobs¶
hawk purge (user guide)
erases a job's S3 folder and warehouse rows for good. It has two switches:
hawk:enableJobPurge(configuration, off by default) deploys the worker, thejob_purgerBatch job, and lets the API accept requests. Its role is the only one allowed to delete object versions, underevals/andscans/only; it connects to the database as the system user, reads the flag store, and is on the inspect bucket's deny allowlist. Without the setting, the API refuses every purge with a 403. It needshawk:enableHawkS3Triggers, whose bucket notification starts the worker.allow_job_purge(off by default) is read by the API before it accepts a request (403 while off, 503 if the flag store can't be read) and again by the worker before it touches the database or S3. A worker that finds it off, or can't read it, deletes nothing and fails; Batch retries once, then the request lands in the purger's dead-letter queue. Each refusal also reports an error to Sentry, so expect one per accepted purge after turning the flag off.
Turning the flag off therefore also stops purges already accepted, and their
retries. That includes a purge that failed partway and has already erased the logs:
its rows stay until the flag is back on and hawk purge is run again. The API
caches the flag for up to ten seconds, so a request can still be accepted just
after the flag goes off; its worker then refuses it. The worker reads the flag once
per attempt, so one already past its check finishes that attempt.
Floating package sources¶
Every eval set and scan declares the code it installs (see
code-access rules). At submission the API also notes which of
those sources can change content between runs: a Git source with no ref or with a
branch or tag instead of a 40-character commit, and a registry package that the one-week
cooldown exempts (inspect-ai, inspect-test-utils; see [tool.uv.exclude-newer-package]
in hawk/pyproject.toml) declared without an exact == version. code_sources entries
are recorded, not installed, so they are not judged. The cooldown covers none of these: a moved tag or a pushed branch reaches the
next job at once. The API never fetches a ref to classify it, so the check covers declared
sources only. A dependency that a declared package itself pulls in at a branch or tag is
installed unseen, and so are runner.image, runner.image_tag and code that task code
downloads at run time. A 40-character commit fixes the content, not its origin: GitHub
serves a commit that exists only in a fork through the parent repository's URL, so the
recorded <org>/<repo> names the URL that was fetched, not where the commit was authored.
refuse_floating_package_sources decides what happens. Off (the default), the API
launches the run and returns one warning per floating source: hawk eval-set run,
hawk human eval start, hawk scan run and hawk scan resume print them to stderr after
the job starts, and a scanner_models submission reports them once for all its sibling
scans. On, the API refuses the
submission with a 403 that names each floating source; a resume re-reads the saved config,
so an eval set first launched at a branch or tag is refused until it is resubmitted with a
pinned config, and a scan, whose resume cannot change its config, must be run again under a
new ID. If the flag store cannot be read, a
run with floating sources fails with a 503; fully pinned runs never
read the flag. A profile created before this flag existed has no entry for it; the API
then uses the default, so add the entry when you first toggle it.
Staging sandbox tools¶
stage_sandbox_tools (on by default) has runners install Inspect's sandbox tools in Kata
and Nitro sandboxes before they start (see Sandbox Isolation). Off, the API
gives runners no tools image and Inspect copies its tools into each sandbox on its first
tool call; runs already launched keep what they launched with. If the flag store cannot
be read, this flag does not fail the launch on its own: the API stages nothing.
Which runtime strict uses¶
A strict sandbox that names no runtime_class runs in a Nitro Sandbox while
strict_runs_on_nitro is on (the default), the deployment installs them
(hawk:enableNitroSandbox, see Nitro Sandboxes) and its runner's
inspect-k8s-sandbox is the commit the deployment built execd from, in the layout the
runner's release expects. Otherwise it runs under gVisor, or is refused on a deployment
without it. A sandbox that
isolation.runtime_class
says gVisor keeps runs as it would with the flag off, and eval sets that name a
runtime_class keep it. A sample's
egress proxy follows the flag whatever its sandbox
names.
Each launch and resume reads the flag, so an eval set already running keeps its runtime
until it is stopped and resumed. If the flag store cannot be read, a launch the flag
could change fails with a 503.
Provider-side tools at strict¶
strict_refuses_server_side_tools (off by default) controls whether the API stores
restricted_server_side_tools on the grant of an eval set that runs at strict isolation with
restricted credentials. The tokens of such a grant do not have the permission
middleman:use@server-tools, so Middleman rejects the eval set's model requests
that use provider-side web tools or reference content by URL or file ID (see
Executions that cannot use provider-side tools).
- Off: the API stores nothing. Middleman rejects nothing more than for any restricted execution.
- On: the API stores it, unless the eval set sets
isolation.allow_server_side_tools: true. The launch returns a warning that says which requests are rejected and names that setting.
Turn the flag on only after all of these are true (upgrade note):
- Middleman runs a release that checks
middleman:use@server-tools. A Middleman that reads version 2 tokens and does not check the permission accepts the token and rejects nothing more. - The Hawk API and the token broker run a release that reads version 2 tokens. The tokens of such a grant are version 2 tokens, and an older service rejects them.
- Every Hawk API pod runs a release that has this flag. An older Hawk API cannot read a
grant that stores
restricted_server_side_tools.
Before you turn the flag on, search Middleman's log for restricted.server_side_tools_used.
Middleman writes that line for each restricted request that passes only because its token has
the permission: subject is execution:<execution_id> and detail is what Middleman would
have rejected. A strict eval set whose executions appear there gets 400 for those
requests once the flag is on.
A launch or resume of an eval set with restricted credentials reads the flag in two cases:
- The eval set is at
strictand does not setallow_server_side_tools. - The eval set is not at
strictand hasstricttask items. While the flag is on, the launch returns a warning that names them, because they keep the permission.
If the flag store cannot be read, that launch fails with a 503. An eval set that is already
running keeps its grant until it is resumed, so turning the flag off stops new launches
from storing restricted_server_side_tools and does not change running eval sets.
Toggling a flag¶
In the AWS console: AWS AppConfig → Applications → <env>-hawk-api-feature-flags
→ Configuration profiles → feature-flags, flip the flag, Save new version,
then Start deployment into the <env> environment with the AppConfig.AllAtOnce
strategy. The same two steps from the CLI, using the IDs shown in the console:
cat > flags.json <<'JSON'
{"version": "1",
"flags": {"allow_sensitive_cross_lab_scan_override": {"name": "allow_sensitive_cross_lab_scan_override"}},
"values": {"allow_sensitive_cross_lab_scan_override": {"enabled": true}}}
JSON
configuration_version=$(aws appconfig create-hosted-configuration-version --application-id <app-id> \
--configuration-profile-id <profile-id> --content-type application/json \
--content fileb://flags.json --query VersionNumber --output text /dev/null)
aws appconfig start-deployment --application-id <app-id> --environment-id <env-id> \
--configuration-profile-id <profile-id> --deployment-strategy-id AppConfig.AllAtOnce \
--configuration-version "$configuration_version"
The file is the whole profile: a flag it leaves out returns to its default.
Deployments use the built-in AppConfig.AllAtOnce strategy: the new value is served
immediately, then the environment bakes for ten minutes, during which
StartDeployment is rejected with ConflictException. To reverse a toggle inside
that window, stop the in-flight deployment instead. That rolls the environment back
to the previous version, which means every flag in the profile, not just the one you
changed:
aws appconfig stop-deployment --application-id <app-id> --environment-id <env-id> \
--deployment-number "$(aws appconfig list-deployments --application-id <app-id> \
--environment-id <env-id> --query 'Items[0].DeploymentNumber' --output text)"
Right after Pulumi seeds the profile (the stack's first deploy) there is no earlier version to roll back to, so the first toggle may have to wait out that bake. The bake is kept deliberately: it is what lets AppConfig roll back automatically if CloudWatch alarms are ever attached to the environment.
Every flag declares a default in the hawk_flags package: the value in effect
until an operator changes it. A flag that is absent from the deployed configuration,
or whose enabled value is not a JSON boolean, uses that default, as does a
deployment with no HAWK_API_FEATURE_FLAGS_* settings. The API logs a warning when
it reads a malformed flag. For an absent one, each API process logs one info line when it
first finds the flag missing. If AppConfig cannot be read
(access denied, throttling, nothing deployed yet), each flag's section says what
happens.
Pulumi seeds the profile with every flag at its default when its AppConfig resources are first created. Later updates ignore changes to the seed content and the seed deployment's version, strategy, description and encryption key, so those edits do not replay the defaults over operator toggles. A flag added to Hawk later is absent from an existing environment's profile and runs at its default there; to toggle it, add it to the profile in the console first. Changing a flag's default in code likewise reaches only new profiles and environments where the flag is absent: wherever an operator's version carries the flag, its deployed value stands.
This protection does not cover forced replacement or recreation after losing Pulumi state. Replacing the AppConfig application, environment or profile also initializes the new target with the defaults. Preserve the current flag values before these operations and restore them afterwards if needed.
AWS Security Services¶
In METR's deployment, AWS security services (GuardDuty, Security Hub, AWS
Config, and CloudTrail Insights) are managed by METR's private infra-shared
repository, not by Hawk. Other Hawk operators must configure equivalent
account- or organization-level services separately.
Recommended Security Configuration¶
For production deployments, consider:
- Setting
hawk:eksPublicEndpoint: "false"and using Tailscale for private cluster access. If the public EKS API endpoint must remain enabled, sethawk:eksPublicAccessCidrsto restrict it to approved source CIDRs; omitting it preserves AWS's0.0.0.0/0default. - Setting
hawk:albInternal: "true"to make the ALB private (requires VPN) - Setting
hawk:protectResources: "true"to prevent accidental deletion of stateful resources (S3 buckets, secrets, the Datadog log-archive bucket, the Aurora cluster, and the EKS and Aurora log groups)
Monitoring & Observability¶
CloudWatch¶
Hawk's application and service logs go to CloudWatch by default. The Hawk-owned
groups configured with hawk:cloudwatchLogsRetentionDays retain 14 days by
default. The EKS control-plane (including audit) and Aurora log groups follow
hawk:clusterLogsRetentionDays instead. A group never expires until it is set;
clearing it afterwards leaves the retention it last applied in place.
Middleman's traffic log group (<env>/middleman/traffic) follows
hawk:middlemanTrafficLogRetentionDays and never expires unless that is set.
Each event records who made a model call: their user id, email, groups, source
IP and user agent. The traffic bucket can be made break-glass-only, but the log
group has no equivalent: anyone whose IAM policies allow reading CloudWatch Logs
in the account can read it. Hawk itself only lets the API's task role query it
and delivers its events to the ingester Lambda; limit other read access
(logs:GetLogEvents, logs:FilterLogEvents, logs:StartQuery) to the
operators who need it.
Key Hawk-owned log groups include:
- Hawk API logs
- Middleman logs
- Lambda function logs
In METR's deployment, infra-shared separately owns the GuardDuty and Security
Hub finding groups at /aws/events/guardduty/<env> and
/aws/events/securityhub/<env>. They retain 365 days and are not controlled by
hawk:cloudwatchLogsRetentionDays.
When hawk:cloudwatchDashboardsEnabled is on, the <env>-hawk-alerts
dashboard can chart and list those findings: set
hawk:guarddutyFindingsLogGroup and hawk:securityHubFindingsLogGroup to the
log groups your EventBridge rules write GuardDuty findings and Security Hub
findings to (the groups above, in METR's case). Neither service publishes
useful CloudWatch metrics, so the widgets are Logs Insights queries over the
stored EventBridge event JSON: findings per hour by severity and a table of the
latest findings, for each service. Leave a key unset if the group does not
exist in your account; the dashboard then shows a note on how to enable it
instead of a broken widget. Dev environments inherit both keys from the stg
stack, since the services are account-wide.
The same dashboard also has a single warnings-and-errors feed across every Hawk service log group (API, middleman, relay, the Batch importers, the Lambdas including the traffic-log ingester, live ingest and the viewers), so an operator does not have to know which service to look at first.
Datadog (Optional)¶
For richer monitoring, Hawk supports Datadog integration:
This enables:
- APM — distributed tracing across API, Middleman, and Lambda functions
- Log forwarding — CloudWatch logs forwarded to Datadog
- Custom metrics — token usage, import counts, evaluation durations
- Sensitive data filtering — known sensitive fields and auth headers are removed, while model fields and tags use public names. Model-bearing URL scrubbing is best-effort for recognized provider forms; arbitrary text and unrecognized URLs are not guaranteed to be value-scrubbed. The optional full Middleman traffic archive follows the narrower body-redaction rules described above.
Budget Alerts¶
Monitor AWS spending with budget alerts:
hawk:budgetLimit: "10000"
hawk:budgetNotificationEmails:
- "team@example.com"
hawk:budgetNotificationThresholds:
- 80
- 100
External Dependencies¶
Hawk interacts with the following external services:
| Service | Purpose | Required? |
|---|---|---|
| Docker Hub | Pull base container images | Yes (login recommended to avoid rate limits) |
| LLM Providers | Model API calls via Middleman | At least one provider API key required |
| OIDC Provider | User authentication | Optional (Cognito used by default) |
| Datadog | Monitoring and observability | Optional |
| Slack | Budget alerts | Optional |
| CrowdStrike Falcon | Endpoint protection for EKS nodes and subnet router | Optional |
| Tailscale | Private VPC, EKS API, and internal ALB access | Optional |
| Cloudflare | DNS delegation | Optional |
| GitHub | CI/CD via Pulumi Deploy; with a GitHub App, the token broker mints runners' repository tokens through api.github.com |
Optional |
| LiteLLM price catalog | Middleman fetches model_prices_and_context_window.json from the LiteLLM repository's main branch (unpinned, unauthenticated) to price requests, shares the file through Valkey when configured (so whoever can write to Valkey can set the rates every worker records; the copy is hash-checked but not signed), and records each catalog's fetch time and hash on the entries it priced; a wrong rate there is recorded permanently, bounded only by a per-token sanity cap |
Optional (costs stay partial without it) |
Network Security¶
- TLS by default — external service traffic uses ACM certificates unless an
operator explicitly enables the testing-only
hawk:skipTlsCertsHTTP mode - Private subnets — EKS nodes, RDS, and ECS tasks run in private subnets with no direct internet access
- NAT gateway — the default VPC routes outbound internet access from all private subnets through one shared NAT gateway
- Security groups — restrict traffic between components (ALB → ECS, ECS → RDS, etc.)
- VPC endpoints — S3 traffic stays within the VPC via a Gateway endpoint
- Cilium network policies — pod-level network isolation within Kubernetes
- Peered VPCs —
hawk:peeredVpcsreach the internal ALB, andhawk:middlemanTailnetPeersreach only Middleman's tailnet ingress ALB. Both are admitted by security group, never by CIDR, and the second gets a 403 on/admin/*(seePulumi.example.yaml) - Network reach is not authorization — every path into Middleman is trusted only as far as its token check