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_credentials grant (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::OidcDiscovery fetches <issuer>/.well-known/openid-configuration at boot, caches jwks_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 implement client_credentials (compiled out of the server’s allSupportedGrants map) and is therefore not a supported backend — see idp-integration.adoc.

  • Web UI flow: Authorization Code + PKCE via craig-ui client. Endpoints resolved via OIDC discovery.

  • CLI/test flow: Resource Owner Password Credentials via craig-api client (transitional — Plan E retires ROPC bootstrap in favor of per-service client_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 fixed invalid token (#2920), while the warn log names the kid (#2687). A key of a type jsonwebtoken does not model (an unknown kty, an EC or OKP curve outside P-256 / P-384 / P-521 / Ed25519, an RSA key with no e) no longer makes its key set unreadable: the set loads, that key is skipped the same way (never cached, a warn naming its kid and the reason key 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 a crit member is refused with that 401 on both verification paths, the OIDC bearer path and the X-Craig-Actor actor-token path (detail invalid actor token there), before its kid selects a key: CRAIG implements no critical header extension, and RFC 7515 §4.1.11 requires a recipient to reject a crit it does not understand, so every crit is 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, nbf enforcement, typ strictness (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_keys 60 s before it signs; it stays published until 720 s after its signing window ends. GET /identity/jwks on 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 in Age, 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 through authz.check(…​) (single row) or authz.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 plan multi-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_username for display. Lazy-populated into craig_security.worker_identities from JWT claims on first authenticated request — no IdP admin API dependency.

  • Session management: stateless encrypted cookie (AES-GCM via tower-cookies private 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_session refuses with a typed SessionCookieError::TooLarge, logged by cookie name and size only, and the callback answers the bff-signin-too-large flash 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-login nonce stored in a separate short-lived signed Lax cookie during the auth flow only (needed on the cross-site OIDC callback). The callback ends with a 200 no-store page that continues to the landing path through <meta http-equiv="refresh"> (with a Continue link), not a 303: a browser withholds Strict cookies for the whole redirect chain a cross-site IdP started, so a 303 would 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 login nonce, and the at_hash binding to the access token when present) and the access token through the services' validation strategy (JWS or RFC 7662 introspection, azp enforced 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’s id_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 callback mints no session for a fully verified realm principal that holds none of craig_auth::REALM_ROLES or any of craig_auth::PORTAL_REALM_ROLES (#2371) (a 403 page that names the reason — bff-admit-worker-only or bff-admit-dual-role —, no session or id_token cookie; only the sub and the refusal key are logged); the session_context loader 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_auth re-applies the same verdict on its cookie-fallback path. Portal principals (the PORTAL_REALM_ROLES the 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_credentials token as the bearer (the CHANNEL — the outer service:craig-portal ROLE, never azp) and the user’s OWN IdP access token in X-Craig-Subject (the IDENTITY). Inside the shared auth middleware, before any handler or ruleset, every core service enforces: (i) a bearer holding any PORTAL_REALM_ROLES role → 401; (ii) the portal channel without a subject → 401; (iii) a subject is accepted only on the portal channel, only from a client in CRAIG_<SVC>SUBJECT_CLIENTS (azp; empty = refuse all), only when it holds a portal role and no worker or service: role (any other role, such as an IdP default like offline_access, is ignored, #2518), verified against the same JWKS with aud == this service, and only on a path under CRAIG_<SVC>PORTAL_PATHS (else 403, the forbidden problem with the fixed detail not a portal surface of this service, #3011); a subject and an actor on one request → 401. An honoured subject becomes Claims::actor (so acting_worker() is the subject) and Claims::channel() is the BFF; rulesets read it as claims.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 — plan portals U4 / 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’s end_session_endpoint with post_logout_redirect_uri set to the host’s landing page. The refused callback stored no id_token, so the request carries client_id without id_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-portal portal-admit-dual-role; #2371). So a worker who is also a caregiver holds a second, portal-only account bound by invitation. cargo xtask identity render refuses 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_access middleware 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 is readonly — counting only REALM_ROLES and PORTAL_REALM_ROLES, so an IdP default such as offline_access does not lift a readonly worker 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 signed craig-locale preference 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 backend authz.check, closing the gap where readonly was only a display-only template hint. Layered inner to require_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, so readonly held alongside a writing role is not blocked.

  • CSRF protection: the verify_csrf middleware guards every state-changing request on the protected (session-authed) routes — Sec-Fetch-Site verification (accept same-origin/none, reject same-site/cross-site), falling back to Origin/Referer authority == Host. SameSite=Strict is 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:8080 vs. host-exposed port), OidcDiscovery::with_fetch_url(issuer, fetch_url) rewrites the discovery doc’s jwks_uri and token_endpoint host portions to fetch_url so 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: ammonia crate strips all tags on public intake text input

  • Bot protection: the ADR-069 jurisdiction-pluggable seam on the public report form — none by default (honeypot + IP rate-limit always ship); remote_verify mounts 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/v1 on 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-For and Forwarded are 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-intake with embed_ui=false): default-src 'none'; frame-ancestors 'none'. UI surfaces (the craig-web BFF + craig-intake with 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-ui and the paths under it, on the 8 backend services and on craig-intake whether 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 and blob: 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_csp sets this policy outside the overriding global CSP layer, on those paths only, so every other route, the document at /api-doc/openapi.json included, keeps its surface’s policy. The exact values are pinned in craig_test_lib::csp and 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 (default true)

  • 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-store crate; the AFCARS federal file is sealed client-side under the reporting column key (CRAIG_REPORTING_FIELD_ENCRYPTION_KEY) before upload, and only a keyless optional deployment 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 its CRAIG_PARTNER_SECRET_<REF>_HOSTS binds.

  • 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-Length over 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 is craig_common::upstream_body (read_capped, read_json_capped); craig-exchange-transport and craig-intake-sdk sit 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

craig_common::problem::BODY_CAP: a CRAIG problem document with its full errors[] is far below it.

A CRAIG service’s 2xx JSON to a peer or a BFF

16 MiB

craig_common::upstream_body::S2S_SUCCESS_CAP: a 500-row page or a jurisdiction’s ruleset listing (under 1 MiB for every committed jurisdiction) leaves more than tenfold headroom.

An IdP’s discovery document, JWKS, token or introspection answer

1 MiB

craig_common::upstream_body::IDP_RESPONSE_CAP: each is a few kilobytes; a 64-key JWKS is about 100 KiB.

A jurisdiction plugin’s data fetch (ADR-033 §4)

1 MiB

craig_common::upstream_body::PLUGIN_FETCH_CAP: the data one panel or case section renders.

A partner response, success or refusal, probes included

1 MiB

craig_exchange_transport::MAX_RESPONSE_BYTES: partner answers are small structured documents.

The bot-protection verifier’s answer

64 KiB

craig-intake’s MAX_VERIFY_BODY_BYTES: a siteverify answer is a few hundred bytes.

A 2xx answer to the intake SDK

64 KiB

craig-intake-sdk’s SUCCESS_BODY_CAP: a confirmation or a status is under 1 KiB. The Python and TypeScript SDKs carry the same success and refusal caps, and sdks/test-vectors/response-cap.json (#3039) holds all three SDKs to one set of over-cap cases, the at-cap and one-byte-over boundaries included.

6. Secret Management

  • Environment variables only — CRAIG_<SERVICE>__* pattern

  • No PLAINTEXT PRODUCTION secret files committed (.gitignore excludes .env/real key files). The one committed ENCRYPTED store is secrets/dev.yaml + its public .sops.yaml policy (ADR-064) — devstack-scoped values only, encrypted at rest, guarded by the blocking sops-policy lint (encrypted-only leaves, recipient parity, secret-key needle) and the secrets-policy CI 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 and devstack/devstack-actor-keys.env P-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/reports on craig-intake): in integrated mode the X-JWS-Signature header 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_KEY age identity that unlocks the committed store (ADR-064 retired the per-secret variable pattern; the runtime CRAIG_FIELD_ENCRYPTION_KEY env 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 OAuth client_secret`s in `secrecy::SecretString, and the boot-time signing-JWK JSON (which embeds the private scalar) in zeroize::Zeroizing. Since #2683 (ADR-084) the parsed private JWK (craig_crypto::jwk::Es256PrivateJwk) zeroizes d on drop and redacts it in Debug; the signing key itself (craig_crypto::Es256SigningKey) is an aws-lc key pair, whose scalar AWS-LC holds and frees, and its Debug prints 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 in secrecy::SecretString and 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 partner update (#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_JWK for devstack; file-mounted via CRAIG_<SVC>SIGNING_JWK_FILE=<path> for production. Same precedence applies to the deployment-wide peer-JWKS map (CRAIG_PEER_JWKS_JSON inline vs CRAIG_PEER_JWKS_JSON_FILE mounted). Rotation procedure in docs/modules/ROOT/pages/idp-integration.adoc § Service Identity Keypair Provisioning

7. Dependency Auditing

  • cargo deny checks 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 main pushes none: only release-build builds the deployable images, and it runs the release smoke and the public-API scan (release-sbom writes 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’s cargo xtask gitleaks line over the whole history.

  • Image publication (plan ci-dev-loop, #3045, #3046): a merge-train or merge-request car pushes nothing. Its dev start builds 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 protected release-build job pushes the deployable images. It runs on a tag, on the weekly main schedule or by hand on main, 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). The ci-image job pushes the craig-ci toolchain image when its input hash is new, because a job must exist before xtask can run.

  • DAST: OWASP ZAP in the pentest job (scheduled pipelines, or by hand on main), phases 1a–1c of cargo xtask security. craig-intake’s anonymous /public/v1 is 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 from SubmitReportRequest’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 fresh client_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’s ExtensionScript whether the hook is still enabled with no recorded error, and stops the scan with exit 5 when it is not; cargo xtask security fails 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 scheduled pentest job: 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 the String, Unicode, Path, Html, Uuid, Date, EnumValue and Json categories, run behind valid credentials on both nests (partner.rs, signed_submit.rs), and by the JWS suites jws.rs, jws_error_uniformity.rs, jws_partner_binding.rs, jws_replay.rs, signer_key_expiry.rs and signed_submit.rs, all under services/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_log table; every row carries actor_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_reviews table) per 45 CFR § 95.621(f)

  • NIST SP 800-53: Control mapping tracked in nist_controls table with implementation status

10. Vulnerability Reporting

See SECURITY.adoc in the repository root for the public-facing vulnerability reporting process.

Edit this page · latest