Security

For a contributor or agent about to touch an auth, data or edge surface: the invariants below are the ones a change must not weaken, each with its owner. Operations — rotation, the startup-guard inventory, archive management, rollback — live in Security Operations & Runbooks; incidents in Incident Response; the universal baseline (Kerckhoffs’s principle, enforced public visibility) is the security baseline.

Invariants

  • Kerckhoffs: the repository is public, as compliance/visibility.toml declares and validate’s visibility stage checks against GitLab (#2992); security never relies on source secrecy. Secrets live in the environment or SOPS, never in source. A service's address is not a secret either: knowing a peer's URL grants nothing. The boundary is the caller's token and the callee's admission, and limiting which service can reach which is the network's job (segmentation), not configuration's (#723).

  • Federal data tenancy (ADR-004): FTI → canopy-tanf and canopy-medicaid only; IEVS → canopy-snap only; SSA SOLQ/BENDEX per Computer Matching Agreement, which canopy-eligibility queries before a Medicaid or CHIP dispatch and, since #3322, before a SNAP one for the SSI fact of 7 CFR 273.2(j)(2)(i)(E), only for a member aged 65 or over, disabled or named by an ssi income record, a SNAP-only run's records reaching no program; FDSH → canopy-medicaid. No restricted data in event payloads — the publisher refuses RESTRICTED_FIELDS (crates/canopy-mq/src/publisher.rs). The CI job compliance-data-tenancy runs cargo xtask compliance audit-data-tenancy against compliance/data-tenancy-authorisation.toml; the same gate runs inside cargo xtask validate.

  • Authentication: canopy-identity, hosted in canopy-security, is the one issuer every service trusts (ADR-049). Workers sign in at the deployment’s one upstream OpenID Connect provider, Kanidm by default (ADR-050), through canopy-web’s relying party (authorization code, PKCE S256, nonce, auth_time), and canopy-identity verifies the upstream’s id_token again before it opens a session (IdP Integration › the federation grant). SAML, LDAP and AD sources federate into that upstream, never into canopy. Every service call carries a canopy-identity token: an ES256 at+jwt addressed to exactly one service, verified on every request (The identity receiver and admissions (ADR-049)).

  • An identity outage is never an admission. A receiver with no trustworthy key set answers 503 keys_unavailable; its keys fail closed once 720 s stale, so a revoked key stops verifying within that bound even while canopy-security is unreachable. canopy-web refuses a sign-in it cannot complete with canopy-identity (identity_unavailable), and a sender never falls back to another credential.

  • Roles: reads admit CASEWORKER_OR_ABOVE_ROLES (caseworker, eligibility_specialist, supervisor, quality_control, admin); writes CASEWORKER_WRITER_ROLES, which drops quality_control (#1820); dedicated bars for fti_auditor, data_steward, the determination operators and admin/quality_control (crates/canopy-auth/src/roles.rs). A session keeps only the roles in ROLE_VOCABULARY, which adds analyst, auditor, security_admin and studio_admin; upstream groups and names canopy does not know are dropped at federation, before any token, admission or audit payload sees them (canopy_auth::upstream::project). Per-endpoint matrix: RBAC Matrix.

  • System callers (ADR-049 §3, §10): each service that calls another is a confidential client holding an ES256 key (CANOPY_<SVC>__IDENTITY_CLIENT_PRIVATE_KEY) the deployment’s client registry binds to it; it mints a system token only for a compiled edge, and its token carries no role. The X-Canopy-Actor channel is retired: a receiver answers 400 actor_header_retired to any request carrying it. Worker identity rides delegation tokens, minted per target from the worker’s session and onward per hop.

  • canopy-identity system tokens (ADR-049 §2, §3, §10; Amendment 3, #2554): canopy-security’s POST /identity/token grants a client-credentials token only to a compiled client that authenticates with a private_key_jwt assertion signed by a key the deployment’s client registry binds to it, an enabled client only (identity-clients.yaml). The assertion is held to ADR-049 Amendment 3’s rules (exactly alg = ES256, kid and typ in its header, typ client-authentication+jwt or absent, aud exactly the issuer identifier, a 60 s lifetime) and its jti is accepted once per client, recorded by the issuer login’s write-only INSERT; a store that cannot answer is a 503, never a refusal. The token’s audience is the RFC 8707 resource, and its purpose and scopes come from the compiled purpose registry, never the request. Every answer, a mint or a handled refusal, commits its identity_issuance_log row before it leaves, and one that cannot be committed is a 503 that releases nothing. The route has a per-IP limit (CANOPY_SECURITY__IDENTITY_TOKEN_RATE_LIMIT_RPM, 30 000 a minute by default, shared with revocation and code entry; ADR-049 Amendment 10), and each client a per-replica budget of token requests (rate_limit_rpm, 6 000 a minute by default; #2726), spent right after it authenticates, past which a request is a logged 429 that verifies no subject token, reads no session and signs nothing; a revocation spends none. Every response carries Cache-Control: no-store. Reference: canopy-security API.

  • canopy-identity’s federation grant (ADR-049 §3, §5, §6, §8, §12; Amendment 6, #2716, #2717): the same route also serves an RFC 8693 grant, to canopy-web alone (any other authenticated client is unauthorized_client before any lookup), and only while an upstream profile is configured. canopy-identity verifies the presented upstream id_token itself, calls userinfo bound to its sub when the profile’s claims come from it, projects the claims, links or mints the canopy subject for the exact upstream issuer and subject pair, refuses a suspended subject, and opens a web session whose credential is 32 CSPRNG bytes stored only as their SHA-256. The session, its first validation and its opened issuance-log row commit in one transaction, and the credential is released only after it; a refusal is logged before it is answered. No upstream sub, username, token or credential reaches a log. canopy-web renews the session with its credential and the upstream’s evidence (#2717): a session renews only under the upstream issuer and client it opened under, a refreshed id_token must repeat the session’s upstream subject and authentication time, carry its nonce or none, and be newer than the last, userinfo is bound to the session’s upstream sub, the upstream’s refusal revokes the session, and a grace for an unprocessed refresh or an unavailable upstream is bounded (30 min by default, 60 min at most) and recorded. A federation request has one 13 s deadline: its upstream calls, each bounded by the upstream client’s timeout, end inside it, and in the 3 s reserve the session transaction runs to 11.5 s, so a transaction that never answers is still refused with its row before the deadline. Reference: IdP integration › the federation grant.

  • canopy-identity’s security administration (ADR-049 §6, §12; Amendment 8, #2729–#2731): canopy-security’s /identity/admin/ routes admit only a security administrator, a canopy-identity delegation token for canopy-security whose session is re-read live (an administrator’s own revocation or suspension ends their administration at once), whose chain names only enabled clients, which carries the security_admin role and a sign-in at most 600 s old (RFC 9470 step-up). They read and write through a separate least-privilege login, canopy_identity_admin, which runs only the admin functions; each change commits with its row in identity_admin_actions, naming the bearer’s subject, session, jti and signing kid. That separation keeps every admin change off the issuer’s SQL privileges, but a stolen issuer credential can still forge any token, an administrator’s included; the compromise response reviews admin actions by the revoked keys. Reference: API › canopy-identity security administration.

  • canopy-identity’s delegation mint (ADR-049 §3, §4, §5, §6, §12, §13; Amendment 7, #2724, #2725): the same route mints canopy-web a per-target delegation token from a web session it opened, and a service one onward from a delegation token addressed to it, with or without an upstream profile. A client the form does not admit is unauthorized_client before its parameters are judged, and a target the client has no compiled delegation edge to is invalid_target before the session is read. Every mint reads the session in one statement and refuses it unless it is live, unrevoked, fresh (session_stale asks canopy-web to renew) and its subject unsuspended. The token’s roles and programs never exceed the session’s current ones (a request may narrow them), it lives at most 300 s and never past the session’s end, its act names canopy-web, and it is released only after its delegated issuance-log row commits. Onward, the subject token is verified in process against the published keys as a receiver of the client’s own service would verify it (its audience, and a last hop the call graph allows), the client is added to its act chain and refused if already in it or past eight actors, the session is read by the token’s sid and must be the token’s subject’s, the sets never exceed the subject token’s or the session’s current ones, the token never outlives the subject token, and its row names the subject token’s jti, so a chain’s hops link in the issuance log. A token in flight when its session is revoked or its subject suspended stays acceptable for at most 300 s plus 60 s leeway and 60 s skew. Reference: API › POST /identity/token.

  • Worker program scope is a required claim (ADR-044): a sign-in whose upstream programs claim is absent or empty is refused missing_primary_programs, and one that is not an array of program wire ids malformed_primary_programs, for every role tier, at canopy-identity’s federation and again at canopy-web’s admission; the only override is the upstream’s claim mapping.

  • Determinations are ECDSA P-256 detached JWS (ADR-002); the orchestrator records only envelopes that verify and bind to their dispatch, storing the exact signed bytes, and writes any other envelope to quarantined_determinations with a typed reason, excluded from the combined result; determination operators reverify or dismiss it through an attributed, append-only ledger (intake: services/canopy-eligibility/src/quarantine.rs; the ledger: src/quarantine_ops.rs and src/store/quarantine.rs; ADR-002 Amendment 5). Rotation: Signing Key Rotation.

  • Encryption at rest (ADR-036): SSN, date of birth and fact versions in canopy-persons, determination snapshots in the five program services, and canopy-reporting’s restricted_payload extracts are SealedValue envelopes under per-value DEKs, each wrapped by the CANOPY_ENCRYPTION_KEY KEK and stored in redaction_keys (crates/canopy-crypto-shred/src/keys.rs). Sealing services refuse to boot without the KEK in every environment (require_kek); the API exposes the last four SSN digits only.

  • Redaction — the irreversible crypto-shred of a determination snapshot or a person’s sealed values — admits only a user holding the dedicated data_steward role, not admin, and no system caller (Admission::user_roles(&["data_steward"]) on canopy-persons' and each program service’s redaction routes).

  • Secrets: SOPS + age in secrets/dev.yaml (dev values only) through cargo xtask secrets …; runtime reads through canopy_secrets::EnvSecretProvider (ADR-017); cargo xtask secrets-yaml-lint refuses a plaintext secret in config/**; CI secrets are masked, protected variables. Workflow: Configuration Reference.

  • Startup guards fail closed. Outside CANOPY_ENV=development each guard refuses unless its per-control override is set to the exact literal true (canopy_common::env::override_flag_is_true); inventory and doctrine: security-operations.adoc#startup-guards.

  • Upload content safety (ADR-042): an upload stays scan_status='pending' until a clamd verdict bound to its content identity; the noop scanner refuses boot outside development without CANOPY_APPLICATIONS__ALLOW_INSECURE_SCANNER (services/canopy-applications/src/guard.rs). Operations: Runbook: clamav (clamd) Sidecar Operations.

  • Sessions: canopy-web keeps worker sessions in its own PostgreSQL tables (services/canopy-web/src/web_session/, #2518; ADR-009 Amendment 2). The Host-canopy_session cookie (SameSite=Strict, HttpOnly, always Secure) carries a 256-bit random token; the database stores only its SHA-256, so a dump yields no usable cookie. Each row holds canopy-identity’s session credential and the upstream grant as one record, in plaintext JSONB (field encryption is #2521). Every write is one named statement over its own columns, with no upsert and nothing written after the response, so a sign-out is final: no concurrent request can write the session back. A sign-in is bound to its browser by a Host- SameSite=Lax flow cookie and to its OAuth state, taken once; a sign-in whose session signed out meanwhile is refused. Each session’s CSRF token is minted with it and never rewritten, and a presented token is compared in constant time (subtle, #2537); CsrfToken has no ==. A store that cannot be read answers 503 and presents no grant. Durable sign-out assumes acknowledged commits survive failover (synchronous replication; Deployment Guide). canopy-portal is Postgres-free with Redis-primary opaque sessions (ADR-026); MemoryStore is banned.

  • The devstack token broker (ADR-049 Amendment 24): canopy-token-broker holds every confidential client’s devstack key and the devstack Kanidm’s credentials, the material the in-network test runner already reads, and answers tokens, and a cast person’s password and a fresh TOTP code (POST /v1/upstream/ui-credentials, for the e2e harness’s Kanidm login page object), without authenticating its caller: any container on the devstack’s compose network can reach it while it runs, so that network is its boundary. It exists only in the devstack’s e2e compose profile, publishes no port (pinned by the_token_broker_is_unpublished_and_reads_the_runners_inputs), runs read-only without core dumps, and is never built by the root Dockerfile, so no promoted image carries it. Its error bodies carry a fixed detail and a public reason, never a token, credential or the request.

  • Broker identity (#1093): every service connects to RabbitMQ as its own canopy-<service> user whose topic-permission write regex enumerates the routing keys its tree publishes (devstack/rabbitmq/definitions.json; pinned by crates/canopy-mq/tests/acl_test.rs). EventEnvelope.source_service is a label, never an authorization input. Model: Event-Delivery Protocol.

  • Dependencies: openssl and openssl-sys are banned in deny.toml (rustls only); the CI cargo-audit job runs cargo deny check (advisories, licenses, bans). CVE remediation SLAs: SECURITY.adoc in the repository root.

  • Only the release job pushes an image (#3355; ADR-040 Amendment 9): a merge-train car pushes nothing. The release job runs on a tag, a schedule or by hand on main, never on a merge request, and pushes only images it built and smoke-tested in the same job; it refuses a release binary set if any binary a release image ships carries a test route. A lanes.rs test holds every push but the CI image's to that job. It alone uploads a file, the operator CLI's package on a tag (a lanes.rs test), and a package protection rule on the project refuses an upload of canopy-cli from a pipeline started by a member below Maintainer (#3635).

  • Tool downloads are pinned and verified (#2621; ADR-040 Amendment 2): every tool a Dockerfile or CI job fetches is a pinned release whose committed sha256 is checked before it is unpacked, and nothing is piped into a shell. cargo xtask ci-config-lint (in validate and CI) refuses an unverified curl or wget, a remote ADD without --checksum, any pipe into a shell and cargo binstall in .gitlab-ci.yml and every tracked Dockerfile. cargo xtask perf runs k6 from its release tag (grafana/k6:2.4.0; images stay on tags, #2631).

  • Container images stay on tags, not digests (#2631, won’t do): a base or service image is referenced by its release or feature tag, so a rebuild picks up upstream’s patch releases; a missed vulnerability fix is the likelier harm than a re-pointed tag. Tags are bumped to their latest releases (#2910).

  • The docs build sends no diagram to a third party (#2630): Mermaid diagrams render on a Kroki service of the docs job and are saved into the site, so neither the build nor a reader's browser asks kroki.io for them. ci-config-lint refuses a playbook that would.

  • No telemetry, update checks or unasked-for downloads from third parties (#2623): no tool in a build, a CI job or the devstack reports usage, asks a third party whether a newer version of itself or its plugins exists, or fetches code or keys from one on its own. Each tool that would by default runs with it turned off where it runs: syft with SYFT_CHECK_FOR_APP_UPDATE=false in the image-build jobs; npm with NPM_CONFIG_AUDIT=false and NPM_CONFIG_UPDATE_NOTIFIER=false in the pages job and the e2e image; k6, on the run cargo xtask perf starts, with --no-usage-report and K6_AUTO_EXTENSION_RESOLUTION=false (otherwise a script importing an extension has Grafana’s build service build a k6 binary that k6 then runs unpinned); Grafana in the devstack with GF_ANALYTICS_REPORTING_ENABLED, GF_ANALYTICS_CHECK_FOR_UPDATES and GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES set to false, and GF_PLUGINS_PREINSTALL_DISABLED (no start-up install of grafana-lokiexplore-app and the four other apps Grafana preinstalls) and GF_PLUGINS_PUBLIC_KEY_RETRIEVAL_DISABLED (its built-in plugin-signing key, not one fetched every 10 days) set to true. dioxus-cli’s telemetry is compiled out (#2619) and cargo-binstall is no longer run (#2621). cargo xtask ci-config-lint refuses a run of syft, npm, npx or k6 in the CI file or a tracked Dockerfile without its opt-outs, and a Grafana compose service without its five; tests pin perf's two. Grafana’s news feed ([news] news_feed_enabled) is fetched from grafana.com by the browser of whoever opens it, not by the server, so it is no server egress. Outside this rule, third-party fetches remain: package and image registries, the release tarballs #2621 pins, cargo-deny’s advisory database, ClamAV’s freshclam signature updates and the docs build’s Antora UI bundle.

  • AC-6 read audit: a worker-attributed read of one household’s enrollment data is audited on the deny path (enrollment.household_issuance.access_denied) and the allow path (enrollment.household_issuance.read, enrollment.continuations.read, enrollment.successors.read), carrying ids and a role summary only (services/canopy-enrollment/src/).

  • Pub 1075 citations use IRS Publication 1075 (Rev. 11-2021): least privilege is AC-6, audit-record retention AU-11. The FTI hash chain (ADR-014) is transitional; ADR-041 is authoritative and retires it behind #1304.

  • Credential-bearing HTTP clients follow no redirect (#2534). reqwest’s default policy answers a 307 or 308 by re-sending the request, body included, to whatever Location names, removing only the standard auth and cookie headers and only across hosts, so a followed hop would carry a refresh token, an authorization code and its PKCE verifier, a client secret or assertion, a bearer on a same-host hop, or a custom-header token to wherever the answer points. Every production client but one test-support client states redirect::Policy::none() and receives a 3xx as its response status: canopy-auth’s IdentityHttpClient, which carries every call to canopy-identity (keys, client assertions, delegation, federation, the device flow) and canopy-web’s edge forwarding, which answers any 3xx 503 so no Location reaches the internet; its UpstreamHttpClient, which carries canopy-web’s code redemption, refresh and revocation and canopy-identity’s upstream discovery, keys and userinfo, so a redirecting upstream token endpoint fails the sign-in and a 3xx on refresh ends the session; and the services' sibling-service clients, most built on the data-path client (canopy_common::http::build_data_path_client). cargo xtask http-clients audit-redirects (validate stage http-clients-redirects) checks the production code for two things: every client constructor states a redirect policy in its own builder chain (Client::new(), Client::default() and the free helpers reqwest::get and reqwest::blocking::get cannot, so each is a finding), and every .redirect(..) call, wherever it sits, names Policy::none(), so a builder cannot be re-policied later. A site that must follow takes an entry in compliance/client-redirect-allowlist.toml with its reason and the exact number of sites it covers; a stale or miscounted entry fails the gate. The one entry is canopy-test-lib’s TestClient::new, which carries only devstack fixture credentials.

The identity receiver and admissions (ADR-049)

Every receiving service, canopy-persons, canopy-rules and canopy-security among them, mounts its /v1 behind one IdentityReceiver (crates/canopy-auth/src/identity_receiver/layer.rs; ADR-049 Amendment 14). canopy-api’s ApiServer mounts /v1 only behind a receiver, so a service that is none, canopy-exchange, answers 404 there; canopy-web’s pages take its own session. canopy-security’s receiver reads the key registry in process; every other receiver fetches {IDENTITY_INTERNAL_URL}/jwks. The per-service API pages state only their routes' admissions.

  • Authentication, in order: exactly one Authorization: Bearer header holding one RFC 6750 b64token, else 401 token_missing (challenge Bearer); no X-Canopy-Actor, the retired on-behalf-of header, else 400 actor_header_retired, before any key is looked up; a token the validator accepts within 2 s (RECEIVER_KEY_BUDGET), else 401 token_rejected (challenge Bearer error="invalid_token"), or 503 keys_unavailable when no trustworthy key set answered in time; and an X-Canopy-Applicant claim only from the portal, verified, else 403 (applicant_claim_not_portal, applicant_claim_unverifiable, applicant_claim_invalid). A refusal logs its code, and a rejected token its validator rule, never the token.

  • Validation (IdentityTokenValidator, crates/canopy-auth/src/identity_token.rs): a compact JWS of at most 8 KiB with alg exactly ES256 and typ at+jwt; a kid the published set holds, under which the signature verifies; a payload that is exactly a system token’s or a delegation token’s layout; iss the configured issuer identifier and aud this receiver’s urn:canopy:service:<service>, both exactly; a lifetime of 1 to 600 s for a system token and 1 to 300 s for a delegation token, judged on the wall clock with 60 s leeway; and the last hop: a delegation token’s current actor holds a delegation edge to the receiver, a system token’s client a system edge. So a token addressed to another service is refused, and so is one from a client the compiled call graph does not connect to it.

  • Keys. A receiver refreshes the published set every 300 s, refetches on an unknown kid at most once per 30 s, and fails closed once the set is 720 s stale (crates/canopy-auth/src/key_cache.rs). Operations: Security Operations › canopy-identity signing keys.

  • The principal (principal.rs): a user, from a delegation token (the canopy subject, its session, roles, programs, act chain and auth_time), or a system caller, from a system token (its confidential client, purpose and scopes). The portal is a system caller whose token holds portal:* scopes.

  • Admission (crates/canopy-auth/src/identity_receiver/admission.rs). Every handler calls principal.admit(&ADMISSION)? with its route’s named Admission: a delegated route’s constant from crates/canopy-auth/src/delegated.rs (ADR-049 Amendment 15; cargo xtask delegated-routes check holds the table to its doc table and each route’s registration), or a constant beside the handler. Its arms:

    • Admission::system(), any confidential client’s system token but the portal’s, or system_from(&[clients]), only those clients';

    • portal(scope), the portal’s token holding that scope;

    • user_roles(roles), a user holding one of the roles, through any actor the receiver admitted;

    • user_roles_via(&[clients], roles), the same only when the token’s current actor is one of the clients, such as canopy-web or canopy-cli.

      A caller no arm admits is 403 with the first ReceiverDenial in a fixed order (denial.rs): portal_on_non_portal_route, portal_scope_missing, service_class_on_user_only, portal_only_route, service_not_allowlisted, system_caller_required, actor_not_allowed, required_role_missing. A portal call on a resource-keyed route is also bound to its applicant’s session by the signed X-Canopy-Applicant claim (principal.require_owned_application and its siblings; 403 ownership_claim_missing or ownership_mismatch). canopy-verification’s /internal/v1 adapter routes sit behind the same receiver: IEVS admits canopy-snap’s system token, SAVE canopy-eligibility’s and canopy-snap’s, and SOLQ its delegated constant (ADR-049 Amendment 16; services/canopy-verification/src/api/internal.rs). Per-route census: Authorization Inventory.

  • Bars. Writes admit CASEWORKER_WRITER_ROLES (caseworker, eligibility_specialist, supervisor, admin; #1850) and reads CASEWORKER_OR_ABOVE_ROLES, which adds quality_control; the qc_write_gate_sweep test reads each write route’s admitted constant and keeps the two apart (crates/canopy-test-lib/tests/qc_write_gate_sweep_test.rs). Narrower writes carry a dedicated bar: canopy-applications' SCAN_OVERRIDE_ROLES, REOPEN_ATTEST_ROLES, POSTPONEMENT_REVERT_ROLES, REP_DISQUALIFY_ROLES and SCHEDULER_RUN_ROLES (each supervisor / admin), and canopy-notices' POST /v1/documents/render on CITATION_RENDER_ROLES (admin / studio_admin / auditor, the one bar outside the caseworker ladder).

  • Attribution (ADR-049 Amendment 3). principal.attribution_sub() is the string a record stores: the canopy subject for a user, the client id for a system caller, whose token’s sub is its client_id. principal.actor() names a user as Human, by the subject, and a system caller as Service, by its client id. So a delegated call records the worker, and a system caller’s FTI accessed_by, redaction actor_sub, idempotency keys, bulk runs and export events record its client id. canopy-security stamps an ingested audit event’s source_service from principal.client() (#2649).

  • Senders (ADR-049 Amendment 16). A service’s IdentitySender takes each call’s token from the compiled edge to the target and the call’s origin: a system token for a System edge, the request’s user delegated onward for a Delegation edge, by origin for Both; no edge sends nothing. canopy_auth::send_with_retry re-mints and resends once only after a receiver’s refusal of the bearer (refuses_the_bearer: a 401 whose challenge is Bearer with no error or invalid_token), never after a step-up 401 or a route’s own 401, and never with under 1 s of the caller’s deadline left (RETRY_FLOOR). A sender never falls back to another credential.

  • Contract tests. The per-service tests/receiver_contract_test.rs suites (eleven services) pin their receivers' refusals (no bearer, another receiver’s token, the actor header, and the portal on a route with no portal arm where the service has a portal route) and role bars, and the tests/qc_read_only_test.rs suites the quality_control posture, live, on tokens the canopy-identity token broker mints through production grants (Testing › the token broker).

Configuration trust roots (ADR-051)

Policy decides eligibility, so the configuration a deployment runs is authenticated before any service reads it (ADR-051, Deployment Guide › Fetching configuration).

  • The trust root is the deployment's, never the repository's. canopy-config-fetch verifies a commit or tag against a signer list mounted from outside the configuration repository (<name>.allowed_signers, or <name>.openpgp with <name>.openpgp.asc). Someone who can push to a configuration repository cannot add themselves to the list that decides whether their push is published.

  • Only the list decides. The signer is read from git's raw verification status and compared with the list. A key that merely sits in a keyring, or that gpg marks trusted, is not accepted; each run imports the listed keys into a throwaway keyring it removes afterwards.

  • Every failure is a refusal. An unsigned commit, an off-list signer, a missing, empty or unparseable trust root, a listed fingerprint with no key, a published tree changed on disk: each leaves the last good tree in place and is recorded in status.json. A service never starts on an unverified tree.

  • What a configuration signer can and cannot do. A signer on a source's trust root can change any policy that source carries (its rulesets, parameters and notice templates) from the next rollout, and every service reports the commits it runs on at GET /version. A signer cannot add a signer, because the trust root is not in the repository; cannot publish through a source whose list does not name them; and gains nothing from the fetcher's container, which is given the source list and the trust directory and none of the services' credentials.

  • Working copies are a development mode. A path: source is never verified. It loads only when every source is path: and CANOPY_CONFIG_ALLOW_UNVERIFIED=true, and the flag beside a git source refuses the boot.

Extension modules (ADR-052)

A jurisdiction's extension module is code the jurisdiction ships in its own signed configuration and runs in its own deployment. It is confined so that a defect in it cannot corrupt the host service, not because it is hostile to another party. canopy-extension-host enforces:

  • No ambient authority. The module is a WebAssembly component that may import only the contract's host interface: no filesystem, sockets, clock, randomness or environment. Fuel and memory are capped per call.

  • Its own schema only. Its SQL runs as a NOLOGIN role that owns only the module's schema, through SECURITY DEFINER functions. PostgreSQL refuses a change of role inside such a function. The role cannot read, write or alter a host table. Each migration runs as a module call, under the same rules.

  • A restored session. The module shares the host's database session. After every call the host resets all session settings and releases session advisory locks. A call that leaves a temporary object, changes the prepared statements or alters the executor functions is rolled back and fails.

  • The host never touches a module table directly. A trigger on a module table would run with the host's rights.

  • Fail closed. A refused statement, a trap, an exhausted limit or the module's own error fails the call, and with it the determination.

Not prevented: a module can hold a transaction-level advisory lock or a row lock until the host's transaction ends, can spend the timeouts and statement count its manifest was granted, and at the unsupported level can answer a decision wrongly. Each is recorded in ADR-052. The tests are sandbox_infra_tests, against a real database and a fixture module that attacks its host.

Outbound fetches

No canopy surface fetches a URL an operator types: a jurisdiction's identity provider and every other outbound peer is deployment configuration (ADR-050). The egress guard that vetted such URLs (GuardedClient, for Studio's issuer probe, #570) was deleted with its last caller (#3359); a new surface that takes a URL from a user needs an SSRF guard of that kind designed with it. What remains in canopy_common::http::egress is the streaming body cap (read_capped_body) that canopy-auth's issuer and upstream clients read every response through, and caused_by_tls.

Where TLS trust comes from (#3614). An outbound HTTPS client trusts the system's certificate store: on Linux, the CA bundle the image carries, or the file SSL_CERT_FILE names. No public root is compiled into a canopy binary, so an image without ca-certificates trusts nothing; the service images install it. Two clients set trust of their own. canopy-identity's upstream client, given tls_trust_anchors, trusts that bundle and nothing else, the system's roots included, which pins discovery, keys and userinfo to the deployment's PKI. canopy-cli's client of the issuer trusts its ca_file beside the system's roots. crates/canopy-auth/src/tls_trust_tests.rs holds all three rules against TLS servers under two test CAs.

The database connection (#3629). The database client is built with TLS, on the same provider and the same trust: the system's certificate store, and beside it the PEM file a database URL's sslrootcert names. What a connection checks is its sslmode. verify-full takes a server only when a trusted root signed its certificate and the certificate names the host. verify-ca checks the signature and not the name. require encrypts and checks nothing about who answers, as in libpq, so it does not stop an attacker placed between the service and the database. Outside development canopy-db therefore refuses it with the modes that do not encrypt, and takes verify-ca and verify-full only (#3646); the one override for an unencrypted connection admits it, with a warning at every start. crates/canopy-db/src/tls_tests.rs holds each mode against a TLS endpoint under two test CAs, and tls_infra_tests.rs logs in to the devstack's PostgreSQL through that endpoint.

One crypto provider (#3631). A canopy process uses one rustls crypto provider, aws-lc-rs. Both of rustls' providers are compiled in, because third-party crates still bring an HTTP client that asks for ring, and rustls will not choose between two. So whatever opens a TLS connection installs aws-lc-rs as the process default first (canopy_common::tls::install_crypto_provider): the HTTP client builders, the database pool, the broker connection, the Redis stores and the object store. The order a process builds its clients in decides nothing, and a rediss:// or amqps:// connection does not depend on another client having gone first.

Content Security Policy (BFF)

Never weaken the CSP. The headers as shipped:

  • canopy-web (services/canopy-web/src/csp.rs): default-src 'self'; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:; frame-ancestors 'none'; form-action 'self'.

  • canopy-portal (services/canopy-portal/src/csp.rs): default-src 'self'; img-src 'self' https: data:; style-src 'self'; script-src 'self' 'nonce-{nonce}' 'wasm-unsafe-eval'; connect-src 'self'; font-src 'self'; base-uri 'self'; form-action 'self'; frame-ancestors 'none' — a per-response nonce, and the WebAssembly allowance rather than 'unsafe-eval'.

No 'unsafe-inline', no 'unsafe-eval', no inline <script>/<style>, no inline style="", no inline handlers (onclick="", inline @click="", hx-on::*); all JS and CSS in external files; the Alpine CSP build (@alpinejs/csp) only. primitives_test.rs::smoke_emits_no_inline_style_attributes pins the primitives as rendered, inline_style_tests.rs reads every template, handler and script of canopy-web for an inline style attribute, and the Playwright axe-core WCAG 2.1 AA audit must pass with zero critical violations.

Vulnerability reporting

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

Edit this page · default