mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
docs(requirements/003): add Clarifications section and refine CSP scope
Narrow CSP directive list to what csp_filters.build_csp_header actually emits today, and record the binding implementation decisions (personas, realms, iteration mode, batching, credential sources) under a new Clarifications subsection so they supersede ambiguous checkbox reads. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
ac417eb0f2
commit
4dfd30d142
1 file changed
+18
-1
@@ -54,9 +54,26 @@ As a contributor, I want all access to application and user configuration to go
|
||||
- [ ] an OIDC flow from [web-app-dashboard](../../roles/web-app-dashboard) through [web-app-keycloak](../../roles/web-app-keycloak) into the application under test (where the app supports OIDC), proving that `lookup('applications')` drives cross-app integration.
|
||||
- [ ] at least one DOM assertion that a value originating from `applications['<application_id>']` is rendered in the UI (for example the canonical domain, display title, or a feature flag reflected in the DOM).
|
||||
- [ ] Each of those Playwright specs MUST assert the effective Content Security Policy of the rendered application, and MUST fail when the policy regresses or is missing. The assertions MUST cover:
|
||||
- [ ] the `Content-Security-Policy` response header values for `default-src`, `script-src`, `style-src`, `img-src`, `connect-src`, `frame-src`, `frame-ancestors`, `form-action`, `base-uri`, `object-src`, `worker-src`, `font-src`, and `media-src`.
|
||||
- [ ] every directive that [csp_filters.build_csp_header](../../plugins/filter/csp_filters.py) currently emits, i.e. `default-src`, `connect-src`, `frame-ancestors`, `frame-src`, `script-src` (including `script-src-elem` and `script-src-attr`), `style-src` (including `style-src-elem` and `style-src-attr`), `font-src`, `worker-src`, `manifest-src`, `media-src`, and `img-src`. `form-action`, `base-uri`, and `object-src` are not emitted by the current helper and are therefore out of scope until the helper is extended.
|
||||
- [ ] any `<meta http-equiv="Content-Security-Policy">` tag present in the rendered document, with both sources checked for parity when the application emits both.
|
||||
- [ ] that the policy is enforced, not `Content-Security-Policy-Report-Only`.
|
||||
- [ ] zero `securitypolicyviolation` events observed on `page` during the full test flow, captured via Playwright's `page.on('console')` and `page.on('pageerror')` listeners plus an explicit `window.addEventListener('securitypolicyviolation', ...)` hook.
|
||||
- [ ] Each of those Playwright specs MUST end in a logged-out state, MUST NOT contain `test.only` or `test.skip` in committed code, and MUST emit Playwright traces, screenshots, and video for failed runs so CI artifacts can be used for triage.
|
||||
- [ ] The five Playwright specs MUST run in the CI gate (for example as a matrix job in [.github/workflows/test-environment.yml](../../.github/workflows/test-environment.yml) or an equivalent gating workflow), MUST upload their failure artifacts to the CI run, and MUST block the merge when any of them fails.
|
||||
|
||||
### Clarifications
|
||||
|
||||
The following decisions bind the Verification work above. They were captured during implementation and supersede ambiguous reads of the checkboxes.
|
||||
|
||||
- **Dashboard spec scope**: extend the existing [playwright.spec.js](../../roles/web-app-dashboard/files/playwright.spec.js); do NOT rewrite.
|
||||
- **Keycloak personas and realms**: the Keycloak super administrator MUST sign in to the master realm, the `biber` and `administrator` personas MUST sign in to the normal realm. All three flows MUST use the Keycloak login interface directly, NOT an OIDC round-trip through another app.
|
||||
- **Matomo persona**: the `administrator` MUST sign in with the local Matomo login, NOT via OIDC.
|
||||
- **CSP threshold rule**: a directive is asserted if and only if [csp_filters.build_csp_header](../../plugins/filter/csp_filters.py) emits it. Missing directives that are expected by the helper MUST cause the spec to fail. Directives that the helper does not emit today (`form-action`, `base-uri`, `object-src`) are out of scope until the helper is extended.
|
||||
- **CSP gap handling**: when an app is missing a directive that the helper is supposed to emit, the app MUST be fixed in the same PR (for example via `webserver_extra_configuration` or the nginx vhost). No follow-up ticket SHOULD be used as an escape hatch.
|
||||
- **Iteration mode**: this work uses the Role Loop from [iteration.md](../agents/action/iteration.md). The Workflow Loop is NOT used.
|
||||
- **CI gate and failure artifacts**: covered transitively by the Role Loop. No separate `actions/upload-artifact` wiring is added by this requirement because no new CI workflow is introduced.
|
||||
- **SERVICES\_DISABLED scope**: the Role Loop for this requirement runs against the full stack; no services are disabled.
|
||||
- **Batching**: all five target apps are deployed together via `make deploy-fresh-purged-apps APPS="web-app-keycloak web-app-dashboard web-app-matomo web-app-openwebui web-app-discourse" FULL_CYCLE=true` as the baseline. Inner spec-only iteration uses [scripts/tests/e2e/rerun-spec.sh](../../scripts/tests/e2e/rerun-spec.sh). Role-asset changes trigger `make deploy-reuse-kept-apps APPS=<role>`. Final confirmation for each role uses `make deploy-fresh-purged-apps APPS=<role>`.
|
||||
- **DOM assertion value**: the canonical domain sourced from `applications['<application_id>']` is the preferred value for the UI-visible assertion.
|
||||
- **Personas per spec (where applicable)**: `biber` and `administrator` MUST both be covered where the application allows it. Both personas are sourced via `lookup('users', '<canonical_user_key>')`; `biber` is provisioned through [inventories/dev.yml](../../inventories/dev.yml) analogously to `administrator`.
|
||||
- **Keycloak super-admin credential source**: the master-realm super admin MUST authenticate with `KEYCLOAK_PERMANENT_ADMIN_USERNAME` and `KEYCLOAK_PERMANENT_ADMIN_PASSWORD` from [roles/web-app-keycloak/vars/main.yml](../../roles/web-app-keycloak/vars/main.yml). This is the documented exception to the general "login via `lookup('users')`" rule because the permanent admin is not a users-lookup entry.
|
||||
Reference in new issue
Block a user