Security
See the security baseline for Kerckhoffs’s principle, and compliance/visibility.toml for the declared visibility that cargo xtask validate checks against GitLab (#2882).
3. Authentication & Authorization
-
Identity provider: Any OIDC-compliant issuer that implements the
client_credentialsgrant (ADR-026 IdP-neutrality). Devstack ships Keycloak as a reference implementation; production deployers use whatever OIDC backend they have (Keycloak, authentik, Okta, Azure AD/Entra, ForgeRock, PingFederate, Auth0). Plan E § Step 2 (!248) moved the IdP-coupling out:craig_auth::OidcDiscoveryfetches<issuer>/.well-known/openid-configurationat boot, cachesjwks_uri+token_endpoint+authorization_endpoint+end_session_endpoint, and refreshes on a TTL (default 1h). Pre-Step-2 code path constructed/protocol/openid-connect/*paths directly from the issuer URL — Keycloak-only by accident. Dex 2.45.1 does not implementclient_credentials(compiled out of the server’sallSupportedGrantsmap) and is therefore not a supported backend — seeidp-integration.adoc. -
Web UI flow: Authorization Code + PKCE via
craig-uiclient. Endpoints resolved via OIDC discovery. -
CLI/test flow: Resource Owner Password Credentials via
craig-apiclient (transitional — Plan E retires ROPC bootstrap in favor of per-serviceclient_credentials). -
JWT validation: the accepted signature algorithm is derived from the resolved JWK’s key type — RSA→RS256, EC P-256/P-384→ES256/ES384, OKP-Ed25519→EdDSA (#797) — never from the token header, so exactly one algorithm is accepted per token (alg-confusion defense) while ES256/EdDSA issuers work under the IdP-neutral default (ADR-026); a symmetric key in a verification JWKS is refused. An RSA JWKS key under 2048 bits (
MIN_RSA_MODULUS_BITS) is refused when the key set loads, never cached or used to verify; the other keys in the set keep working, and a token naming the refused key gets a 401 whose problem detail is the fixedinvalid token(#2920), while the warn log names the kid (#2687). A key of a typejsonwebtokendoes not model (an unknownkty, an EC or OKP curve outside P-256 / P-384 / P-521 / Ed25519, an RSA key with noe) no longer makes its key set unreadable: the set loads, that key is skipped the same way (never cached, a warn naming itskidand the reasonkey type is not supported for JWS verification, no key member logged, and the same 401 for a token that names it), and its RSA, EC and Ed25519 siblings verify (#2695). A token whose JOSE header carries acritmember is refused with that 401 on both verification paths, the OIDC bearer path and theX-Craig-Actoractor-token path (detailinvalid actor tokenthere), before itskidselects a key: CRAIG implements no critical header extension, and RFC 7515 §4.1.11 requires a recipient to reject acritit does not understand, so everycritis refused, an empty or malformed one included. Any other header member CRAIG does not read is ignored (#2695). Plus JWKS rotation support, issuer/audience verification,nbfenforcement,typstrictness (present-and-wrong rejected, absent tolerated for forward-compat). See ADR-021. -
Internal token issuer keys (not yet trusted; #2741, #2742, ADR-085 D8 / D9): the issuer process holds its ES256 signing keys in memory only and publishes each public key in
identity_signing_keys60 s before it signs; it stays published until 720 s after its signing window ends.GET /identity/jwkson the issuer is the set receivers will verify against: the unrevoked, published rows by the database clock, at most 64, read through the issuer login’s SELECT and never from one replica’s ring, so a token from any replica verifies. Each replica memoizes the set for under 5 s and sends its age inAge, so a receiver measures staleness from the read; a failed read is a 503, never an older set, so an outage cannot resurrect a revoked key. A revoked key leaves the set at the memo’s next read. The issuer’s own subject-token checks read the same memo (D2), never the ring. No receiver trusts this issuer until the switch (D15); the IdP JWKS validation above is today’s path. -
Authorization: data-driven policy engine on zen-engine/JDM. Per-resource policies in each jurisdiction layer’s
{jurisdiction}-authz-{resource}.json. Handlers route access decisions throughauthz.check(…)(single row) orauthz.auto_scope_list(…)(LIST). RBAC roles are inputs to JDM decision tables rather than hardcoded role checks (the single recorded exception is the scope-gated JWS replay-check dedup endpoint, #489). See planmulti-jurisdictional-authz.adoc(archived). Mutations whose authorization consumed a concurrently-mutable resource field (the assignment-gated placement/kinship updates) additionally re-check that field against the locked row inside the mutation transaction — the ADR-060 conjunctive two-snapshot policy (409 on drift; no engine call under the lock). -
Authorization verification (two stages, #2666 and #2667): the authz coverage gate proves statically that each handler reaches the engine, directly or through a verified helper registry, or carries a declared exemption. In test and devstack builds, a runtime witness counts each request’s engine decisions and refuses a 2xx made with none on a route that is not exempt. The witness is a test-only feature that the release-artifact gate keeps out of every release image (quality-gates § authz coverage).
-
9 RBAC roles: the six operational roles (admin, supervisor, caseworker, eligibility_worker, icpc_coordinator, readonly) plus the three ADR-054 office-authority roles (county_director, regional_director, state_office — the subsidy approval matrix axis; office principals also hold a base operational role)
-
Worker identity:
claims.sub(UUID) for data,claims.preferred_usernamefor display. Lazy-populated intocraig_security.worker_identitiesfrom JWT claims on first authenticated request — no IdP admin API dependency. -
Session management: stateless encrypted cookie (AES-GCM via
tower-cookiesprivate jar) — HttpOnly, SameSite=Strict, configurable Secure flag, configurable Max-Age (default 30 min). The access token and identity ride the session cookie; the refresh token rides its own encrypted cookie ({prefix}session-rt, #2506) and the verified id_token another ({prefix}session-idt, #960), each with the session cookie’s attribute set and Max-Age, and logout clears all three. No session cookie is ever set over the 4,096 bytes a browser must accept (RFC 6265 §6.1):save_sessionrefuses with a typedSessionCookieError::TooLarge, logged by cookie name and size only, and the callback answers thebff-signin-too-largeflash instead of a cookie the browser would drop into a sign-in loop. The split fits a worker with 128-character name and email holding every staff role (3,719 bytes against devstack-shaped tokens); a 255-character name with a 254-character email does not fit (4,731 bytes) and is refused. PKCE verifier + a per-loginnoncestored in a separate short-lived signedLaxcookie during the auth flow only (needed on the cross-site OIDC callback). The callback ends with a200no-storepage that continues to the landing path through<meta http-equiv="refresh">(with a Continue link), not a303: a browser withholds Strict cookies for the whole redirect chain a cross-site IdP started, so a303would land without the session it just set and loop back to sign-in (#2930). The page’s own navigation is same-site, and it carries no script, so the strict CSP holds. SESSION_SECRET must be ≥64 bytes. OIDC RP verification (#813/#814): at the callback the BFF verifies both tokens before minting a session — the id_token against the IdP JWKS (signature, issuer,exp, audience == the login client,azp,typ:"ID", the loginnonce, and theat_hashbinding to the access token when present) and the access token through the services' validation strategy (JWS or RFC 7662 introspection,azpenforced on both; #2686); the two are bound to the same subject. Any failure is a hard login rejection (redirect to/welcome), never a degraded empty-roles session. The id_token is verified, then kept only for logout’sid_token_hint— the session rides the verified access token. Per ADR-013 the session lifetime is the cookie Max-Age; tokens are not re-verified per request (the backends re-verify the forwarded bearer on every data call). -
Worker-audience gate (#1842, Phase-11 plan decision 9 / ADR-076): craig-web is the STAFF application. The OIDC
callbackmints no session for a fully verified realm principal that holds none ofcraig_auth::REALM_ROLESor any ofcraig_auth::PORTAL_REALM_ROLES(#2371) (a403page that names the reason —bff-admit-worker-onlyorbff-admit-dual-role—, no session or id_token cookie; only thesuband the refusal key are logged); thesession_contextloader drops any decrypting session whose roles the same verdict refuses — a cookie minted before the gate, or a refresh-rotated pair whose roles changed — and clears the cookie;require_authre-applies the same verdict on its cookie-fallback path. Portal principals (thePORTAL_REALM_ROLESthe Phase-11 identity unit introduces, #1843) therefore never obtain a staff session, whichever route they try first. -
The subject-token channel + the fleet portal guard (#1844, ADR-076 D2/D3): a portal principal never calls a backend directly. A portal BFF calls with ITS
client_credentialstoken as the bearer (the CHANNEL — the outerservice:craig-portalROLE, neverazp) and the user’s OWN IdP access token inX-Craig-Subject(the IDENTITY). Inside the shared auth middleware, before any handler or ruleset, every core service enforces: (i) a bearer holding anyPORTAL_REALM_ROLESrole →401; (ii) the portal channel without a subject →401; (iii) a subject is accepted only on the portal channel, only from a client inCRAIG_<SVC>SUBJECT_CLIENTS(azp; empty = refuse all), only when it holds a portal role and no worker orservice:role (any other role, such as an IdP default likeoffline_access, is ignored, #2518), verified against the same JWKS withaud == this service, and only on a path underCRAIG_<SVC>PORTAL_PATHS(else403, theforbiddenproblem with the fixed detailnot a portal surface of this service, #3011); a subject and an actor on one request →401. An honoured subject becomesClaims::actor(soacting_worker()is the subject) andClaims::channel()is the BFF; rulesets read it asclaims.channel. The subject is IdP-signed and verified HERE, so a compromised BFF can forge neither a subject nor a role — it can only relay a token the IdP issued (the portal BFF itself,services/craig-portal, mints nothing and ends its session on any refresh failure — planportalsU4 / U5). Services with no portal surface keep the empty defaults and are inert to the whole channel. -
A refused account can sign out of the IdP (#2519): the IdP’s SSO session survives an audience refusal, so every re-login would meet the same refusal. Both BFFs' refusal page (
craig_bff::oidc::admit_refused,templates/bff/admit_refused.html) keeps the localised reason and links the host’s/logout, which clears the CRAIG cookies and redirects to the IdP’send_session_endpointwithpost_logout_redirect_uriset to the host’s landing page. The refused callback stored noid_token, so the request carriesclient_idwithoutid_token_hint, and an IdP may ask the person to confirm the logout (Keycloak 26 does). The page carries no inline script or style, so the strict CSP applies unchanged. -
Dual-role principals are two accounts (#1858, ADR-076 D1): worker roles and portal roles are disjoint per ACCOUNT. Both BFFs refuse an account holding both, each with its own copy (craig-web
bff-admit-dual-role, craig-portalportal-admit-dual-role; #2371). So a worker who is also a caregiver holds a second, portal-only account bound by invitation.cargo xtask identity renderrefuses to seed such a dev user, and a unit test holds the committed devstack realm to the same rule. Policy and procedure: IdP Integration § Portal principals. -
Read-only write guard (#812): the
require_write_accessmiddleware on the protected (session-authed) craig-web routes fail-closed-rejects (403) any unsafe-method request (POST/PUT/PATCH/DELETE) from a principal whose sole role isreadonly— counting onlyREALM_ROLESandPORTAL_REALM_ROLES, so an IdP default such asoffline_accessdoes not lift areadonlyworker out of the guard (#2518) — except the self-service/personalize/tree (own-sub-scoped, ADR-035 §3; it also holds the worker’s language choice,POST /personalize/language(#1487), which calls no backend and writes only the signedcraig-localepreference cookie:HttpOnly,SameSite=Lax, a year long, a language tag that authenticates nothing). It is a coarse, single-invariant defense-in-depth edge guard atop the authoritative per-handler backendauthz.check, closing the gap wherereadonlywas only a display-only template hint. Layered inner torequire_auth(so it runs after the session is injected) and outer to the per-route role gates:verify_csrf → require_auth → require_write_access → [role gate] → handler. The role model is additive, soreadonlyheld alongside a writing role is not blocked. -
CSRF protection: the
verify_csrfmiddleware guards every state-changing request on the protected (session-authed) routes — Sec-Fetch-Site verification (acceptsame-origin/none, rejectsame-site/cross-site), falling back toOrigin/Refererauthority ==Host.SameSite=Strictis the backstop; a per-session synchronizer token is tracked as follow-up defense-in-depth (#950). See#763. -
Split-DNS deployments: when the IdP’s public issuer URL and the internal hostname differ (Docker
keycloak:8080vs. host-exposed port),OidcDiscovery::with_fetch_url(issuer, fetch_url)rewrites the discovery doc’sjwks_uriandtoken_endpointhost portions tofetch_urlso internal services can reach the IdP. Browser-facing endpoints (authorization_endpoint,end_session_endpoint) keep the public URL since those land in HTTP redirects to the user-agent.
4. Input Handling
-
SQL injection prevention: sqlx compile-time query validation — no string interpolation in SQL
-
HTML sanitization:
ammoniacrate strips all tags on public intake text input -
Bot protection: the ADR-069 jurisdiction-pluggable seam on the public report form —
noneby default (honeypot + IP rate-limit always ship);remote_verifymounts a deployment-configured widget + verifier with egress-hardened verification and recorded CSP additions -
Rate limiting: Governor crate — per-hour on public intake endpoints, per-minute on all authenticated API services (configurable via
RATE_LIMIT_RPM, default 600, 0=disabled) -
Rate limiting on the partner route (
/partner/v1on craig-intake, #3083): two limits, in this order. First a per-client-address limit (CRAIG_INTAKEPARTNER_RATE_LIMIT, default 36000 an hour, which is 600 a minute, and at most one minute’s worth in a burst), counted before the API key is checked, so an unauthenticated caller is refused before the key lookup runs and can neither guess keys nor load the lookup without limit. Then, after the API key is accepted, the partner’s own quota (rate_limit_rpm, a minute). The address is the one the trusted-proxy walk yields (CRAIG_INTAKETRUSTED_PROXIES): from a peer that is not a trusted proxy,X-Forwarded-ForandForwardedare ignored, so a caller cannot choose its bucket. The limiter is the partner nest’s own: partner and public traffic from one address share no bucket. Partners behind one shared egress address share the per-address budget; size it for them (configuration reference) -
Content-Security-Policy: API surfaces (the 8 backend services +
craig-intakewithembed_ui=false):default-src 'none'; frame-ancestors 'none'. UI surfaces (thecraig-webBFF +craig-intakewith the embedded UI mounted — both standalone modes and, since P3.6/#721, integrated):default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'— strict on both directives, no'unsafe-inline'(Alpine.js uses its CSP-friendly build; Plan C Step 14 + #414). Swagger UI (/swagger-uiand the paths under it, on the 8 backend services and oncraig-intakewhether or not the embedded UI is mounted) has its own policy (#2790):default-src 'none'; script-src 'self'; style-src 'self' 'sha256-RL3ie0nH+Lzz2YNqQN83mnU0J1ot4QL7b99vMdIX99w='; img-src 'self' data: blob:; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'. The vendored Swagger UI has no inline script; its one inline<style>, the fixed stylesheet of the top bar’s logo SVG, is admitted by its sha256 (never'unsafe-inline'), and a Playwright spec (tests/e2e/specs/swagger-ui.spec.ts) fails on any CSP violation, so an upgrade that changes it is caught;data:covers its stylesheet’s icons andblob:a Try It Out image response, and it fetches the document and sends Try It Out requests to its own origin. Its online validator is off (validatorUrl: "none"), so it loads no badge from validator.swagger.io.craig_common::middleware::security_headers::swagger_ui_cspsets this policy outside the overriding global CSP layer, on those paths only, so every other route, the document at/api-doc/openapi.jsonincluded, keeps its surface’s policy. The exact values are pinned incraig_test_lib::cspand asserted per service. -
Honeypot field: Public report form includes hidden anti-bot field
-
File upload validation: MIME type allowlist, max file size, filename sanitization via
craig-store -
Enum validation: Database CHECK constraints on all enum columns, reference data validation via
craig-reference
5. Transport Security
-
CORS: Explicit method allowlist (
GET, POST, PUT, DELETE, OPTIONS), configurable origin list (default*for dev, must be restricted in production) -
Session cookies: Secure flag configurable via
CRAIG_WEB__SESSION_SECURE(defaulttrue) -
Inter-service communication: All services communicate over HTTP within Docker network (TLS at reverse proxy in production)
-
Outbound TLS (#3194, ADR-084): a call to an
https://origin (the identity provider, a partner’s endpoint, the bot-protection verifier) runs on rustls with the aws-lc-rs provider and verifies the server’s certificate against the trust store of the container the service runs in. No root set is compiled into the binaries, and a service whose trust store holds no CA certificate does not start. Deployment Guide § The certificate authorities an outbound call trusts says how to add a private one. -
Object storage: S3-compatible via Garage (devstack) or any S3 provider (production), accessed via
craig-storecrate; the AFCARS federal file is sealed client-side under the reporting column key (CRAIG_REPORTING_FIELD_ENCRYPTION_KEY) before upload, and only a keylessoptionaldeployment stores it unsealed (ADR-020 § Amendment — #949) -
Outbound partner credentials (#1813, ADR-083): never sent over plain http unless the host is listed in
CRAIG_EXCHANGE__PARTNER_AUTH_PLAIN_HTTP_HOSTS; an endpoint carrying userinfo is refused at every write and never used; each secret reaches only the hosts itsCRAIG_PARTNER_SECRET_<REF>_HOSTSbinds. -
Upstream response bodies (#2523, #2527): every body a service or BFF reads from a peer, an IdP, a plugin endpoint or a partner is read under a byte cap for its kind, below. A declared
Content-Lengthover the cap is refused unread, and a streamed body stops at the first chunk that crosses it, so nothing past the cap is buffered. An over-cap body fails closed as the caller’s existing failure for an unusable answer (a decode failure, a 502 or 503, a plugin’s error state); the reader’s error names the cap, never a body byte or the URL. The reader iscraig_common::upstream_body(read_capped,read_json_capped);craig-exchange-transportandcraig-intake-sdksit below craig-common and keep their own capped readers. A streamed download relay (craig-web’s and craig-portal’s document downloads, craig-intake’s attachment download) never buffers the body, so it has no cap. The value-free census rule C4 (crates/craig-test-lib/tests/value_free_census.rs) fails on a new awaited.text(),.bytes()or.json()outside a pinned site. The caps are constants: raising one is a code change.
| Kind | Cap | Constant and reason |
|---|---|---|
A refusal body (non-2xx) |
64 KiB |
|
A CRAIG service’s 2xx JSON to a peer or a BFF |
16 MiB |
|
An IdP’s discovery document, JWKS, token or introspection answer |
1 MiB |
|
A jurisdiction plugin’s data fetch (ADR-033 §4) |
1 MiB |
|
A partner response, success or refusal, probes included |
1 MiB |
|
The bot-protection verifier’s answer |
64 KiB |
craig-intake’s |
A 2xx answer to the intake SDK |
64 KiB |
craig-intake-sdk’s |
6. Secret Management
-
Environment variables only —
CRAIG_<SERVICE>__*pattern -
No PLAINTEXT PRODUCTION secret files committed (
.gitignoreexcludes.env/real key files). The one committed ENCRYPTED store issecrets/dev.yaml+ its public.sops.yamlpolicy (ADR-064) — devstack-scoped values only, encrypted at rest, guarded by the blockingsops-policylint (encrypted-only leaves, recipient parity, secret-key needle) and thesecrets-policyCI job. Kerckhoffs-compliant: the ciphertext + policy + tooling are fully public; security rides the age identities alone. (Deliberately-public devstack TEST fixtures are a separate, documented class: the committed Keycloak realm anddevstack/devstack-actor-keys.envP-256 signing JWKs, ADR-064 §Context — dev-only, never production key material.) -
Keycloak realm config committed (devstack only — production uses external Keycloak)
-
API keys: SHA-256 hashed before storage in
api_keys.key_hash -
JWS signing keys: ECDSA P-256, private keys never stored server-side (public JWK only)
-
Partner client certificates (ADR-091): a partner that calls CRAIG is known by a client certificate registered against it in craig-security (
/v1/security/partners/{id}/client-certificates). Registering, approving and revoking are an administrator’s alone; the auditor role reads the list; a supervisor and a caseworker are refused. Registration refuses anything but one end-entity certificate whose validity has not ended (one not valid yet is taken; one valid at no time is not), and a certificate already live against any partner.GET /v1/security/client-certificates/by-fingerprint/{sha256}answers the partner for an approved certificate of an active partner inside its validity, and is craig-exchange’s alone: another service and a worker’s token are refused 403. Only the certificate’s fingerprint, subject and validity are kept. -
The partner-return listener (ADR-091): craig-exchange serves a second port, bound only when an interface consents to a partner’s calls, that ends mutual TLS itself and serves
POST /returns/{interface}/{leg}and nothing else. A caller without a certificate from a configured issuer, or with an expired one, fails the handshake. A certificate that completes it is then looked up in craig-security on every call, with nothing cached, and held to the partner row it may call as, that partner’s agreement, the deployment’s consent and the leg. Every refusal of those is the same bare 403; a lookup that could not be made is a 503. No token is read on this port, and the API port serves no return (How the host runs a return). -
Partner report signatures (
POST /partner/v1/reportson craig-intake): in integrated mode theX-JWS-Signatureheader is required, verified against craig-security’s signer-key registry, and checked for replay. In standalone mode (the cases-backed edge with a partner-keys file) the report is authenticated by its API key only: a signature is neither verified nor forwarded, and there is no replay check. Verification in standalone mode is planned (#3081); until then, do not expose a standalone edge’s partner route to partners whose reports must be signed. -
CI/CD secrets: ONE masked+protected GitLab variable — the
CRAIG_CI_AGE_KEYage identity that unlocks the committed store (ADR-064 retired the per-secret variable pattern; the runtimeCRAIG_FIELD_ENCRYPTION_KEYenv var contract for deployments is unchanged) -
In-memory secret hygiene (#798): long-lived secrets held in process memory are wrapped so they zeroize on drop and redact in
Debug— service OAuthclient_secret`s in `secrecy::SecretString, and the boot-time signing-JWK JSON (which embeds the private scalar) inzeroize::Zeroizing. Since #2683 (ADR-084) the parsed private JWK (craig_crypto::jwk::Es256PrivateJwk) zeroizesdon drop and redacts it inDebug; the signing key itself (craig_crypto::Es256SigningKey) is an aws-lc key pair, whose scalar AWS-LC holds and frees, and itsDebugprints only the public point. -
Outbound partner credentials (#1813, ADR-083): a partner row holds secret reference NAMES only; each value is resolved per send from
CRAIG_PARTNER_SECRET_<REF>or its_FILE, held insecrecy::SecretStringand set as a sensitive header, never cached, logged, published or stored. Answers and errors are redacted of the applied forms before they are stored or served; logs and events name a class and a reference. The connectivity probe presents the credential, so it needs partnerupdate(#1813), and a reference’s host binding stops a partner writer aiming a secret at a host they control. -
Service-identity actor JWT signing keys (Plan E, ES256/P-256): inline env var
CRAIG_<SVC>SIGNING_JWKfor devstack; file-mounted viaCRAIG_<SVC>SIGNING_JWK_FILE=<path>for production. Same precedence applies to the deployment-wide peer-JWKS map (CRAIG_PEER_JWKS_JSONinline vsCRAIG_PEER_JWKS_JSON_FILEmounted). Rotation procedure indocs/modules/ROOT/pages/idp-integration.adoc § Service Identity Keypair Provisioning
7. Dependency Auditing
-
cargo denychecks license compatibility (AGPL-3.0-or-later allowlist) and known advisories, over the workspace’s graph and over the WebAssembly graph a partner module is built from (#3205) -
OpenSSL banned — rustls used for all TLS (Alpine musl compatibility)
-
GitLab dependency scanning in CI pipeline
-
CVE response timeline:
-
Critical: Patch within 24 hours
-
High: Patch within 1 week
-
Medium: Patch within 1 month
-
Low: Address in next scheduled dependency update
-
8. CI/CD Security
-
SAST: GitLab SAST template (semgrep) in
.gitlab-ci.yml -
Secret detection: GitLab secret detection template
-
Dependency scanning: GitLab dependency scanning (gemnasium)
-
Container image scanning: none. No CI job scans a built image, and
mainpushes none: onlyrelease-buildbuilds the deployable images, and it runs the release smoke and the public-API scan (release-sbomwrites a CycloneDX SBOM of the workspace beside it), not an image vulnerability scanner. -
Other scanners in
.gitlab-ci.yml:cargo-deny(RustSec advisories and licences; on a dependency-manifest change and on every schedule),secrets-policy(the encrypted store, ADR-064) and the car’scargo xtask gitleaksline over the whole history. -
Image publication (plan ci-dev-loop, #3045, #3046): a merge-train or merge-request car pushes nothing. Its
dev startbuilds the devstack images on its own VM and leaves them there. A craig-tools or craig-devtools image that the registry lacks is built in the car and pushed only from a pipeline outside a merge request (main, a tag, a schedule). Only the protectedrelease-buildjob pushes the deployable images. It runs on a tag, on the weeklymainschedule or by hand onmain, never on a merge request or a train, and it pushes last, after the release smoke and the public-API scan passed on those same images, so a red smoke pushes nothing (Deployment Guide). Theci-imagejob pushes thecraig-citoolchain image when its input hash is new, because a job must exist before xtask can run. -
DAST: OWASP ZAP in the
pentestjob (scheduled pipelines, or by hand onmain), phases 1a–1c ofcargo xtask security. craig-intake’s anonymous/public/v1is actively scanned in phase 1a (tests/security/zap-public-api.yaml, no auth hook). On submission the scan reaches validation and persistence (#2789): ZAP builds the body fromSubmitReportRequest’s jurisdiction-neutral examples, and the plan’s fail-closed submission hook (one of its two scripts, beside the post-scan check) `tests/security/zap-public-submission-hook.js, gives each attack a freshclient_request_id, an empty honeypot, the devstack’s admin unit and empty arrays wherever ZAP’s generated value still stands, splicing each into the sent bytes and leaving every other byte as the attack wrote it. So an attack meets the refusal of the field it attacks, and one the edge accepts is persisted at craig-cases as a new report; one that keeps the generated id is never a replay (a payload that is itself a UUID keeps it). After the scan, a standalone check asks ZAP’sExtensionScriptwhether the hook is still enabled with no recorded error, and stops the scan with exit 5 when it is not;cargo xtask securityfails phase 1a when ZAP’s output lacks the hook’s first-reseed line or the check’s success line, so a hook ZAP disabled cannot pass silently. The check’s API calls first meet the real engine in the scheduledpentestjob: a mismatch fails the phase, never passes it. The scan runs ZAP 2.17.0 pinned by digest (#2812), and the hooks' source-derived claims cite that core and the OpenAPI add-on 58 the image bundles (Testing reference § The pinned ZAP image)./partner/v1(X-Api-Key plus JWS) and/signed/v1(JWS) are out of DAST scope (#2781). They are compensated by the evil corpus in theString,Unicode,Path,Html,Uuid,Date,EnumValueandJsoncategories, run behind valid credentials on both nests (partner.rs,signed_submit.rs), and by the JWS suitesjws.rs,jws_error_uniformity.rs,jws_partner_binding.rs,jws_replay.rs,signer_key_expiry.rsandsigned_submit.rs, all underservices/craig-intake/tests/api/. A request-signing ZAP hook that would bring both nests into scope is #2784. Detail: Testing reference § craig-intake’s DAST scope. -
Pre-push hook:
cargo fmt --check,cargo clippy — -D warnings,cargo build,cargo nextest run
9. Audit & Detection
-
Audit logging: Wildcard RabbitMQ subscriber captures every published event type to the
audit_logtable; every row carriesactor_service(caller service) +actor_user_sub(acting worker UUID) attribution columns per Plan E Step 11, so BFF-mediated and direct-caller requests are distinguishable from a single audit query -
Breach detection: Configurable detection rules with threshold-based anomaly detection on audit log patterns
-
Security reviews: Biennial review workflow (
security_reviewstable) per 45 CFR § 95.621(f) -
NIST SP 800-53: Control mapping tracked in
nist_controlstable with implementation status