# Security acceptance matrix (#262) This page is the access matrix for the hosted console and the submission gateway: which identity may reach which route, the layers that enforce it, and the test that proves each part. The adversaries and trust boundaries are described in the "Threat model" section of `SECURITY.md`; report vulnerabilities privately as that file describes. The matrix is not a description of intent. `tests/test_security_access_matrix_262.py` calls every registered route directly as each identity, with no page or link in between. A route that is added without a class fails that test until it is classified there and here. ## Identities | Identity | What it holds | |---|---| | Anonymous | Nothing, or a cookie that no longer verifies. | | Password-only | The right password, but no second factor yet. | | Submitter | An MFA session and an explicit authority/project/principal binding. | | Viewer | An MFA session and read grants on exact queue hosts. | | Operator | An MFA session, read grants and control grants on exact queue hosts. | | Administrator | An MFA session with the `admin` role. | A password-only session is treated exactly like an anonymous one: outside the sign-in pages it gets 401. A signup applicant (#257) has no account at all until an administrator approves the request, and then still needs an authenticator, so pending and rejected applicants are anonymous here. Disabled accounts, unknown roles and sessions issued before a grant change do not verify at all. ## Console access classes | Class | Who passes | Routes | |---|---|---| | Public | everyone | `GET /health/live`, and the sign-in pages: `/fleet/login`, `/fleet/login/otp`, `/fleet/login/enroll`, `/fleet/login/email`, `/fleet/login/sso` and its callback, and `/fleet/signup` (404 unless signup is open) | | Credential | everyone, but the request body must carry a valid credential | `POST` to `/fleet/login`, `/fleet/login/otp`, `/fleet/login/enroll`, `/fleet/login/email`, `/account/authenticator`, `/fleet/signup` | | Signed in | any account with an MFA session | `/`, `/account/profile` (with `/account/profile/avatar`), `/account/sessions`, `/account/notifications`, `GET /account/authenticator`, `GET /account/machines`, `/account/supporter`, `POST /fleet/logout` | | Submitter | submitter accounts only | `/my` and `/my/api/…`, `POST /account/machines` | | Reader | viewers, operators and administrators, limited to granted hosts | `/fleet`, `/fleet/_grid`, `/fleet/jobs`, `/fleet/jobs/_table`, `/fleet/jobs/{jobid}`, `/api/v1/fleet`, `/api/v1/fleet/jobs`, `/fleet/settings`, `/api/v1/fleet/settings` | | Controller | operators with a control grant on the host, and administrators | `POST /fleet/jobs/{jobid}/kill`, `…/pause`, `…/resume` | | Administrator | administrators only | `/admin/…`, the management host's own queue (`/queue`, `/jobs/…`, `/api/v1/queue…`, `/api/v1/jobs/…`, `/cite`, `/health/ready`), fleet doctor, campaigns, audit, refresh, job previews, host-settings previews, preparing or finishing a planned reboot, checking, placing or releasing a dispatch hold, and the usage overview of every principal | A refused identity gets 401 if it is not signed in, 403 if it is, and never any data. The one exception is a submitter opening `/fleet`, which is sent to `/my`. Administrators do not reach `/my`: a submitter workspace belongs to an explicit submitter binding, not to a higher role. No route answers any identity with a server error, other than 503 where a local daemon is unavailable. Being let through a class is only the first check. Reader and controller routes then apply the per-host grants, and submitter routes the gateway's ownership checks, so a viewer of one lane still gets 404 for a job on another. Those checks are proved by the cross-host tests in `tests/test_web_staff_hosts_237.py` and the cross-project and cross-owner tests in `tests/test_web_own_jobs_237.py`. ## Layers The hosted console checks a request in this order: 1. **Hosted guard** (`src/vq/web/hosted.py`). It requires the canonical HTTPS origin and refuses any `Authorization` header. A `POST`, `PUT`, `PATCH` or `DELETE` must carry exactly this console's `Origin`; one from another origin, or with no `Origin` at all, is refused before any handler runs. Outside the public pages it requires a verified MFA session, and it confines submitters to `/my` and their account pages. 2. **Staff dispatch** (`src/vq/web/staff_workspace.py`). Every verified identity except an administrator or a submitter is served by a separate allowlisted router, so viewers and operators never reach the administrator's routes at all. This dispatch is deny-by-default: a role it does not name is restricted, not let through. 3. **Route checks.** Administrator pages call `user_admin.authorize`, which requires the `admin` role (and recent MFA before account changes). Reader and controller routes apply the host grants. Submitter routes apply the gateway principal binding and ownership. The administrator-only status of the management host's own queue and of the fleet-wide views rests on the staff dispatch. Behind it, those routes only check the role thresholds of the local console (viewer to read, operator to control). The matrix test pins this layer, and a unit test proves that a role the dispatch does not recognise gets the restricted router. ## Gateway access classes The gateway is a separate service with its own credentials. It never accepts a browser cookie. | Class | Routes | Without a valid credential | |---|---|---| | Public | `GET /v1/healthz`, `GET /.well-known/vq-gateway`, `GET /v1/discovery` | answered | | Bearer key | `/v1/whoami`, `/v1/connection`, `/v1/usage`, `/v1/uploads…`, `/v1/jobs…` | 401 | | Sign-in flow | `/v1/connect/…` | refused until an identity provider is configured, then only with a valid flow state | | Connector token | `/v1/connector/…` | refused | The matrix test runs these routes in both local and relay modes, with no credential, a bogus key and a forged cookie. ## Acceptance coverage | #262 acceptance item | Status | Evidence | |---|---|---| | Anonymous, pending, submitter, viewer, operator and administrator access on every direct route | Covered | `tests/test_security_access_matrix_262.py` | | Cross-host and cross-lane denial | Covered | `tests/test_web_staff_hosts_237.py` | | Cross-project and cross-owner denial | Covered | `tests/test_web_own_jobs_237.py` | | Cross-partner denial | Not applicable yet | Federation (#255) is not implemented. | | Pending and rejected applicants get no access, keys or jobs | Covered | An application is not an account; `tests/test_web_signup_257.py` | | CSRF on every unsafe route | Covered | the origin test in `tests/test_security_access_matrix_262.py` | | Replay of TOTP codes, sessions and gateway admissions | Covered | `tests/test_web_mfa_237.py`, `tests/test_web_browser_sessions_262.py`, `tests/test_gateway_principal_quotas_254.py` | | Quotas under concurrent admission | Covered | `tests/test_gateway_principal_quotas_254.py` | | Output escaping (XSS) | Covered per page | escaping tests in `tests/test_web_fleet.py` and `tests/test_web_own_jobs_237.py` | | SSRF | By design | The server fetches only identity-provider URLs that the operator configured, over verified HTTPS with redirects refused (`src/vq/gateway/oidc.py`). No route fetches a URL a user supplies. | | Secret redaction | Covered | [security checks](hosted_console.md#security-checks-262) and the setup overview tests | | Session inventory and revocation | Covered | [signed-in sessions](machine_keys.md#review-and-revoke-signed-in-sessions-262) | | Credential rotation | Covered | Authenticator key rotation without a sign-in outage and session secret rotation: [rotation](hosted_console.md#rotating-the-authenticator-key-and-session-secret-262), `tests/test_web_key_rotation_262.py`; gateway keys rotate per key (#163, #264) | | Backup and restore | Covered | [backups and restore drills](hosted_console.md#backups-and-restore-drills-262) | | Audit tamper evidence and retention controls | Covered | Hash-linked journal, anchored by backup manifests and by checkpoints signed with an off-host key, and archiving prune: [audit integrity](hosted_console.md#audit-integrity-and-retention-262), `tests/test_web_audit_chain_262.py`, `tests/test_web_audit_checkpoints_262.py` | ## Adding a route 1. Decide its class from the table above. If none fits, the route needs a design decision first, not a new exception. 2. Add it to `CONSOLE` (or the gateway classes) in `tests/test_security_access_matrix_262.py`, and to this page. 3. Run that test. It fails until every identity gets the expected answer.