From b24dab544558271d6c679dd01d0cd101fed08b81 Mon Sep 17 00:00:00 2001 From: Abisola Fatokun Date: Tue, 17 Nov 2026 15:59:32 +0000 Subject: [PATCH 1/9] Add the help skill, which shows the staircase A starting point for anyone new to xstack. The skill shows the staircase, an interactive page of the five steps from first conversation to a live service, then asks where the team is and gives the one thing to run next. The staircase ships with the skill in skills/help/assets/. The README, quick start, changelog and contributing checklist now point to it. Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 1 + CONTRIBUTING.md | 1 + GETTING-STARTED.md | 4 + README.md | 4 + skills/help/SKILL.md | 139 +++++++++++++++ skills/help/assets/staircase.html | 273 ++++++++++++++++++++++++++++++ 6 files changed, 422 insertions(+) create mode 100644 skills/help/SKILL.md create mode 100644 skills/help/assets/staircase.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 12880c5..884e38a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ All notable changes to xstack will be recorded here. Format inspired by [Keep a ### Added +- **`/xstack:help`** and the `help` skill – a starting point for anyone new to xstack. It shows the staircase, an interactive page of the five steps from first conversation to a live service, with every skill and command and what comes before and after each one. Then it asks where the team is and gives the one thing to run next, in the name that works in Claude Code or in the Claude app and Cowork. The page lives in `skills/help/assets/staircase.html` - **`/xstack:form-to-spec`** and the `form-to-spec` skill – a new entry point, **form → spec → build**. Most government services already exist as a paper or PDF form. The skill turns one – fillable PDF, flat PDF, scan, photo or Word document – into a `form-spec.md` that `/xstack:build` takes as its brief - Keeps every item with the form's own numbering, groups items into sections a citizen would recognise, and gives each a digital treatment: ask (with the component), lookup, lookup opportunity, conditional, add-another, government already holds this, drop or challenge, or back office - Uses only the lookups the country profile lists. Anything government plausibly holds but the profile doesn't cover becomes a lookup opportunity, never an assumed lookup diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a0ff41a..4ba8336 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,6 +68,7 @@ Don't guess facts about a government. Only include what you can point to. - [ ] If you've added an agent: README roster updated, AGENTS.md updated, plugin manifest updated - [ ] If you've added a skill: SKILL.md frontmatter present, agents that should call it know about it - [ ] If you've added a command: README command table updated, frontmatter present +- [ ] If you've added, renamed or removed a skill or command: the staircase in `skills/help/assets/staircase.html` updated - [ ] CHANGELOG.md updated under the next version ## What we won't accept diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md index 1b3b38b..33a015b 100644 --- a/GETTING-STARTED.md +++ b/GETTING-STARTED.md @@ -10,6 +10,10 @@ Upload `xstack.zip` via **Customize → Plugins → upload a custom plugin file* > **If `/` invocations fail with "Unknown command" (even for valid skills):** there's a known Cowork bug where the slash-command resolver breaks — skills appear in the `/` menu but won't run, and even the built-in `/feedback` fails. When that happens, **trigger skills by natural language instead.** Don't type the slash name; just describe what you want and Claude picks the right skill from its description. For example, instead of `/discovery-kit`, write: *"Using xstack, scope a discovery for … — give me the problem statement, stakeholder map, research plan, and interview guide."* Fully quitting and reopening the app or starting a fresh conversation sometimes clears it. +## Not sure where to start? + +Run **`/help`** from the xstack skills, or ask *"How do I use xstack?"*. It shows the staircase – one interactive page with every step from first conversation to a live service. Tap any skill to see what comes before it and what it leads to. Then it asks where you are and tells you the one thing to run next. + ## Set up your country profile Do this once per project, before your first real piece of work. A country profile tells xstack about your government: its service standard, design system, shared platforms, terms and data formats. diff --git a/README.md b/README.md index 3c36244..a2d53d2 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ xstack/ │ ├── service-standard-assessment/ │ ├── plain-language-check/ │ ├── weeknote/ +│ ├── help/ start here – shows the staircase and tells you what to run next │ ├── discovery-kit/ │ ├── research-coach/ router + mentor across the research cycle │ ├── research-planning/ objectives first, then the discussion guide @@ -136,6 +137,8 @@ Run `/xstack:profile` to set one up for your project. It writes `.xstack/profile ## New to xstack? +Run `/xstack:help`, or ask *"How do I use xstack?"*. It shows the staircase – one interactive page with every step from first conversation to a live service – then asks where you are and tells you what to run next. + Read **[MANUAL.md](./MANUAL.md)** – the single onboarding guide for new colleagues, partner departments, and vendor teams. About two hours to read and walk the worked example, after which you'll know which command to run, which agent to ask, and what good looks like at each phase. ## Day-to-day usage @@ -190,6 +193,7 @@ If you're not sure, ask the **delivery manager** first – they'll route you. | You want to… | Run | Hands off to | |---|---|---| +| Find out where to start | `/xstack:help` | help skill | | Set up your country profile | `/xstack:profile` | delivery-manager | | Use your government's design system | `/xstack:design-system` | developer | | Sign people in, pull what government knows and take payments | `/xstack:dpi` | developer | diff --git a/skills/help/SKILL.md b/skills/help/SKILL.md new file mode 100644 index 0000000..4039f90 --- /dev/null +++ b/skills/help/SKILL.md @@ -0,0 +1,139 @@ +--- +name: help +description: Show someone new to xstack how to use it – open the staircase, the interactive map of every step from first conversation to a live service, then find out where they are and tell them the one thing to run next. Use when someone has just installed xstack, asks what it does, or doesn't know which skill or command to use. Triggers on "/xstack:help", "help with xstack", "how do I use xstack", "what can xstack do", "where do I start", "I'm new to xstack", "what should I run", "show me the staircase", "which skill do I use". +--- + +# Help + +This skill gets someone new to xstack to their first useful step. It does three things, in this order: + +1. Shows the staircase +2. Finds out where they are +3. Tells them the one thing to run next + +Keep it short. A new person wants to start, not to read a manual. Don't list every skill in chat – the staircase does that. + +--- + +## 1. Show the staircase + +The staircase is one interactive page: `assets/staircase.html`, in this skill's folder. It shows the five steps a team climbs – Setup, Discovery, Alpha, Beta, Live – with the main thing to run on each step and the skills that support it. Tapping any skill shows what comes before it and what it leads to. + +Show the page as it is. Don't rewrite it, restyle it or redraw it as a diagram. + +- **If you can publish or preview a page** (an artifact, a preview pane or a browser), show it there. +- **If you can only write files**, copy it to the project folder as `xstack-staircase.html` and give the person the link. In a terminal, offer to open it for them. +- **If you can't show a page at all**, use the short version below. + +Then say, in two or three sentences, how to read it: start at the bottom left and climb. The dark button on each step is the thing you run to move up. Everything around it helps you do that well. + +### The short version + +Use this only when you can't show the page. + +| Step | What you do | Run | +|---|---|---| +| 0 Setup | Tell xstack which government you work for. You do this once | `/xstack:profile` | +| 1 Discovery | Talk to people. Understand how things work today | `/xstack:discover` | +| 2 Alpha | Try several ideas, test them with people, improve them | `/xstack:build`, then `/xstack:iterate` | +| 3 Beta | Build the real thing and keep people's information safe | `/xstack:productionise`, `/xstack:threat-model` | +| 4 Live | Keep listening, and go round again | back to `/xstack:discover` | + +Every week, at every step: `/xstack:weeknote`, `/xstack:show`, `/xstack:plain-language`. Before every step up: `/xstack:assess`. + +--- + +## 2. Find out where they are + +First, look for yourself: + +- Is there a country profile – `.xstack/profile.md` in the project, or a line like `xstack profile: ` in the project's `CLAUDE.md`? +- Are there prototypes, a form spec, a discovery report or research notes in the project? + +Then ask one question, using the AskUserQuestion tool if you have it. Leave out any answer you have already ruled out. + +**Where are you with your service?** + +- We're just starting +- We have a paper or PDF form +- We have a brief or a discovery report +- We have a prototype and feedback from testing +- We're ready to build the real thing +- I'm just looking around + +If they have already told you what they want to do, don't ask. Go to step 3. + +--- + +## 3. Tell them the one thing to run next + +Give one next step, not a menu. Say what to type, what to give it, and what comes out. + +| Where they are | Next step | What comes out | +|---|---|---| +| No profile yet | `/xstack:profile` | A country profile, so xstack uses their government's standard, design system and shared platforms. They can skip this – xstack falls back to its baseline and says so | +| Just starting | `/xstack:discover` | A problem statement, stakeholder map, research plan and interview guide | +| Has a paper or PDF form | `/xstack:form-to-spec` | A form spec that keeps every item, ready to use as the brief for `/xstack:build` | +| Has a brief or discovery report | `/xstack:build` | Several clickable prototypes to test, with their assumptions listed | +| Has a prototype and feedback | `/xstack:iterate` | The next version, with a note of what changed and why | +| Ready to build the real thing | `/xstack:productionise` | A production-ready front end with tests | +| Just looking around | Nothing yet | Point them to the staircase and to `GETTING-STARTED.md` | + +If there is no profile and they want to start work, mention the profile once and let them choose. Don't block them. + +If they are stuck on research, send them to the `xstack:research-coach` skill. It works out where they are in the research cycle. If they don't know which specialist to ask, send them to the delivery manager, who routes. + +### Use the name that works where they are + +The staircase shows command names such as `/xstack:build`. These work in Claude Code. In the Claude app and Cowork, the `/` menu runs skills, so give the skill name instead, or tell them to ask in plain words. + +| Command (Claude Code) | Skill (Claude app and Cowork) | +|---|---| +| `/xstack:discover` | `/discovery-kit` | +| `/xstack:form-to-spec` | `/form-to-spec` | +| `/xstack:build` | `/brief-to-prototypes` | +| `/xstack:iterate` | `/prototype-iteration` | +| `/xstack:productionise` | `/build-for-production` | +| `/xstack:review` | `/service-design-review` | +| `/xstack:assess` | `/service-standard-assessment` | +| `/xstack:plain-language` | `/plain-language-check` | +| `/xstack:show` | `/show-the-thing` | +| `/xstack:weeknote` | `/weeknote` | +| `/xstack:design-system` | `/government-design-systems` | +| `/xstack:dpi` | `/government-dpi` | +| `/xstack:profile` | No skill – ask "Using xstack, set up our country profile" | +| `/xstack:threat-model` | No skill – ask the cyber engineer for a threat model | + +If a `/` name fails with "Unknown command", tell them to ask in plain words instead, starting with "Using xstack, …". Claude picks the right skill. + +--- + +## Where to read more + +Offer these only if the person asks for more: + +- `GETTING-STARTED.md` – the quick start, about five minutes +- `MANUAL.md` – the full onboarding guide, with a worked example +- `PLAYBOOK.md` – what a team does week by week, phase by phase +- `AGENTS.md` – the five specialists and when to ask each one + +--- + +## What good looks like + +- The person has seen the staircase, or the short version +- They know which step they are on +- They have one thing to type next, in a name that works where they are +- The whole reply fits on one screen + +--- + +## Keeping the staircase true + +The staircase is only useful if it matches what xstack has. When you add, rename or remove a skill or command, update `assets/staircase.html` in the same change: + +- `N` holds one entry per skill, command and file, with its plain-language description +- `E` holds the links – what comes before and after each one +- `STEPS` places each entry on a step + +The page is a single file with no build step. It follows the reader's light or dark setting. diff --git a/skills/help/assets/staircase.html b/skills/help/assets/staircase.html new file mode 100644 index 0000000..22bd934 --- /dev/null +++ b/skills/help/assets/staircase.html @@ -0,0 +1,273 @@ + + + + + +xstack Staircase + + + + + + +
+
+

From first conversation to a live service

+

This is the path a team takes with xstack. Each step is a stage of the work. The dark button on each step is the thing you do to move up. Everything around it helps you do that well. Tap any skill to see what comes before it and what it leads to.

+
+
+ uses your design system + uses your shared platforms + Every skill starts by reading your country profile + comes before + comes after +
+
+
+
+

Every week, at every stage

+
+

Write a weeknote. Show your work to real people. Check your words are plain. And before you move up a step, take an honest look at how you're doing against the standard.

+
+
+ + + + + From 396c7d7b0f55a425977e07017ddac97b3a9c3371 Mon Sep 17 00:00:00 2001 From: Abisola Fatokun Date: Thu, 19 Nov 2026 22:03:51 +0000 Subject: [PATCH 2/9] Add machine-checked constraints for production builds Rules a production service must meet are now enforced by xstack instead of left to instructions. - constraints/baseline.json: 12 rules for every country. A Barbados layer adds two. A service opts in with .xstack/constraints.json - scripts/xstack-check.mjs: a dependency-free runner with write, stop and ci stages, waivers with an expiry, and --vendor for CI - hooks/: refuse a write that breaks a constraint, ask a person before a protected path changes, and block finishing while a "must" fails - /xstack:productionise writes the constraints file and builds the readiness report from check output, with no generated audit.sh. /xstack:threat-model drafts a constraint per control Retrofit the medical-licence example. The shipped checks failed two things its generated audit had passed: a file upload sent by GET and 50 dead links. Both are fixed: the upload posts, and the ten missing pages are built. Also fix tests/security/headers.sh on macOS sed. Co-Authored-By: Claude Fable 5.2 --- .gitignore | 3 + AGENTS.md | 2 +- CHANGELOG.md | 8 + CONTRIBUTING.md | 3 + README.md | 3 + commands/productionise.md | 6 +- commands/threat-model.md | 8 + constraints/README.md | 105 +++++ constraints/baseline.json | 206 ++++++++++ .../.xstack/constraints.json | 43 ++ .../.xstack/vendor/baseline.json | 206 ++++++++++ .../.xstack/vendor/profile-barbados.json | 37 ++ .../.xstack/vendor/xstack-check.mjs | 380 ++++++++++++++++++ .../PRODUCTION-READINESS.md | 109 +++-- .../README.md | 14 +- .../package.json | 3 +- .../public/accessibility.html | 59 +++ .../public/address-override.html | 116 ++++++ .../public/assets/govbb.css | 4 + .../public/category-update.html | 61 +++ .../public/contact-update.html | 65 +++ .../public/contact.html | 56 +++ .../public/cpd.html | 7 +- .../public/feedback.html | 65 +++ .../public/help.html | 65 +++ .../public/identity-help.html | 60 +++ .../public/parish-update.html | 100 +++++ .../public/privacy.html | 68 ++++ .../scripts/audit.sh | 157 -------- .../scripts/run-all.sh | 4 +- .../scripts/serve.sh | 14 + .../tests/security/headers.sh | 2 +- hooks/guard-write.mjs | 73 ++++ hooks/hooks.json | 27 ++ hooks/stop-gate.mjs | 68 ++++ profiles/barbados/constraints.json | 37 ++ scripts/xstack-check.mjs | 380 ++++++++++++++++++ skills/build-for-production/SKILL.md | 32 +- 38 files changed, 2451 insertions(+), 205 deletions(-) create mode 100644 constraints/README.md create mode 100644 constraints/baseline.json create mode 100644 examples/production-renew-medical-licence/.xstack/constraints.json create mode 100644 examples/production-renew-medical-licence/.xstack/vendor/baseline.json create mode 100644 examples/production-renew-medical-licence/.xstack/vendor/profile-barbados.json create mode 100644 examples/production-renew-medical-licence/.xstack/vendor/xstack-check.mjs create mode 100644 examples/production-renew-medical-licence/public/accessibility.html create mode 100644 examples/production-renew-medical-licence/public/address-override.html create mode 100644 examples/production-renew-medical-licence/public/category-update.html create mode 100644 examples/production-renew-medical-licence/public/contact-update.html create mode 100644 examples/production-renew-medical-licence/public/contact.html create mode 100644 examples/production-renew-medical-licence/public/feedback.html create mode 100644 examples/production-renew-medical-licence/public/help.html create mode 100644 examples/production-renew-medical-licence/public/identity-help.html create mode 100644 examples/production-renew-medical-licence/public/parish-update.html create mode 100644 examples/production-renew-medical-licence/public/privacy.html delete mode 100755 examples/production-renew-medical-licence/scripts/audit.sh create mode 100644 hooks/guard-write.mjs create mode 100644 hooks/hooks.json create mode 100644 hooks/stop-gate.mjs create mode 100644 profiles/barbados/constraints.json create mode 100644 scripts/xstack-check.mjs diff --git a/.gitignore b/.gitignore index 4cea2de..0ebe0e8 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ coverage/ # Local scratch scratch/ notes-private/ + +# xstack constraint check output (regenerated on every run) +**/.xstack/check-report.json diff --git a/AGENTS.md b/AGENTS.md index aef603d..de34c1f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,7 +110,7 @@ This file is the canonical roster. For the full definition of any agent, read th **Default deliverables:** threat models, data inventories, privacy notices, DPIAs, incident runbooks, security testing plans, phase-gate security readiness reports. -**Skills it calls into:** none specific (cyber work is mostly bespoke per service; the agent reaches for STRIDE / LINDDUN frames documented in its own file). +**Skills it calls into:** none specific (cyber work is mostly bespoke per service; the agent reaches for STRIDE / LINDDUN frames documented in its own file). Turns each threat-model control into a constraint that xstack checks – see `constraints/README.md`. **Triggers:** threat model, security review, pen test, privacy, data protection, incident, secure by design, PII, vulnerability, encryption, auth. diff --git a/CHANGELOG.md b/CHANGELOG.md index 884e38a..5aa1803 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,14 @@ All notable changes to xstack will be recorded here. Format inspired by [Keep a ### Added +- **Constraints** – rules a production service must meet, written so a machine checks them, and enforced by xstack instead of left to instructions. See `constraints/README.md` + - A service opts in with `.xstack/constraints.json`. It extends the baseline in `constraints/baseline.json` (secrets, inline script, POST for uploads, page landmarks, alt text, dead links, inline styles, prototype chrome, dependency checks) and a profile layer where there is one. Barbados has the first, in `profiles/barbados/constraints.json` + - `scripts/xstack-check.mjs` runs them at three stages – `write`, `stop` and `ci` – and reports PASS, FAIL, WAIVED or NOT RUN. It has no dependencies, and `--vendor` copies it into a service for CI + - Plugin hooks in `hooks/`: a write that breaks a constraint is refused, a change to the constraints file or other protected path needs a person's approval, and an agent cannot finish while a "must" constraint fails + - Relaxing a constraint takes a waiver with a reason, an approver and an expiry date + - `/xstack:productionise` now writes the constraints file and builds PRODUCTION-READINESS.md from the check results, and no longer generates its own `audit.sh`. `/xstack:threat-model` turns each control into a drafted constraint + - The medical-licence production example is retrofitted. The shipped checks failed two things its generated audit had passed: a file upload sent by GET, and 50 links to pages that did not exist. Both are fixed – the upload uses POST and the ten missing pages are built + - **`/xstack:help`** and the `help` skill – a starting point for anyone new to xstack. It shows the staircase, an interactive page of the five steps from first conversation to a live service, with every skill and command and what comes before and after each one. Then it asks where the team is and gives the one thing to run next, in the name that works in Claude Code or in the Claude app and Cowork. The page lives in `skills/help/assets/staircase.html` - **`/xstack:form-to-spec`** and the `form-to-spec` skill – a new entry point, **form → spec → build**. Most government services already exist as a paper or PDF form. The skill turns one – fillable PDF, flat PDF, scan, photo or Word document – into a `form-spec.md` that `/xstack:build` takes as its brief - Keeps every item with the form's own numbering, groups items into sections a citizen would recognise, and gives each a digital treatment: ask (with the component), lookup, lookup opportunity, conditional, add-another, government already holds this, drop or challenge, or back office diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4ba8336..0b8c3d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,9 @@ xstack/ ├── commands/ one .md per slash command, frontmatter + body ├── skills/ one folder per skill, with SKILL.md ├── references/ one .md per reference, the canonical, country-agnostic xstack view +├── constraints/ the baseline constraints every production build must meet, and how they work +├── hooks/ plugin hooks that enforce constraints when an agent writes or stops +├── scripts/ xstack-check, the constraint runner └── profiles/ one folder per country profile, plus _template/ ``` diff --git a/README.md b/README.md index a2d53d2..cd78840 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,9 @@ xstack/ │ ├── page-composition/ │ ├── token-cross-check/ │ └── show-the-thing/ +├── constraints/ rules a production build must meet, checked by machine +├── hooks/ plugin hooks that enforce the constraints +├── scripts/ xstack-check, the constraint runner ├── references/ the canonical, country-agnostic knowledge base │ ├── service-standard-baseline.md the 14 themes │ ├── govuk-design-principles.md diff --git a/commands/productionise.md b/commands/productionise.md index a6f491c..69df0d6 100644 --- a/commands/productionise.md +++ b/commands/productionise.md @@ -20,10 +20,12 @@ Once you have the context, the skill produces (in a `production-[service-slug]/` 1. **Per-page HTML files** with proper URLs, real navigation, the design system's published stylesheet linked (from the profile, or as the team confirms), the assumptions panel and mock markers stripped 2. **The test suite** – Playwright E2E regression (3 specs), axe-core accessibility, security headers + CSP, k6 load tests (peak and soak) 3. **Configuration** – playwright.config.ts, package.json with npm scripts -4. **Scripts** – serve.sh, run-all.sh, audit.sh +4. **Scripts** – serve.sh, run-all.sh 5. **PRODUCTION-READINESS.md** – assessed against the **Works first time**, **Right technology**, **Trust, security and privacy** and **Measuring performance** themes (cited as the profile's own standards where there is a profile), each Met / Partly met / Not met, with evidence -Run what's runnable in the current environment: HTML validation, link integrity, design-system class usage. For the parts that need full tool installation (Playwright browsers, k6 binary, OWASP ZAP), the report explicitly says "requires CI environment with these tools installed" with the exact commands. +6. **Constraints** – `.xstack/constraints.json` (the baseline, the profile's layer where it has one, and this service's own), with xstack's check runner copied into `.xstack/vendor/`. See `constraints/README.md` + +Do not write your own audit script. Run the shipped runner – `node .xstack/vendor/xstack-check.mjs --stage stop` – and fix what it finds. The ratings in PRODUCTION-READINESS.md come from its output: a theme is Met only when every one of its constraints passes at the `ci` stage, and each rating cites the constraint ids it rests on. If a "must" constraint cannot be met, report it as failing and ask the user whether to fix it or record a waiver. Never add a waiver yourself. For the parts that need full tool installation (Playwright browsers, k6 binary, OWASP ZAP), the report explicitly says "requires CI environment with these tools installed" with the exact commands. After generation, share the production folder via a computer:// link. Highlight any standards still at Partly met or Not met, and name the next-step owner (cyber engineer for the threat-model gap, developer for the backend wiring, delivery manager for operational readiness). diff --git a/commands/threat-model.md b/commands/threat-model.md index 5d5fc55..4a57297 100644 --- a/commands/threat-model.md +++ b/commands/threat-model.md @@ -33,4 +33,12 @@ For diagrams, use Mermaid where the tooling supports it; otherwise produce a cle Cross-reference the assessment against the **Trust, security and privacy**, **Inclusion** (security mustn't lock disabled citizens out) and **Open platforms and standards** (reuse the national identity platform, don't bake your own) themes. Cite the profile's own standard by number and title where there is one. +**Turn every control into a constraint.** A control that nothing checks is a hope. If the service has `.xstack/constraints.json`, give each control in section 7 one of three endings: + +- **A constraint** – draft it in the format in `constraints/README.md`, with `source` set to the threat it answers (e.g. `threat model T-04`), and a check: a pattern, or a `command` that runs a test or a scanner. +- **A test still to write** – name the test and its owner, and draft the `command` constraint that will run it. +- **Not machine-checkable** – say so, and say who verifies it and when (pen test, DPIA, procedure). + +Each data-inventory item the service must not collect becomes a `forbid-pattern` constraint on the form field names. List the drafted constraints at the end of the threat model under "Constraints to add". The constraints file is protected: a person approves adding them. Never remove or loosen an existing constraint; if one is wrong, say why and ask for a waiver. + Save the threat model to the workspace folder as `threat-model-[service-slug]-YYYY-MM-DD.md` and share the file link with the user. Flag any findings the developer needs to act on immediately. diff --git a/constraints/README.md b/constraints/README.md new file mode 100644 index 0000000..5802859 --- /dev/null +++ b/constraints/README.md @@ -0,0 +1,105 @@ +# Constraints + +A constraint is a rule a production service must meet, written so a machine can check it. xstack enforces constraints in three places, so they do not depend on an agent remembering an instruction. + +| Where | What happens | File | +|---|---|---| +| When the agent writes a file | A write that adds a secret, an inline script or prototype chrome is refused. A change to a protected path needs a person to say yes | `hooks/guard-write.mjs` | +| When the agent says it is done | The checks run. If a "must" constraint fails, the agent is sent back with the findings | `hooks/stop-gate.mjs` | +| In CI | Every constraint runs, including the ones that need a server, browsers and scanners | `scripts/xstack-check.mjs --stage ci` | + +The checks ship with xstack. The agent that writes the code does not write the checker. + +Constraints raise the floor. They do not replace the threat model, the pen test or the DPIA. + +## Turning it on + +A folder is constrained when it has `.xstack/constraints.json`. `/xstack:productionise` creates one. Everywhere else the hooks do nothing. + +```json +{ + "version": 1, + "service": "renew-medical-licence", + "extends": ["xstack:baseline", "profile:barbados"], + "vars": { "web": "public" }, + "protected": ["tests/security/**"], + "constraints": [], + "waivers": [] +} +``` + +Then copy the runner into the service so CI can run it without the plugin: + +```bash +node "$CLAUDE_PLUGIN_ROOT/scripts/xstack-check.mjs" --vendor --root . +``` + +## Layers + +Constraints come from three layers. Later layers add constraints. They cannot redefine one from an earlier layer. + +1. **Baseline** – `constraints/baseline.json`. Ships with xstack and applies in every country. +2. **Profile** – `profiles//constraints.json`. The government's design system, house style, platforms and law. +3. **Service** – the `constraints` list in the service's own file. Each threat-model mitigation, each field in the data inventory and each test suite that must pass. + +## A constraint + +```json +{ + "id": "SVC-SEC-002", + "title": "The licence number is never written to a log", + "theme": "Trust, security and privacy", + "source": "threat model T-04 (information disclosure)", + "owner": "cyber-engineer", + "severity": "must", + "when": ["stop", "ci"], + "check": { "type": "forbid-pattern", "files": ["src/**/*.ts"], "patterns": ["log\\w*\\([^)]*licenceNumber"] }, + "fix": "Log the application reference instead." +} +``` + +- `theme` is a theme from `references/service-standard-baseline.md`. The readiness report groups evidence by theme. +- `source` says where the rule comes from: a standard, a law, a threat, a profile file. +- `severity` is `must` (blocks) or `should` (reported). +- `when` lists the stages the check runs at: `write`, `stop`, `ci`. The `ci` stage runs everything. +- `onlyIf` is optional: `{ "exists": "package.json" }` skips the constraint when the file is absent. + +## Check types + +| Type | Passes when | Options | +|---|---|---| +| `forbid-pattern` | No file matches any pattern. The only type that can run at `write` | `files`, `exclude`, `patterns`, `flags` | +| `require-pattern` | Every file matches every pattern | `files`, `exclude`, `patterns`, `flags` | +| `links-resolve` | Every internal `href`, `action` and `src` points at a file | `files`, `root`, `ignore` | +| `form-method` | Every form with a file or password input uses POST | `files` | +| `file-exists` | The file, or one of `anyOf`, exists | `path` or `anyOf` | +| `command` | The command exits 0. Use it to wrap a scanner or a test suite | `run`, `requires`, `timeoutSeconds` | + +If the tool a `command` check `requires` is not installed, the result is NOT RUN. At the `ci` stage a "must" constraint that did not run counts as a failure. + +## Waivers + +A team relaxes a constraint with a waiver, not by editing or deleting it. + +```json +{ "id": "WFT-001", "reason": "Help and privacy pages arrive in sprint 9", "approvedBy": "A. Person, service owner", "expires": "2027-01-31" } +``` + +A waiver needs all three of `reason`, `approvedBy` and `expires`. An expired or incomplete waiver does nothing. The constraints file is a protected path, so only a person can add one. Agents: if a constraint cannot be met, say which and why, and ask. + +## Reading the results + +```bash +node .xstack/vendor/xstack-check.mjs --stage stop # text +node .xstack/vendor/xstack-check.mjs --stage ci --format md # the evidence section for PRODUCTION-READINESS.md +``` + +Results are PASS, FAIL, WAIVED, NOT RUN or N/A. Each run writes `.xstack/check-report.json`. + +A theme is **Met** only if every one of its constraints is PASS at the `ci` stage. FAIL, WAIVED and NOT RUN are at best **Partly met**. A rating in a readiness report or a standards assessment cites the constraint ids it rests on. + +## Limits + +- The hooks cover the Write and Edit tools. An agent with a shell can still change a file another way. CI is the backstop: run the `ci` stage on every pull request, and require review for changes under `.xstack/`. +- Pattern checks find known shapes of mistake. They do not prove their absence. +- The baseline covers the front end and the repository. Back-end constraints – authorisation, input validation, logging – arrive with the back-end scaffold. diff --git a/constraints/baseline.json b/constraints/baseline.json new file mode 100644 index 0000000..943a801 --- /dev/null +++ b/constraints/baseline.json @@ -0,0 +1,206 @@ +{ + "version": 1, + "layer": "xstack:baseline", + "description": "Constraints every xstack production build must meet, whatever the country. Themes are the ones in references/service-standard-baseline.md.", + "vars": { + "web": "public", + "backendRoutes": "/api/**" + }, + "constraints": [ + { + "id": "SEC-001", + "title": "No secrets in source", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["**/*"], + "exclude": ["**/*.lock", "**/package-lock.json"], + "patterns": [ + "AKIA[0-9A-Z]{16}", + "-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY", + "gh[pousr]_[A-Za-z0-9]{36,}", + "xox[baprs]-[A-Za-z0-9-]{10,}", + "sk_live_[A-Za-z0-9]{16,}", + "(?:api[_-]?key|secret|passwd|password|token)[\"']?\\s*[:=]\\s*[\"'][A-Za-z0-9+/_\\-]{20,}[\"']" + ], + "flags": "i" + }, + "fix": "Remove the value. Read it from the environment or the platform's secret store, and rotate it if it was ever real." + }, + { + "id": "SEC-002", + "title": "No inline event handlers", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["<[^>]+\\son[a-z]+\\s*=\\s*[\"']"], + "flags": "i" + }, + "fix": "Move the behaviour to a linked script and use addEventListener, so a strict Content-Security-Policy can stay on." + }, + { + "id": "SEC-003", + "title": "No inline scripts", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]*\\ssrc=)[^>]*>", "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:"], + "flags": "i" + }, + "fix": "Link the script with src. A strict Content-Security-Policy blocks inline script." + }, + { + "id": "SEC-004", + "title": "Forms that send files or passwords use POST", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "form-method", + "files": ["{{web}}/**/*.html"] + }, + "fix": "Set method=\"post\" on the form (and enctype=\"multipart/form-data\" for uploads). GET puts the data in the URL, in logs and in history." + }, + { + "id": "SEC-005", + "title": "No secrets leaked in git history or working tree (gitleaks)", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["ci"], + "check": { + "type": "command", + "requires": "gitleaks", + "run": "gitleaks dir . --no-banner --redact" + }, + "fix": "Remove and rotate whatever gitleaks reports." + }, + { + "id": "SEC-006", + "title": "No known high or critical vulnerabilities in dependencies", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["ci"], + "onlyIf": { "exists": "package.json" }, + "check": { + "type": "command", + "requires": "npm", + "run": "npm audit --audit-level=high" + }, + "fix": "Upgrade or replace the dependency. If there is no fix yet, a human records a waiver with an expiry date." + }, + { + "id": "SEC-007", + "title": "Dependencies are pinned by a lockfile", + "theme": "Sustainable and reliable", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["ci"], + "onlyIf": { "exists": "package.json" }, + "check": { + "type": "file-exists", + "anyOf": ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] + }, + "fix": "Run the package manager's install and commit the lockfile." + }, + { + "id": "A11Y-001", + "title": "Every page declares its language, has a title and a main landmark", + "theme": "Inclusion", + "source": "xstack baseline", + "owner": "content-designer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "require-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["", "]*\\slang=[\"'][a-zA-Z-]+[\"']", "[^<]+", "]"], + "flags": "i" + }, + "fix": "Add the missing element. Screen readers need all four." + }, + { + "id": "A11Y-002", + "title": "Every image has an alt attribute", + "theme": "Inclusion", + "source": "xstack baseline", + "owner": "content-designer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]*\\salt=)[^>]*>"], + "flags": "i" + }, + "fix": "Add alt text, or alt=\"\" if the image is decoration." + }, + { + "id": "WFT-001", + "title": "Every internal link and form action goes somewhere", + "theme": "Works first time", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "links-resolve", + "files": ["{{web}}/**/*.html"], + "root": "{{web}}", + "ignore": ["{{backendRoutes}}"] + }, + "fix": "Build the page, or remove the link until it exists. A dead link in a government service is a dead end for a citizen." + }, + { + "id": "TECH-001", + "title": "Styles are linked, not inlined", + "theme": "Right technology", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]"], + "flags": "i" + }, + "fix": "Move the rules to the linked stylesheet. Use the design system's own classes first." + }, + { + "id": "OPEN-001", + "title": "No prototype chrome in production", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["xstack-banner", "xstack-assumptions", "Show assumptions", "verify-tag", "fake-data", "\\[VERIFY WITH "] + }, + "fix": "Strip the assumptions panel, banner and mock-data markers. Citizens must never see invented data presented as real." + } + ] +} diff --git a/examples/production-renew-medical-licence/.xstack/constraints.json b/examples/production-renew-medical-licence/.xstack/constraints.json new file mode 100644 index 0000000..4550c69 --- /dev/null +++ b/examples/production-renew-medical-licence/.xstack/constraints.json @@ -0,0 +1,43 @@ +{ + "version": 1, + "service": "renew-medical-licence", + "extends": ["xstack:baseline", "profile:barbados"], + "vars": { "web": "public" }, + "protected": ["tests/security/**", "tests/accessibility/**", "playwright.config.ts"], + "constraints": [ + { + "id": "SVC-SEC-001", + "title": "The server sends the six security headers, with a CSP that forbids inline script", + "theme": "Trust, security and privacy", + "source": "Standard 11 (Trust, safety, confidentiality)", + "owner": "cyber-engineer", + "severity": "must", + "when": ["ci"], + "check": { "type": "command", "requires": "curl", "run": "./tests/security/headers.sh \"${BASE_URL:-http://localhost:8080}\"" }, + "fix": "Set the missing header on the server. scripts/serve.sh shows the values." + }, + { + "id": "SVC-A11Y-001", + "title": "Every page in every state passes axe at WCAG 2.1 AA", + "theme": "Inclusion", + "source": "Standard 3 (Inclusion)", + "owner": "content-designer", + "severity": "must", + "when": ["ci"], + "check": { "type": "command", "requires": "npx", "run": "npx --no-install playwright test tests/accessibility" }, + "fix": "Fix the violation axe reports. Do not add the rule to an exclusion list." + }, + { + "id": "SVC-WFT-001", + "title": "A doctor can renew end to end, including from abroad and through every error state", + "theme": "Works first time", + "source": "Standard 5 (Works first time)", + "owner": "developer", + "severity": "must", + "when": ["ci"], + "check": { "type": "command", "requires": "npx", "run": "npx --no-install playwright test tests/e2e" }, + "fix": "Fix the journey, not the test." + } + ], + "waivers": [] +} diff --git a/examples/production-renew-medical-licence/.xstack/vendor/baseline.json b/examples/production-renew-medical-licence/.xstack/vendor/baseline.json new file mode 100644 index 0000000..943a801 --- /dev/null +++ b/examples/production-renew-medical-licence/.xstack/vendor/baseline.json @@ -0,0 +1,206 @@ +{ + "version": 1, + "layer": "xstack:baseline", + "description": "Constraints every xstack production build must meet, whatever the country. Themes are the ones in references/service-standard-baseline.md.", + "vars": { + "web": "public", + "backendRoutes": "/api/**" + }, + "constraints": [ + { + "id": "SEC-001", + "title": "No secrets in source", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["**/*"], + "exclude": ["**/*.lock", "**/package-lock.json"], + "patterns": [ + "AKIA[0-9A-Z]{16}", + "-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY", + "gh[pousr]_[A-Za-z0-9]{36,}", + "xox[baprs]-[A-Za-z0-9-]{10,}", + "sk_live_[A-Za-z0-9]{16,}", + "(?:api[_-]?key|secret|passwd|password|token)[\"']?\\s*[:=]\\s*[\"'][A-Za-z0-9+/_\\-]{20,}[\"']" + ], + "flags": "i" + }, + "fix": "Remove the value. Read it from the environment or the platform's secret store, and rotate it if it was ever real." + }, + { + "id": "SEC-002", + "title": "No inline event handlers", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["<[^>]+\\son[a-z]+\\s*=\\s*[\"']"], + "flags": "i" + }, + "fix": "Move the behaviour to a linked script and use addEventListener, so a strict Content-Security-Policy can stay on." + }, + { + "id": "SEC-003", + "title": "No inline scripts", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]*\\ssrc=)[^>]*>", "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:"], + "flags": "i" + }, + "fix": "Link the script with src. A strict Content-Security-Policy blocks inline script." + }, + { + "id": "SEC-004", + "title": "Forms that send files or passwords use POST", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "form-method", + "files": ["{{web}}/**/*.html"] + }, + "fix": "Set method=\"post\" on the form (and enctype=\"multipart/form-data\" for uploads). GET puts the data in the URL, in logs and in history." + }, + { + "id": "SEC-005", + "title": "No secrets leaked in git history or working tree (gitleaks)", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["ci"], + "check": { + "type": "command", + "requires": "gitleaks", + "run": "gitleaks dir . --no-banner --redact" + }, + "fix": "Remove and rotate whatever gitleaks reports." + }, + { + "id": "SEC-006", + "title": "No known high or critical vulnerabilities in dependencies", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "cyber-engineer", + "severity": "must", + "when": ["ci"], + "onlyIf": { "exists": "package.json" }, + "check": { + "type": "command", + "requires": "npm", + "run": "npm audit --audit-level=high" + }, + "fix": "Upgrade or replace the dependency. If there is no fix yet, a human records a waiver with an expiry date." + }, + { + "id": "SEC-007", + "title": "Dependencies are pinned by a lockfile", + "theme": "Sustainable and reliable", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["ci"], + "onlyIf": { "exists": "package.json" }, + "check": { + "type": "file-exists", + "anyOf": ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] + }, + "fix": "Run the package manager's install and commit the lockfile." + }, + { + "id": "A11Y-001", + "title": "Every page declares its language, has a title and a main landmark", + "theme": "Inclusion", + "source": "xstack baseline", + "owner": "content-designer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "require-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["", "]*\\slang=[\"'][a-zA-Z-]+[\"']", "[^<]+", "]"], + "flags": "i" + }, + "fix": "Add the missing element. Screen readers need all four." + }, + { + "id": "A11Y-002", + "title": "Every image has an alt attribute", + "theme": "Inclusion", + "source": "xstack baseline", + "owner": "content-designer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]*\\salt=)[^>]*>"], + "flags": "i" + }, + "fix": "Add alt text, or alt=\"\" if the image is decoration." + }, + { + "id": "WFT-001", + "title": "Every internal link and form action goes somewhere", + "theme": "Works first time", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "links-resolve", + "files": ["{{web}}/**/*.html"], + "root": "{{web}}", + "ignore": ["{{backendRoutes}}"] + }, + "fix": "Build the page, or remove the link until it exists. A dead link in a government service is a dead end for a citizen." + }, + { + "id": "TECH-001", + "title": "Styles are linked, not inlined", + "theme": "Right technology", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["]"], + "flags": "i" + }, + "fix": "Move the rules to the linked stylesheet. Use the design system's own classes first." + }, + { + "id": "OPEN-001", + "title": "No prototype chrome in production", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["xstack-banner", "xstack-assumptions", "Show assumptions", "verify-tag", "fake-data", "\\[VERIFY WITH "] + }, + "fix": "Strip the assumptions panel, banner and mock-data markers. Citizens must never see invented data presented as real." + } + ] +} diff --git a/examples/production-renew-medical-licence/.xstack/vendor/profile-barbados.json b/examples/production-renew-medical-licence/.xstack/vendor/profile-barbados.json new file mode 100644 index 0000000..33a9303 --- /dev/null +++ b/examples/production-renew-medical-licence/.xstack/vendor/profile-barbados.json @@ -0,0 +1,37 @@ +{ + "version": 1, + "layer": "profile:barbados", + "description": "Constraints from the Barbados profile: the GovBB design system and the GovTech Barbados house style.", + "constraints": [ + { + "id": "BB-DS-001", + "title": "Every page uses the GovBB design system and its skip link", + "theme": "Right technology", + "source": "profiles/barbados/design-guide.md", + "owner": "content-designer", + "severity": "must", + "when": ["stop", "ci"], + "check": { + "type": "require-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["class=\"[^\"]*govbb-skip-link", "role=\"banner\"", "role=\"contentinfo\"", "rel=\"stylesheet\""] + }, + "fix": "Start the page from the GovBB page template: skip link, header and footer landmarks, linked stylesheet." + }, + { + "id": "BB-STYLE-001", + "title": "No em dashes in citizen-facing pages", + "theme": "Plain language", + "source": "profiles/barbados/house-style.md", + "owner": "content-designer", + "severity": "must", + "when": ["write", "stop", "ci"], + "check": { + "type": "forbid-pattern", + "files": ["{{web}}/**/*.html"], + "patterns": ["—"] + }, + "fix": "Use a spaced en dash, or split the sentence." + } + ] +} diff --git a/examples/production-renew-medical-licence/.xstack/vendor/xstack-check.mjs b/examples/production-renew-medical-licence/.xstack/vendor/xstack-check.mjs new file mode 100644 index 0000000..fab3170 --- /dev/null +++ b/examples/production-renew-medical-licence/.xstack/vendor/xstack-check.mjs @@ -0,0 +1,380 @@ +#!/usr/bin/env node +// xstack-check – run a service's constraints and report the evidence. +// +// The checks ship with xstack. The agent that writes the code does not write +// the checker. No dependencies: Node 20 or later. +// +// xstack-check [--root DIR] [--stage write|stop|ci] [--format text|json|md] +// [--no-report] +// xstack-check --vendor [--root DIR] copy the runner and its layers into +// DIR/.xstack/vendor so CI can run it +// +// Exit codes: 0 all "must" constraints hold, 1 at least one does not, +// 2 the constraints file is missing or invalid. +// +// See constraints/README.md for the file format. + +import fs from 'node:fs'; +import path from 'node:path'; +import { spawnSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +export const CONSTRAINTS_FILE = path.join('.xstack', 'constraints.json'); +export const REPORT_FILE = path.join('.xstack', 'check-report.json'); +const SKIP_DIRS = new Set(['node_modules', '.git', 'reports', 'test-results', 'playwright-report', 'dist', 'build', 'coverage']); +const BINARY = /\.(png|jpe?g|gif|webp|ico|pdf|woff2?|ttf|otf|eot|zip|gz|mp4|mov|docx|pptx|xlsx)$/i; +const STAGES = ['write', 'stop', 'ci']; +// A path the agent may not change without a person saying yes. +export const ALWAYS_PROTECTED = ['.xstack/constraints.json', '.xstack/vendor/**']; + +// ---------- small helpers ---------- + +export function globToRegExp(glob) { + let re = ''; + for (let i = 0; i < glob.length; i++) { + const c = glob[i]; + if (c === '*') { + if (glob[i + 1] === '*') { + i++; + if (glob[i + 1] === '/') { i++; re += '(?:.*/)?'; } else re += '.*'; + } else re += '[^/]*'; + } else if (c === '?') re += '[^/]'; + else re += c.replace(/[.+^${}()|[\]\\]/g, '\\$&'); + } + return new RegExp(`^${re}$`); +} + +export function matchesAny(rel, globs = []) { + return globs.some((g) => globToRegExp(g).test(rel)); +} + +export function walk(root) { + const out = []; + const visit = (dir) => { + let entries; + try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; } + for (const e of entries) { + if (e.isDirectory()) { + if (!SKIP_DIRS.has(e.name)) visit(path.join(dir, e.name)); + } else if (e.isFile()) { + out.push(path.relative(root, path.join(dir, e.name)).split(path.sep).join('/')); + } + } + }; + visit(root); + return out.sort(); +} + +function subst(value, vars) { + if (typeof value === 'string') return value.replace(/\{\{(\w+)\}\}/g, (m, k) => (k in vars ? vars[k] : m)); + if (Array.isArray(value)) return value.map((v) => subst(v, vars)); + if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, subst(v, vars)])); + return value; +} + +// Blank out HTML comments but keep the line numbers, so markup that is only +// described in a comment is neither credited nor blamed. +function withoutComments(text) { + return text.replace(//g, (m) => m.replace(/[^\n]/g, ' ')); +} + +function lineOf(text, index) { + return text.slice(0, index).split('\n').length; +} + +function readJson(file) { + return JSON.parse(fs.readFileSync(file, 'utf8')); +} + +// ---------- loading and merging layers ---------- + +function layerCandidates(name, root) { + const vendor = path.join(root, '.xstack', 'vendor'); + if (name === 'xstack:baseline') { + return [path.join(vendor, 'baseline.json'), path.join(HERE, 'baseline.json'), path.join(HERE, '..', 'constraints', 'baseline.json')]; + } + if (name.startsWith('profile:')) { + const p = name.slice('profile:'.length); + if (!/^[\w-]+$/.test(p)) throw new Error(`Bad profile name in extends: ${name}`); + return [path.join(vendor, `profile-${p}.json`), path.join(HERE, `profile-${p}.json`), path.join(HERE, '..', 'profiles', p, 'constraints.json')]; + } + return [path.resolve(root, name)]; +} + +export function resolveLayer(name, root) { + const found = layerCandidates(name, root).find((f) => fs.existsSync(f)); + if (!found) throw new Error(`Cannot find the constraints layer "${name}"`); + return found; +} + +export function loadConstraints(root) { + const file = path.join(root, CONSTRAINTS_FILE); + if (!fs.existsSync(file)) throw new Error(`No ${CONSTRAINTS_FILE} in ${root}`); + const project = readJson(file); + const layers = (project.extends || ['xstack:baseline']).map((name) => ({ name, ...readJson(resolveLayer(name, root)) })); + layers.push({ name: 'service', ...project }); + + const vars = Object.assign({}, ...layers.map((l) => l.vars || {})); + const byId = new Map(); + for (const layer of layers) { + for (const c of layer.constraints || []) { + // A later layer can add constraints. It cannot redefine an earlier one: + // loosening a rule is a waiver, with a name and an expiry on it. + if (byId.has(c.id)) throw new Error(`Constraint ${c.id} is defined twice (in "${byId.get(c.id).layer}" and "${layer.name}"). To relax a constraint, add a waiver.`); + validate(c, layer.name); + byId.set(c.id, { ...subst(c, vars), layer: layer.name }); + } + } + return { + service: project.service || path.basename(root), + vars, + constraints: [...byId.values()], + waivers: project.waivers || [], + protected: [...ALWAYS_PROTECTED, ...subst(project.protected || [], vars)], + }; +} + +function validate(c, layer) { + const bad = (msg) => { throw new Error(`Constraint ${c.id || '(no id)'} in "${layer}": ${msg}`); }; + for (const k of ['id', 'title', 'theme', 'source', 'owner', 'severity', 'when', 'check']) if (c[k] === undefined) bad(`missing "${k}"`); + if (!['must', 'should'].includes(c.severity)) bad('severity must be "must" or "should"'); + if (!Array.isArray(c.when) || !c.when.length || c.when.some((s) => !STAGES.includes(s))) bad(`"when" must list one or more of ${STAGES.join(', ')}`); + if (!CHECKS[c.check.type]) bad(`unknown check type "${c.check.type}"`); + if (c.when.includes('write') && c.check.type !== 'forbid-pattern') bad('only forbid-pattern checks can run at the "write" stage'); +} + +// ---------- the checks ---------- + +function selectFiles(ctx, check) { + return ctx.files.filter((f) => matchesAny(f, check.files) && !matchesAny(f, check.exclude) && !BINARY.test(f)); +} + +function read(ctx, rel) { + try { return fs.readFileSync(path.join(ctx.root, rel), 'utf8'); } catch { return ''; } +} + +export function findForbidden(text, check) { + const hits = []; + for (const p of check.patterns) { + const re = new RegExp(p, `g${check.flags || ''}`); + let m; + while ((m = re.exec(text)) && hits.length < 50) { + hits.push({ line: lineOf(text, m.index), pattern: p }); + if (m[0] === '') re.lastIndex++; + } + } + return hits; +} + +const CHECKS = { + 'forbid-pattern'(ctx, check) { + const files = selectFiles(ctx, check); + const findings = []; + for (const f of files) for (const h of findForbidden(read(ctx, f), check)) findings.push(`${f}:${h.line} matches /${h.pattern}/`); + return { ok: findings.length === 0, findings, checked: files.length }; + }, + + 'require-pattern'(ctx, check) { + const files = selectFiles(ctx, check); + const findings = []; + for (const f of files) { + const text = read(ctx, f); + for (const p of check.patterns) if (!new RegExp(p, check.flags || '').test(text)) findings.push(`${f} has nothing matching /${p}/`); + } + return { ok: findings.length === 0, findings, checked: files.length }; + }, + + 'links-resolve'(ctx, check) { + const files = selectFiles(ctx, check); + const webRoot = path.join(ctx.root, check.root || '.'); + const findings = []; + for (const f of files) { + const text = withoutComments(read(ctx, f)); + const re = /\s(?:href|action|src)\s*=\s*["']([^"']*)["']/gi; + let m; + const seen = new Set(); + while ((m = re.exec(text))) { + const target = m[1].trim(); + if (!target || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\{\{)/i.test(target)) continue; // external, fragment or template + const clean = target.split('#')[0].split('?')[0]; + if (!clean || seen.has(clean) || matchesAny(clean, check.ignore)) continue; + seen.add(clean); + const base = clean.startsWith('/') ? path.join(webRoot, clean) : path.resolve(path.join(ctx.root, path.dirname(f)), clean); + const candidates = [base, `${base}.html`, path.join(base, 'index.html')]; + if (!candidates.some((c) => fs.existsSync(c) && fs.statSync(c).isFile())) findings.push(`${f}:${lineOf(text, m.index)} links to ${target}, which does not exist`); + } + } + return { ok: findings.length === 0, findings, checked: files.length }; + }, + + 'form-method'(ctx, check) { + const files = selectFiles(ctx, check); + const findings = []; + for (const f of files) { + const text = withoutComments(read(ctx, f)); + const re = /]*)>([\s\S]*?)<\/form>/gi; + let m; + while ((m = re.exec(text))) { + const sensitive = /]*\stype\s*=\s*["']?(?:file|password)\b/i.test(m[2]); + const post = /\smethod\s*=\s*["']?post\b/i.test(m[1]); + if (sensitive && !post) findings.push(`${f}:${lineOf(text, m.index)} form with a file or password input does not use method="post"`); + } + } + return { ok: findings.length === 0, findings, checked: files.length }; + }, + + 'file-exists'(ctx, check) { + const want = check.anyOf || [check.path]; + const ok = want.some((p) => fs.existsSync(path.join(ctx.root, p))); + return { ok, findings: ok ? [] : [`none of ${want.join(', ')} exists`], checked: 1 }; + }, + + command(ctx, check) { + if (check.requires) { + const probe = spawnSync('command', ['-v', check.requires], { shell: true, encoding: 'utf8' }); + if (probe.status !== 0) return { notRun: `${check.requires} is not installed` }; + } + const res = spawnSync(check.run, { shell: true, cwd: ctx.root, encoding: 'utf8', timeout: (check.timeoutSeconds || 600) * 1000, env: process.env }); + if (res.error && res.error.code === 'ETIMEDOUT') return { ok: false, findings: [`timed out: ${check.run}`], checked: 1 }; + const tail = `${res.stdout || ''}${res.stderr || ''}`.trim().split('\n').slice(-15); + return { ok: res.status === 0, findings: res.status === 0 ? [] : [`\`${check.run}\` exited ${res.status}`, ...tail], checked: 1 }; + }, +}; + +// ---------- running ---------- + +export function waiverFor(id, waivers, today) { + const w = waivers.find((x) => x.id === id); + if (!w) return null; + const complete = w.reason && w.approvedBy && /^\d{4}-\d{2}-\d{2}$/.test(w.expires || ''); + if (!complete) return { ...w, state: 'invalid' }; + return { ...w, state: w.expires < today ? 'expired' : 'active' }; +} + +export function runChecks(root, stage = 'stop') { + const cfg = loadConstraints(root); + const ctx = { root, files: walk(root) }; + const today = new Date().toISOString().slice(0, 10); + const results = []; + + for (const c of cfg.constraints) { + const base = { id: c.id, title: c.title, theme: c.theme, source: c.source, owner: c.owner, severity: c.severity, layer: c.layer, fix: c.fix }; + // The ci stage runs everything. Earlier stages run only what is tagged for them. + if (stage !== 'ci' && !c.when.includes(stage)) { results.push({ ...base, status: 'not-run', detail: `runs at: ${c.when.join(', ')}` }); continue; } + if (c.onlyIf?.exists && !fs.existsSync(path.join(root, c.onlyIf.exists))) { results.push({ ...base, status: 'not-applicable', detail: `no ${c.onlyIf.exists}` }); continue; } + + const r = CHECKS[c.check.type](ctx, c.check); + if (r.notRun) { results.push({ ...base, status: 'not-run', detail: r.notRun, blocking: stage === 'ci' && c.severity === 'must' }); continue; } + if (r.ok) { results.push({ ...base, status: 'pass', checked: r.checked }); continue; } + + const w = waiverFor(c.id, cfg.waivers, today); + if (w?.state === 'active') results.push({ ...base, status: 'waived', findings: r.findings, waiver: w }); + else results.push({ ...base, status: 'fail', findings: r.findings, waiver: w || undefined, blocking: c.severity === 'must' }); + } + + const blocking = results.filter((r) => r.blocking); + const count = (s) => results.filter((r) => r.status === s).length; + return { + service: cfg.service, + stage, + generated: new Date().toISOString(), + passed: blocking.length === 0, + summary: { pass: count('pass'), fail: count('fail'), waived: count('waived'), notRun: count('not-run'), notApplicable: count('not-applicable'), blocking: blocking.length }, + results, + }; +} + +// ---------- output ---------- + +const MARK = { pass: 'PASS', fail: 'FAIL', waived: 'WAIVED', 'not-run': 'NOT RUN', 'not-applicable': 'N/A' }; + +export function formatText(report, { onlyProblems = false } = {}) { + const lines = [`xstack-check: ${report.service} (stage: ${report.stage})`, '']; + for (const r of report.results) { + if (onlyProblems && !r.blocking) continue; + lines.push(`${MARK[r.status].padEnd(8)} ${r.id.padEnd(13)} ${r.severity.padEnd(6)} ${r.title}${r.detail ? ` (${r.detail})` : ''}`); + if (r.status === 'fail' || r.status === 'waived') { + for (const f of (r.findings || []).slice(0, 8)) lines.push(` ${f}`); + if ((r.findings || []).length > 8) lines.push(` ...and ${r.findings.length - 8} more`); + if (r.status === 'fail' && r.fix) lines.push(` Fix: ${r.fix}`); + if (r.waiver?.state === 'active') lines.push(` Waived until ${r.waiver.expires} by ${r.waiver.approvedBy}: ${r.waiver.reason}`); + if (r.waiver?.state === 'expired') lines.push(` The waiver expired on ${r.waiver.expires}.`); + if (r.waiver?.state === 'invalid') lines.push(' The waiver is missing a reason, approvedBy or an expires date (YYYY-MM-DD).'); + } + } + const s = report.summary; + lines.push('', `${s.pass} pass, ${s.fail} fail, ${s.waived} waived, ${s.notRun} not run, ${s.notApplicable} not applicable.`); + lines.push(report.passed ? 'All "must" constraints that ran at this stage hold.' : `${s.blocking} "must" constraint(s) do not hold.`); + return lines.join('\n'); +} + +export function formatMarkdown(report) { + const themes = [...new Set(report.results.map((r) => r.theme))]; + const out = [`## Constraint evidence`, '', `Generated by \`xstack-check\` at stage \`${report.stage}\` on ${report.generated.slice(0, 10)}. Do not edit by hand – run the check again.`, '']; + for (const theme of themes) { + out.push(`### ${theme}`, '', '| Constraint | Result | Severity | Owner | Evidence |', '|---|---|---|---|---|'); + for (const r of report.results.filter((x) => x.theme === theme)) { + let ev = r.detail || ''; + if (r.status === 'pass') ev = `${r.checked} file(s) or command(s) checked`; + if (r.status === 'fail') ev = `${r.findings.length} finding(s), first: ${String(r.findings[0]).replace(/\|/g, '\\|')}`; + if (r.status === 'waived') ev = `${r.findings.length} finding(s). Waived until ${r.waiver.expires} by ${r.waiver.approvedBy}: ${r.waiver.reason}`; + out.push(`| \`${r.id}\` ${r.title} | ${MARK[r.status]} | ${r.severity} | ${r.owner} | ${ev} |`); + } + out.push(''); + } + const s = report.summary; + out.push(`**Total:** ${s.pass} pass, ${s.fail} fail, ${s.waived} waived, ${s.notRun} not run, ${s.notApplicable} not applicable.`, ''); + out.push('A theme can be rated **Met** only if every one of its constraints is PASS at the `ci` stage. FAIL, WAIVED and NOT RUN are at best **Partly met**.'); + return out.join('\n'); +} + +// ---------- vendoring ---------- + +function vendor(root) { + const project = readJson(path.join(root, CONSTRAINTS_FILE)); + const dest = path.join(root, '.xstack', 'vendor'); + fs.mkdirSync(dest, { recursive: true }); + const copied = []; + const copy = (from, name) => { fs.copyFileSync(from, path.join(dest, name)); copied.push(name); }; + const self = fileURLToPath(import.meta.url); + if (path.resolve(self) !== path.resolve(dest, 'xstack-check.mjs')) copy(self, 'xstack-check.mjs'); + for (const name of project.extends || ['xstack:baseline']) { + if (name === 'xstack:baseline') copy(resolveLayer(name, path.join(root, '.nonexistent')), 'baseline.json'); + else if (name.startsWith('profile:')) copy(resolveLayer(name, path.join(root, '.nonexistent')), `profile-${name.slice(8)}.json`); + } + return copied; +} + +// ---------- command line ---------- + +function main(argv) { + const args = { root: process.cwd(), stage: 'stop', format: 'text', report: true }; + for (let i = 0; i < argv.length; i++) { + const a = argv[i]; + if (a === '--root') args.root = path.resolve(argv[++i]); + else if (a === '--stage') args.stage = argv[++i]; + else if (a === '--format') args.format = argv[++i]; + else if (a === '--no-report') args.report = false; + else if (a === '--vendor') args.vendor = true; + else if (a === '--help' || a === '-h') { console.log('Usage: xstack-check [--root DIR] [--stage write|stop|ci] [--format text|json|md] [--no-report] | --vendor [--root DIR]'); return 0; } + else { console.error(`Unknown option: ${a}`); return 2; } + } + if (!STAGES.includes(args.stage)) { console.error(`--stage must be one of ${STAGES.join(', ')}`); return 2; } + + try { + if (args.vendor) { + console.log(`Copied into ${path.join(args.root, '.xstack', 'vendor')}: ${vendor(args.root).join(', ')}`); + return 0; + } + const report = runChecks(args.root, args.stage); + if (args.report) fs.writeFileSync(path.join(args.root, REPORT_FILE), `${JSON.stringify(report, null, 2)}\n`); + console.log(args.format === 'json' ? JSON.stringify(report, null, 2) : args.format === 'md' ? formatMarkdown(report) : formatText(report)); + return report.passed ? 0 : 1; + } catch (e) { + console.error(`xstack-check: ${e.message}`); + return 2; + } +} + +if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) process.exit(main(process.argv.slice(2))); diff --git a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md index b72dec4..7f09ee2 100644 --- a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md +++ b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md @@ -1,6 +1,6 @@ # Production-readiness report – Renew medical licence (front-end) -**Generated:** 2026-05-16 +**Generated:** 2026-05-16. Constraint evidence regenerated 2026-11-19 **Skill:** `xstack:build-for-production` via `/xstack:productionise` **Source iteration:** `examples/build-renew-medical-licence/prototype-1-phone-first/iteration-3/index.html` **Target phase gate:** Alpha → Beta @@ -9,19 +9,33 @@ ## Headline -The front-end is **substantially ready** for private beta. Static checks pass; security headers pass against a live local server; the test suite is in place. Full Playwright and k6 runs require a CI environment with browser binaries and the k6 binary installed – these are not in this generation environment but the test code is ready and runnable. +Every "must" constraint that can be checked without a server now holds. The front-end is **not yet ready** for private beta, because five of the six constraints that need CI have not passed. The sixth, `SVC-SEC-001` (security headers), passes against the local server. -**Recommended action:** wire the test suite into CI (GitHub Actions or GitLab CI), run the full Playwright matrix and k6 peak test in a staging environment, then proceed to the formal Standards self-assessment with the delivery manager. +Two constraints failed when the checks were first run, and both are fixed: + +- `SEC-004` – the CPD upload in `public/cpd.html` now sends its file by POST, with an upload button so it works without JavaScript. The local server accepts the POST, discards the file and redirects. +- `WFT-001` – the ten missing pages now exist: help, contact, feedback, privacy, accessibility, and five pages for correcting details. The privacy page says the full notice is still to come. + +An earlier version of this report rated a static audit as a pass. That audit was written in the same run as the code it checked, and it recorded 50 dead links as information. The checks now ship with xstack (`xstack-check`), and the results below come from its output. + +Still open: + +- **Inline styles** – every page has `style="..."` attributes, and the Content-Security-Policy (`style-src 'self'`) tells browsers to ignore them. Move them to the stylesheet. +- **The new pages are not in the test suites** – add them to `tests/accessibility/a11y.spec.ts`, also a protected path. +- **No lockfile, and no CI run** of Playwright, axe, `npm audit`, gitleaks or k6. + +**Recommended action:** wire `npm run check:ci` into CI and make it pass against staging before the formal Standards self-assessment. ## What's in this build ``` -public/ ← 9 HTML pages + shared CSS + minimal app.js +public/ ← 19 HTML pages + shared CSS + minimal app.js tests/e2e/ ← 3 Playwright specs covering happy path, abroad context, error states tests/accessibility/ ← axe-core suite across every page in every state tests/security/ ← Playwright header tests + a bash script for CI without a browser tests/load/ ← k6 peak (Oct–Dec profile) and 8-hour soak tests -scripts/ ← serve, run-all, static audit +scripts/ ← serve, run-all +.xstack/ ← constraints.json and the vendored xstack-check runner playwright.config.ts ← 5-project matrix (Chromium, Firefox, WebKit, mobile Chrome, mobile Safari) package.json ← npm scripts for everything ``` @@ -55,7 +69,7 @@ package.json ← npm scripts for everything - Stylesheet linked from `assets/govbb.css`; not inlined; placeholder for the published `@govtech-bb/styles` CDN - Playwright + axe-core + k6 are mainstream open-source tools, well-supported, easy to find skills for in the Caribbean tech market - All `govbb-` design-system classes used; no Tailwind, no bespoke colours -- Static audit confirmed CSS not inlined in any of the 9 pages +- `TECH-001` confirms CSS is not inlined in any of the 19 pages **Outstanding:** - Publish the design system to a CDN MIST can endorse, then swap the local CSS link for the CDN @@ -104,18 +118,62 @@ package.json ← npm scripts for everything ## Test results from this run -### Static audit – PASS +### Constraint evidence + +Generated by `xstack-check` at stage `stop` on 2026-11-19. Do not edit by hand – run the check again. + +#### Trust, security and privacy + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `SEC-001` No secrets in source | PASS | must | cyber-engineer | 40 file(s) or command(s) checked | +| `SEC-002` No inline event handlers | PASS | must | developer | 19 file(s) or command(s) checked | +| `SEC-003` No inline scripts | PASS | must | developer | 19 file(s) or command(s) checked | +| `SEC-004` Forms that send files or passwords use POST | PASS | must | developer | 19 file(s) or command(s) checked | +| `SEC-005` No secrets leaked in git history or working tree (gitleaks) | NOT RUN | must | cyber-engineer | runs at: ci | +| `SEC-006` No known high or critical vulnerabilities in dependencies | NOT RUN | must | cyber-engineer | runs at: ci | +| `OPEN-001` No prototype chrome in production | PASS | must | developer | 19 file(s) or command(s) checked | +| `SVC-SEC-001` The server sends the six security headers, with a CSP that forbids inline script | NOT RUN | must | cyber-engineer | runs at: ci | + +#### Sustainable and reliable + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `SEC-007` Dependencies are pinned by a lockfile | NOT RUN | must | developer | runs at: ci | + +#### Inclusion + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `A11Y-001` Every page declares its language, has a title and a main landmark | PASS | must | content-designer | 19 file(s) or command(s) checked | +| `A11Y-002` Every image has an alt attribute | PASS | must | content-designer | 19 file(s) or command(s) checked | +| `SVC-A11Y-001` Every page in every state passes axe at WCAG 2.1 AA | NOT RUN | must | content-designer | runs at: ci | + +#### Works first time + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `WFT-001` Every internal link and form action goes somewhere | PASS | must | developer | 19 file(s) or command(s) checked | +| `SVC-WFT-001` A doctor can renew end to end, including from abroad and through every error state | NOT RUN | must | developer | runs at: ci | + +#### Right technology + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `TECH-001` Styles are linked, not inlined | PASS | must | developer | 19 file(s) or command(s) checked | +| `BB-DS-001` Every page uses the GovBB design system and its skip link | PASS | must | content-designer | 19 file(s) or command(s) checked | + +#### Plain language + +| Constraint | Result | Severity | Owner | Evidence | +|---|---|---|---|---| +| `BB-STYLE-001` No em dashes in citizen-facing pages | PASS | must | content-designer | 19 file(s) or command(s) checked | + +**Total:** 11 pass, 0 fail, 0 waived, 6 not run, 0 not applicable. + +A theme can be rated **Met** only if every one of its constraints is PASS at the `ci` stage. FAIL, WAIVED and NOT RUN are at best **Partly met**. -| Check | Result | -|---|---| -| 9 HTML pages produced | ✅ PASS | -| HTML boilerplate (DOCTYPE, lang, title, description, stylesheet, main, skip link, landmarks) on every page | ✅ PASS – all 9 pages | -| CSS linked not inlined | ✅ PASS – all 9 pages | -| No xstack chrome in production (no banner, no assumptions panel, no fake-data spans, no Show-assumptions button, no verify-tag) | ✅ PASS – 5 of 5 forbidden terms absent | -| govbb- design-system class prefix used consistently | ✅ PASS | -| No m-dashes (house-style rule) | ✅ PASS – 0 found across 9 pages | -| Stylesheet present | ✅ PASS – `assets/govbb.css` (13KB) | -| Internal links and form actions resolve | ⚠️ 50 references to ancillary pages (help, privacy, accessibility, contact, feedback, address-override, etc.) – flagged as INFO because these are beta build-out items, not regressions | +The six constraints marked NOT RUN need a server, browsers or scanners. `npm run check:ci` runs them. ### Security headers – PASS (against live local server) @@ -172,16 +230,17 @@ The Standards self-assessment (`/xstack:assess for the beta gate`) is the formal ## Recommendation -**Proceed with conditions:** +**Do not proceed until condition 1 is met:** -1. **Wire the test suite into CI** before private beta opens to citizens. Required. -2. **Run the full Playwright matrix against staging** (5 device profiles). Required for Standards 3 and 5. -3. **Run the k6 peak load test against staging** (twice expected Oct–Dec volume). Required for Standards 5 and 13. -4. **Refresh the threat model** to cover the production form actions and the address-override flow. Required for Standard 11. -5. **Pen test plan signed off** before public beta. Cyber engineer owns; external supplier executes. -6. **Council backstage interface** scoped as a parallel `/xstack:build` track. Not blocking for private beta if Sandra and one or two officers can review applications manually; blocking for public beta. +1. **Make every "must" constraint pass at the `ci` stage** (`npm run check:ci`), or have the service owner record a dated waiver. Required. +2. **Wire the test suite into CI** before private beta opens to citizens. Required. +3. **Run the full Playwright matrix against staging** (5 device profiles). Required for Standards 3 and 5. +4. **Run the k6 peak load test against staging** (twice expected Oct–Dec volume). Required for Standards 5 and 13. +5. **Refresh the threat model** to cover the production form actions and the address-override flow. Required for Standard 11. +6. **Pen test plan signed off** before public beta. Cyber engineer owns; external supplier executes. +7. **Council backstage interface** scoped as a parallel `/xstack:build` track. Not blocking for private beta if Sandra and one or two officers can review applications manually; blocking for public beta. -If conditions 1–4 are met, the team is ready for private beta on the front end. Conditions 5–6 must be met before public beta. +If conditions 1–5 are met, the team is ready for private beta on the front end. Conditions 6–7 must be met before public beta. --- diff --git a/examples/production-renew-medical-licence/README.md b/examples/production-renew-medical-licence/README.md index bb16df3..a9fffd8 100644 --- a/examples/production-renew-medical-licence/README.md +++ b/examples/production-renew-medical-licence/README.md @@ -41,7 +41,10 @@ production-renew-medical-licence/ ├── scripts/ │ ├── serve.sh ← local server with the security headers set │ ├── run-all.sh ← orchestrator -│ └── audit.sh ← static checks (no browser, no k6) +│ └── run-all.sh ← orchestrator +├── .xstack/ +│ ├── constraints.json ← the rules this service must meet (protected: a person approves changes) +│ └── vendor/ ← xstack-check and its baseline and Barbados layers, copied from xstack ├── playwright.config.ts └── package.json ``` @@ -58,9 +61,10 @@ brew install k6 # macOS sudo apt-get install k6 # Ubuntu / Debian # or use the Docker image: docker pull grafana/k6 -# Serve and audit +# Serve and check npm run serve # http://localhost:8080, with the security headers set -npm run audit # static checks, no browser, no network +npm run check # constraint checks, no browser, no network +npm run check:ci # every constraint, including the ones that need a server, browsers and scanners # Run the test categories npm run test:e2e @@ -77,14 +81,14 @@ npm run test:all | Alpha prototype | Production build | |---|---| -| `prototype-1-phone-first/iteration-3/index.html` – one file with all 9 pages | 9 separate HTML files, one per URL | +| `prototype-1-phone-first/iteration-3/index.html` – one file with all 9 pages | 19 separate HTML files, one per URL: the 9 journey pages plus help, contact, feedback, privacy, accessibility and five pages for correcting details | | Inline `') }, + 'OPEN-001': { 'public/a.html': PAGE('') }, + }; + for (const [id, files] of Object.entries(cases)) { + const report = runChecks(service(files), 'stop'); + assert.equal(status(report, id), 'fail', id); + assert.equal(report.passed, false, id); + } +}); + +test('markup inside an HTML comment is neither credited nor blamed', () => { + const body = '\n
'; + const report = runChecks(service({ 'public/a.html': PAGE(body) }), 'stop'); + assert.equal(status(report, 'SEC-004'), 'fail'); + assert.equal(status(report, 'WFT-001'), 'pass'); +}); + +test('backend routes are not treated as dead links', () => { + const report = runChecks(service({ 'public/a.html': PAGE('
') }), 'stop'); + assert.equal(status(report, 'WFT-001'), 'pass'); +}); + +test('waivers: active waives, expired and incomplete do not', () => { + const files = { 'public/a.html': PAGE('Gone') }; + const w = (over) => ({ waivers: [{ id: 'WFT-001', reason: 'r', approvedBy: 'A. Person', expires: '2999-01-01', ...over }] }); + assert.equal(status(runChecks(service(files, w({})), 'stop'), 'WFT-001'), 'waived'); + assert.equal(runChecks(service(files, w({})), 'stop').passed, true); + assert.equal(status(runChecks(service(files, w({ expires: '2020-01-01' })), 'stop'), 'WFT-001'), 'fail'); + assert.equal(status(runChecks(service(files, w({ approvedBy: '' })), 'stop'), 'WFT-001'), 'fail'); +}); + +test('a service cannot redefine a baseline constraint', () => { + const dup = { id: 'SEC-001', title: 't', theme: 't', source: 's', owner: 'o', severity: 'should', when: ['ci'], check: { type: 'file-exists', path: 'x' } }; + assert.throws(() => runChecks(service({}, { constraints: [dup] }), 'stop'), /defined twice/); +}); + +test('at the ci stage a must constraint that cannot run blocks', () => { + const c = { id: 'SVC-001', title: 't', theme: 't', source: 's', owner: 'o', severity: 'must', when: ['ci'], check: { type: 'command', requires: 'no-such-tool-xyz', run: 'true' } }; + const root = service({}, { constraints: [c] }); + const ci = runChecks(root, 'ci').results.find((r) => r.id === 'SVC-001'); + assert.equal(ci.status, 'not-run'); + assert.equal(ci.blocking, true); + assert.ok(!runChecks(root, 'stop').results.find((r) => r.id === 'SVC-001').blocking); +}); + +test('write guard: denies a bad write, asks on a protected path, ignores the rest', () => { + const root = service({}, { protected: ['tests/security/**'] }); + const call = (file_path, content) => hook('guard-write.mjs', { cwd: root, tool_name: 'Write', tool_input: { file_path, content } }); + assert.equal(decision(call('public/a.html', '')), 'deny'); + assert.equal(decision(call('src/k.js', FAKE_KEY)), 'deny'); + assert.equal(decision(call('.xstack/constraints.json', '{}')), 'ask'); + assert.equal(decision(call('tests/security/headers.sh', 'exit 0')), 'ask'); + assert.equal(decision(call('public/a.html', '

Fine

')), 'none'); + const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'xstack-none-')); + assert.equal(decision(hook('guard-write.mjs', { cwd: outside, tool_name: 'Write', tool_input: { file_path: path.join(outside, 'k.js'), content: FAKE_KEY } })), 'none'); +}); + +test('stop gate: sends the agent back once, records the result, skips when unchanged', () => { + const bad = service({ 'public/a.html': PAGE('Gone') }); + const first = hook('stop-gate.mjs', { cwd: bad, stop_hook_active: false }); + assert.equal(first.status, 2); + assert.match(first.stderr, /WFT-001/); + assert.equal(hook('stop-gate.mjs', { cwd: bad, stop_hook_active: true }).status, 0); + assert.equal(JSON.parse(fs.readFileSync(path.join(bad, '.xstack', 'check-report.json'), 'utf8')).passed, false); + + const good = service(); + assert.equal(hook('stop-gate.mjs', { cwd: good }).status, 0); + const reportPath = path.join(good, '.xstack', 'check-report.json'); + const before = fs.readFileSync(reportPath, 'utf8'); + assert.equal(hook('stop-gate.mjs', { cwd: good }).status, 0); + assert.equal(fs.readFileSync(reportPath, 'utf8'), before); +}); diff --git a/skills/build-for-production/SKILL.md b/skills/build-for-production/SKILL.md index cc2b6d3..538c950 100644 --- a/skills/build-for-production/SKILL.md +++ b/skills/build-for-production/SKILL.md @@ -169,7 +169,7 @@ If thresholds fail, the beta gate is not met for **Works first time**. - **Write the backend.** Identity-platform integration, payment-platform calls, the back-office review queue, session management – these are the developer's responsibility, designed in ADRs and built in beta. - **Run the pen test.** That's the cyber engineer's job, with an external supplier, before public beta. -- **Configure CI/CD.** The team picks the platform (GitHub Actions, GitLab CI, etc.) and wires the runner script in. +- **Configure CI/CD.** The team picks the platform (GitHub Actions, GitLab CI, etc.) and wires the runner script in. For GitHub Actions, offer `constraints/ci/github-actions.yml` as the starting point – it runs every constraint at the `ci` stage. - **Deploy the service.** Hosting and deployment is part of beta operational readiness. - **Replace the threat model.** The security tests in this skill cover the front end. The threat model covers the whole system. From 46f949041efa5e0e9e51adb41e6fea93b4a314ab Mon Sep 17 00:00:00 2001 From: Abisola Fatokun Date: Thu, 19 Nov 2026 22:18:18 +0000 Subject: [PATCH 4/9] Fix the example's accessibility and end-to-end failures The suites had never been run. In desktop Chromium 11 of 28 failed. - Secondary text uses GovBB grey-70 (#595959). #777777 failed WCAG AA contrast on white and off-white - The summary list on the check page is valid dl markup: no region role on the dl, and the Change link sits in a dd - Two test locators were wrong: a substring match on "Back" also found "Give feedback", and a named-group locator for a details element never resolved All 28 now pass in Chromium, and axe is clean on all 19 pages. Co-Authored-By: Claude Fable 5.2 --- .../PRODUCTION-READINESS.md | 5 ++--- .../public/assets/govbb.css | 4 ++-- .../public/check.html | 16 ++++++++-------- .../tests/e2e/error-states.spec.ts | 5 +++-- .../tests/e2e/happy-path.spec.ts | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md index 2820143..9763451 100644 --- a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md +++ b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md @@ -9,7 +9,7 @@ ## Headline -Every "must" constraint that can be checked without a server now holds. The front-end is **not yet ready** for private beta, because the accessibility and end-to-end suites fail (`SVC-A11Y-001`, `SVC-WFT-001`). Security headers, the lockfile and `npm audit` pass. +Every "must" constraint that can be checked without a server now holds. The front-end is **not yet ready** for private beta, until every constraint passes in CI. Locally, security headers, the lockfile, `npm audit` and the Chromium test suites pass. Firefox, WebKit, the mobile profiles and gitleaks have only run in CI. Two constraints failed when the checks were first run, and both are fixed: @@ -22,8 +22,7 @@ Still open: - **Inline styles** – every page has `style="..."` attributes, and the Content-Security-Policy (`style-src 'self'`) tells browsers to ignore them. Move them to the stylesheet. - **The new pages are not in the test suites** – add them to `tests/accessibility/a11y.spec.ts`, also a protected path. -- **The accessibility suite fails.** First run, desktop Chromium, 2026-11-19: 9 of 12 axe tests fail on two rules. `color-contrast` fails on seven pages, and `dlitem` fails on the summary lists (`dt` and `dd` are not direct children of their `dl`). -- **Two end-to-end tests fail.** The confirmation page has a link the test reads as "Back", and the happy path times out opening "What counts as CPD?". +- **Accessibility and end-to-end suites pass in desktop Chromium** (28 of 28, 2026-11-19), and axe finds nothing on any of the 19 pages. Their first run failed 11 tests. The fixes: secondary text now uses GovBB grey-70 (`#595959`) because `#777777` failed contrast, the summary list on the check page is valid `dl` markup, and two test locators were wrong. - **Not yet run:** Firefox, WebKit and the two mobile profiles, gitleaks, and k6. `npm audit` finds no vulnerabilities, and the lockfile is now committed. **Recommended action:** wire `npm run check:ci` into CI and make it pass against staging before the formal Standards self-assessment. diff --git a/examples/production-renew-medical-licence/public/assets/govbb.css b/examples/production-renew-medical-licence/public/assets/govbb.css index d146cc5..b22bc21 100644 --- a/examples/production-renew-medical-licence/public/assets/govbb.css +++ b/examples/production-renew-medical-licence/public/assets/govbb.css @@ -20,7 +20,7 @@ --bb-charcoal: #2C2C2C; --bb-white: #FFFFFF; --bb-grey-light: #DDDDDD; - --bb-grey-mid: #777777; + --bb-grey-mid: #595959; /* GovBB grey-70 (text-secondary). #777777 fails WCAG AA contrast on white and off-white. */ --bb-error: #B71C1C; --bb-green: #00703C; --bb-success-bg: #E8F5E9; @@ -217,7 +217,7 @@ details.govbb-details .body li { font-size: 16px; margin-bottom: 6px; } .govbb-summary-list__row:last-child { border-bottom: 0; } .govbb-summary-list__key { width: 35%; font-weight: 700; padding-right: 12px; } .govbb-summary-list__value { width: 45%; padding-right: 12px; } -.govbb-summary-list__actions { width: 20%; text-align: right; } +.govbb-summary-list__actions { width: 20%; text-align: right; margin: 0; } .govbb-summary-list__actions a { color: var(--bb-navy); } .govbb-callout { background: var(--bb-white); border-left: 6px solid var(--bb-navy); padding: 16px 20px; margin-bottom: 24px; } diff --git a/examples/production-renew-medical-licence/public/check.html b/examples/production-renew-medical-licence/public/check.html index 1336d05..6354a11 100644 --- a/examples/production-renew-medical-licence/public/check.html +++ b/examples/production-renew-medical-licence/public/check.html @@ -33,41 +33,41 @@

Check your answers

Make sure everything's right before you submit your application.

-
+
Practising context
In Barbados, actively practising
- +
Change
Name
Dr. Sarah K. Williams
- +
Change
Registration category
Full registration
-
+
Trident ID
750814-9384
- +
Change
Where you practise
Public hospital
- +
Change
CPD records (2)
42 hours total – above the 40-hour minimum
- +
Change
Renewal fee
BBD 200.00
-
+
diff --git a/examples/production-renew-medical-licence/tests/e2e/error-states.spec.ts b/examples/production-renew-medical-licence/tests/e2e/error-states.spec.ts index 94c7ec3..45e7a50 100644 --- a/examples/production-renew-medical-licence/tests/e2e/error-states.spec.ts +++ b/examples/production-renew-medical-licence/tests/e2e/error-states.spec.ts @@ -61,11 +61,12 @@ test.describe('Error states are accessible and actionable', () => { test('Index page does not have a back link', async ({ page }) => { await page.goto('/'); - await expect(page.getByRole('link', { name: 'Back' })).toHaveCount(0); + await expect(page.getByRole('link', { name: 'Back', exact: true })).toHaveCount(0); }); test('Confirmation page has no Back link – submission is committed', async ({ page }) => { await page.goto('/confirmation.html'); - await expect(page.getByRole('link', { name: 'Back' })).toHaveCount(0); + // exact: the page has a "Give feedback" link, which a substring match on "Back" also finds. + await expect(page.getByRole('link', { name: 'Back', exact: true })).toHaveCount(0); }); }); diff --git a/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts b/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts index c91a8a1..e405fd6 100644 --- a/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts +++ b/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts @@ -49,9 +49,9 @@ test.describe('Bajan doctor renews their full-registration licence end to end', await expect(page.getByText(/Total so far: 42 hours/)).toBeVisible(); await expect(page.getByText(/above the 40-hour minimum/)).toBeVisible(); // 'What counts as CPD?' disclosure - await page.getByRole('group', { name: /What counts as CPD/i }).first().click().catch(async () => { - await page.getByText(/What counts as CPD\?/).click(); - }); + // Click the summary. A
has the group role but takes no name from + // its summary, so a named-group locator never resolves. + await page.getByText('What counts as CPD?').click(); await expect(page.getByText(/Overseas rotations/)).toBeVisible(); await page.getByRole('button', { name: 'Continue' }).click(); From caba92f9dc9cfec0dc2f9d88cdb2f23e7a0da46e Mon Sep 17 00:00:00 2001 From: Abisola Fatokun Date: Thu, 19 Nov 2026 22:22:31 +0000 Subject: [PATCH 5/9] Make the example's test server cope with parallel browsers Running all five browser profiles at once dropped most connections: the local server was single-threaded and IPv4 only. It is now threaded and listens on IPv4 and IPv6. The skip-link test uses Option+Tab in WebKit on macOS, where plain Tab does not move focus to links. 140 of 140 tests pass across the five profiles, and 16 of 17 constraints pass locally at the ci stage. gitleaks runs in CI. Co-Authored-By: Claude Fable 5.2 --- .../PRODUCTION-READINESS.md | 6 ++--- .../scripts/serve.sh | 25 +++++++++++++++++-- .../tests/e2e/happy-path.spec.ts | 7 ++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md index 9763451..c3ee783 100644 --- a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md +++ b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md @@ -9,7 +9,7 @@ ## Headline -Every "must" constraint that can be checked without a server now holds. The front-end is **not yet ready** for private beta, until every constraint passes in CI. Locally, security headers, the lockfile, `npm audit` and the Chromium test suites pass. Firefox, WebKit, the mobile profiles and gitleaks have only run in CI. +Every "must" constraint that can be checked without a server now holds. The front-end is **not yet ready** for private beta, until every constraint passes in CI. Locally, 16 of the 17 constraints pass at the `ci` stage. The last, the gitleaks secret scan, runs in CI. Two constraints failed when the checks were first run, and both are fixed: @@ -22,8 +22,8 @@ Still open: - **Inline styles** – every page has `style="..."` attributes, and the Content-Security-Policy (`style-src 'self'`) tells browsers to ignore them. Move them to the stylesheet. - **The new pages are not in the test suites** – add them to `tests/accessibility/a11y.spec.ts`, also a protected path. -- **Accessibility and end-to-end suites pass in desktop Chromium** (28 of 28, 2026-11-19), and axe finds nothing on any of the 19 pages. Their first run failed 11 tests. The fixes: secondary text now uses GovBB grey-70 (`#595959`) because `#777777` failed contrast, the summary list on the check page is valid `dl` markup, and two test locators were wrong. -- **Not yet run:** Firefox, WebKit and the two mobile profiles, gitleaks, and k6. `npm audit` finds no vulnerabilities, and the lockfile is now committed. +- **Accessibility, end-to-end and security suites pass in all five browser profiles** (140 of 140, macOS, 2026-11-19), and axe finds nothing on any of the 19 pages. Their first run failed 11 tests. The fixes: secondary text now uses GovBB grey-70 (`#595959`) because `#777777` failed contrast, the summary list on the check page is valid `dl` markup, and two test locators were wrong. +- **Not yet run locally:** gitleaks, which runs in CI, and k6. `npm audit` finds no vulnerabilities, and the lockfile is now committed. **Recommended action:** wire `npm run check:ci` into CI and make it pass against staging before the formal Standards self-assessment. diff --git a/examples/production-renew-medical-licence/scripts/serve.sh b/examples/production-renew-medical-licence/scripts/serve.sh index 90c0204..fd12d62 100755 --- a/examples/production-renew-medical-licence/scripts/serve.sh +++ b/examples/production-renew-medical-licence/scripts/serve.sh @@ -16,7 +16,7 @@ if command -v python3 >/dev/null 2>&1; then echo "Serving $DIR on http://localhost:$PORT (Python 3 + security headers)" cd "$DIR" exec python3 - "$PORT" <<'PY' -import sys, http.server, socketserver +import sys, http.server, socket PORT = int(sys.argv[1]) @@ -40,6 +40,9 @@ class SecureHandler(http.server.SimpleHTTPRequestHandler): self.send_header("Server", "alpha.gov.bb") super().end_headers() + def log_message(self, fmt, *args): + pass # keep test output readable + def do_POST(self): # Stand-in for the back end: read and discard the body, then # Post/Redirect/Get to the form's action. Nothing is stored. @@ -54,7 +57,25 @@ class SecureHandler(http.server.SimpleHTTPRequestHandler): self.send_header("Content-Length", "0") self.end_headers() -with socketserver.TCPServer(("", PORT), SecureHandler) as httpd: +class Server(http.server.ThreadingHTTPServer): + # Threaded, with a deep accept queue: the test suite opens many + # connections at once across five browser profiles. + request_queue_size = 256 + daemon_threads = True + allow_reuse_address = True + +class DualStackServer(Server): + # Listen on IPv4 and IPv6, so "localhost" works whichever it resolves to. + address_family = socket.AF_INET6 + def server_bind(self): + self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) + return super().server_bind() + +try: + httpd = DualStackServer(("::", PORT), SecureHandler) +except OSError: + httpd = Server(("", PORT), SecureHandler) +with httpd: httpd.serve_forever() PY else diff --git a/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts b/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts index e405fd6..75b19c8 100644 --- a/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts +++ b/examples/production-renew-medical-licence/tests/e2e/happy-path.spec.ts @@ -98,9 +98,12 @@ test.describe('Bajan doctor renews their full-registration licence end to end', } }); - test('Skip link is the first focusable element', async ({ page }) => { + test('Skip link is the first focusable element', async ({ page, browserName }) => { await page.goto('/'); - await page.keyboard.press('Tab'); + // Safari on macOS only tabs to links with Option+Tab, unless the person has + // turned on "Press Tab to highlight each item". WebKit on Linux uses plain Tab. + const tab = browserName === 'webkit' && process.platform === 'darwin' ? 'Alt+Tab' : 'Tab'; + await page.keyboard.press(tab); const skip = page.getByRole('link', { name: /Skip to main content/i }); await expect(skip).toBeFocused(); }); From 733e405ebd09cce4436e65cc6e0e5cc7f54e9bb2 Mon Sep 17 00:00:00 2001 From: Abisola Fatokun Date: Thu, 19 Nov 2026 22:30:43 +0000 Subject: [PATCH 6/9] Forbid inline style attributes, and remove them from the example A Content-Security-Policy without 'unsafe-inline' in style-src makes browsers ignore style attributes, so a page does not look the way it was written. The baseline did not catch this. - SEC-008 in the baseline forbids style attributes in web pages, at the write, stop and ci stages - The medical-licence example had 100 of them across 19 pages. Each is now a utility class in the linked stylesheet, so the styles apply 140 of 140 tests pass across five browser profiles, axe is clean on all 19 pages, and no page logs a policy violation. Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 2 +- constraints/baseline.json | 179 ++++++++++++++---- .../.xstack/vendor/baseline.json | 179 ++++++++++++++---- .../PRODUCTION-READINESS.md | 1 - .../public/accessibility.html | 8 +- .../public/address-override.html | 8 +- .../public/assets/govbb.css | 14 ++ .../public/category-update.html | 8 +- .../public/check.html | 8 +- .../public/confirm-details.html | 10 +- .../public/confirmation.html | 14 +- .../public/contact-update.html | 8 +- .../public/contact.html | 8 +- .../public/context.html | 22 +-- .../public/cpd.html | 14 +- .../public/feedback.html | 8 +- .../public/help.html | 8 +- .../public/id-lookup.html | 10 +- .../public/identity-help.html | 8 +- .../public/index.html | 14 +- .../public/parish-update.html | 8 +- .../public/payment.html | 12 +- .../public/practice.html | 16 +- .../public/privacy.html | 8 +- scripts/xstack-check.test.mjs | 1 + 25 files changed, 410 insertions(+), 166 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de39e7..9c2e12e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ All notable changes to xstack will be recorded here. Format inspired by [Keep a ### Added - **Constraints** – rules a production service must meet, written so a machine checks them, and enforced by xstack instead of left to instructions. See `constraints/README.md` - - A service opts in with `.xstack/constraints.json`. It extends the baseline in `constraints/baseline.json` (secrets, inline script, POST for uploads, page landmarks, alt text, dead links, inline styles, prototype chrome, dependency checks) and a profile layer where there is one. Barbados has the first, in `profiles/barbados/constraints.json` + - A service opts in with `.xstack/constraints.json`. It extends the baseline in `constraints/baseline.json` (secrets, inline script and inline styles, POST for uploads, page landmarks, alt text, dead links, inline styles, prototype chrome, dependency checks) and a profile layer where there is one. Barbados has the first, in `profiles/barbados/constraints.json` - `scripts/xstack-check.mjs` runs them at three stages – `write`, `stop` and `ci` – and reports PASS, FAIL, WAIVED or NOT RUN. It has no dependencies, and `--vendor` copies it into a service for CI - Plugin hooks in `hooks/`: a write that breaks a constraint is refused, a change to the constraints file or other protected path needs a person's approval, and an agent cannot finish while a "must" constraint fails - CI: `.github/workflows/constraints.yml` tests the runner and hooks and runs the `ci` stage on the example. `constraints/ci/github-actions.yml` is the same job for a service to copy diff --git a/constraints/baseline.json b/constraints/baseline.json index 943a801..7f81883 100644 --- a/constraints/baseline.json +++ b/constraints/baseline.json @@ -14,11 +14,20 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["**/*"], - "exclude": ["**/*.lock", "**/package-lock.json"], + "files": [ + "**/*" + ], + "exclude": [ + "**/*.lock", + "**/package-lock.json" + ], "patterns": [ "AKIA[0-9A-Z]{16}", "-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY", @@ -38,11 +47,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["<[^>]+\\son[a-z]+\\s*=\\s*[\"']"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "<[^>]+\\son[a-z]+\\s*=\\s*[\"']" + ], "flags": "i" }, "fix": "Move the behaviour to a linked script and use addEventListener, so a strict Content-Security-Policy can stay on." @@ -54,15 +71,48 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]*\\ssrc=)[^>]*>", "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]*\\ssrc=)[^>]*>", + "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:" + ], "flags": "i" }, "fix": "Link the script with src. A strict Content-Security-Policy blocks inline script." }, + { + "id": "SEC-008", + "title": "No inline style attributes", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": [ + "write", + "stop", + "ci" + ], + "check": { + "type": "forbid-pattern", + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "<[^>]+\\sstyle\\s*=\\s*[\"']" + ], + "flags": "i" + }, + "fix": "Use a class from the linked stylesheet. A strict Content-Security-Policy (style-src without 'unsafe-inline') makes browsers ignore style attributes, so the page will not look the way you wrote it." + }, { "id": "SEC-004", "title": "Forms that send files or passwords use POST", @@ -70,10 +120,15 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "form-method", - "files": ["{{web}}/**/*.html"] + "files": [ + "{{web}}/**/*.html" + ] }, "fix": "Set method=\"post\" on the form (and enctype=\"multipart/form-data\" for uploads). GET puts the data in the URL, in logs and in history." }, @@ -84,7 +139,9 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["ci"], + "when": [ + "ci" + ], "check": { "type": "command", "requires": "gitleaks", @@ -99,8 +156,12 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["ci"], - "onlyIf": { "exists": "package.json" }, + "when": [ + "ci" + ], + "onlyIf": { + "exists": "package.json" + }, "check": { "type": "command", "requires": "npm", @@ -115,11 +176,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["ci"], - "onlyIf": { "exists": "package.json" }, + "when": [ + "ci" + ], + "onlyIf": { + "exists": "package.json" + }, "check": { "type": "file-exists", - "anyOf": ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] + "anyOf": [ + "package-lock.json", + "pnpm-lock.yaml", + "yarn.lock" + ] }, "fix": "Run the package manager's install and commit the lockfile." }, @@ -130,11 +199,21 @@ "source": "xstack baseline", "owner": "content-designer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "require-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["", "]*\\slang=[\"'][a-zA-Z-]+[\"']", "[^<]+", "]"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "", + "]*\\slang=[\"'][a-zA-Z-]+[\"']", + "[^<]+", + "]" + ], "flags": "i" }, "fix": "Add the missing element. Screen readers need all four." @@ -146,11 +225,19 @@ "source": "xstack baseline", "owner": "content-designer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]*\\salt=)[^>]*>"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]*\\salt=)[^>]*>" + ], "flags": "i" }, "fix": "Add alt text, or alt=\"\" if the image is decoration." @@ -162,12 +249,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "links-resolve", - "files": ["{{web}}/**/*.html"], + "files": [ + "{{web}}/**/*.html" + ], "root": "{{web}}", - "ignore": ["{{backendRoutes}}"] + "ignore": [ + "{{backendRoutes}}" + ] }, "fix": "Build the page, or remove the link until it exists. A dead link in a government service is a dead end for a citizen." }, @@ -178,11 +272,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]" + ], "flags": "i" }, "fix": "Move the rules to the linked stylesheet. Use the design system's own classes first." @@ -194,11 +296,24 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["xstack-banner", "xstack-assumptions", "Show assumptions", "verify-tag", "fake-data", "\\[VERIFY WITH "] + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "xstack-banner", + "xstack-assumptions", + "Show assumptions", + "verify-tag", + "fake-data", + "\\[VERIFY WITH " + ] }, "fix": "Strip the assumptions panel, banner and mock-data markers. Citizens must never see invented data presented as real." } diff --git a/examples/production-renew-medical-licence/.xstack/vendor/baseline.json b/examples/production-renew-medical-licence/.xstack/vendor/baseline.json index 943a801..7f81883 100644 --- a/examples/production-renew-medical-licence/.xstack/vendor/baseline.json +++ b/examples/production-renew-medical-licence/.xstack/vendor/baseline.json @@ -14,11 +14,20 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["**/*"], - "exclude": ["**/*.lock", "**/package-lock.json"], + "files": [ + "**/*" + ], + "exclude": [ + "**/*.lock", + "**/package-lock.json" + ], "patterns": [ "AKIA[0-9A-Z]{16}", "-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY", @@ -38,11 +47,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["<[^>]+\\son[a-z]+\\s*=\\s*[\"']"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "<[^>]+\\son[a-z]+\\s*=\\s*[\"']" + ], "flags": "i" }, "fix": "Move the behaviour to a linked script and use addEventListener, so a strict Content-Security-Policy can stay on." @@ -54,15 +71,48 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]*\\ssrc=)[^>]*>", "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]*\\ssrc=)[^>]*>", + "(?:href|action|src)\\s*=\\s*[\"']\\s*javascript:" + ], "flags": "i" }, "fix": "Link the script with src. A strict Content-Security-Policy blocks inline script." }, + { + "id": "SEC-008", + "title": "No inline style attributes", + "theme": "Trust, security and privacy", + "source": "xstack baseline", + "owner": "developer", + "severity": "must", + "when": [ + "write", + "stop", + "ci" + ], + "check": { + "type": "forbid-pattern", + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "<[^>]+\\sstyle\\s*=\\s*[\"']" + ], + "flags": "i" + }, + "fix": "Use a class from the linked stylesheet. A strict Content-Security-Policy (style-src without 'unsafe-inline') makes browsers ignore style attributes, so the page will not look the way you wrote it." + }, { "id": "SEC-004", "title": "Forms that send files or passwords use POST", @@ -70,10 +120,15 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "form-method", - "files": ["{{web}}/**/*.html"] + "files": [ + "{{web}}/**/*.html" + ] }, "fix": "Set method=\"post\" on the form (and enctype=\"multipart/form-data\" for uploads). GET puts the data in the URL, in logs and in history." }, @@ -84,7 +139,9 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["ci"], + "when": [ + "ci" + ], "check": { "type": "command", "requires": "gitleaks", @@ -99,8 +156,12 @@ "source": "xstack baseline", "owner": "cyber-engineer", "severity": "must", - "when": ["ci"], - "onlyIf": { "exists": "package.json" }, + "when": [ + "ci" + ], + "onlyIf": { + "exists": "package.json" + }, "check": { "type": "command", "requires": "npm", @@ -115,11 +176,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["ci"], - "onlyIf": { "exists": "package.json" }, + "when": [ + "ci" + ], + "onlyIf": { + "exists": "package.json" + }, "check": { "type": "file-exists", - "anyOf": ["package-lock.json", "pnpm-lock.yaml", "yarn.lock"] + "anyOf": [ + "package-lock.json", + "pnpm-lock.yaml", + "yarn.lock" + ] }, "fix": "Run the package manager's install and commit the lockfile." }, @@ -130,11 +199,21 @@ "source": "xstack baseline", "owner": "content-designer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "require-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["", "]*\\slang=[\"'][a-zA-Z-]+[\"']", "[^<]+", "]"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "", + "]*\\slang=[\"'][a-zA-Z-]+[\"']", + "[^<]+", + "]" + ], "flags": "i" }, "fix": "Add the missing element. Screen readers need all four." @@ -146,11 +225,19 @@ "source": "xstack baseline", "owner": "content-designer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]*\\salt=)[^>]*>"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]*\\salt=)[^>]*>" + ], "flags": "i" }, "fix": "Add alt text, or alt=\"\" if the image is decoration." @@ -162,12 +249,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["stop", "ci"], + "when": [ + "stop", + "ci" + ], "check": { "type": "links-resolve", - "files": ["{{web}}/**/*.html"], + "files": [ + "{{web}}/**/*.html" + ], "root": "{{web}}", - "ignore": ["{{backendRoutes}}"] + "ignore": [ + "{{backendRoutes}}" + ] }, "fix": "Build the page, or remove the link until it exists. A dead link in a government service is a dead end for a citizen." }, @@ -178,11 +272,19 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["]"], + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "]" + ], "flags": "i" }, "fix": "Move the rules to the linked stylesheet. Use the design system's own classes first." @@ -194,11 +296,24 @@ "source": "xstack baseline", "owner": "developer", "severity": "must", - "when": ["write", "stop", "ci"], + "when": [ + "write", + "stop", + "ci" + ], "check": { "type": "forbid-pattern", - "files": ["{{web}}/**/*.html"], - "patterns": ["xstack-banner", "xstack-assumptions", "Show assumptions", "verify-tag", "fake-data", "\\[VERIFY WITH "] + "files": [ + "{{web}}/**/*.html" + ], + "patterns": [ + "xstack-banner", + "xstack-assumptions", + "Show assumptions", + "verify-tag", + "fake-data", + "\\[VERIFY WITH " + ] }, "fix": "Strip the assumptions panel, banner and mock-data markers. Citizens must never see invented data presented as real." } diff --git a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md index c3ee783..9f9654e 100644 --- a/examples/production-renew-medical-licence/PRODUCTION-READINESS.md +++ b/examples/production-renew-medical-licence/PRODUCTION-READINESS.md @@ -20,7 +20,6 @@ An earlier version of this report rated a static audit as a pass. That audit was Still open: -- **Inline styles** – every page has `style="..."` attributes, and the Content-Security-Policy (`style-src 'self'`) tells browsers to ignore them. Move them to the stylesheet. - **The new pages are not in the test suites** – add them to `tests/accessibility/a11y.spec.ts`, also a protected path. - **Accessibility, end-to-end and security suites pass in all five browser profiles** (140 of 140, macOS, 2026-11-19), and axe finds nothing on any of the 19 pages. Their first run failed 11 tests. The fixes: secondary text now uses GovBB grey-70 (`#595959`) because `#777777` failed contrast, the summary list on the check page is valid `dl` markup, and two test locators were wrong. - **Not yet run locally:** gitleaks, which runs in CI, and k6. `npm audit` finds no vulnerabilities, and the lockfile is now committed. diff --git a/examples/production-renew-medical-licence/public/accessibility.html b/examples/production-renew-medical-licence/public/accessibility.html index af35d34..58e7a3c 100644 --- a/examples/production-renew-medical-licence/public/accessibility.html +++ b/examples/production-renew-medical-licence/public/accessibility.html @@ -45,12 +45,12 @@

If you have a problem

diff --git a/examples/production-renew-medical-licence/public/address-override.html b/examples/production-renew-medical-licence/public/address-override.html index 00ed72d..02ce7c2 100644 --- a/examples/production-renew-medical-licence/public/address-override.html +++ b/examples/production-renew-medical-licence/public/address-override.html @@ -102,12 +102,12 @@

Where should we post things?

diff --git a/examples/production-renew-medical-licence/public/assets/govbb.css b/examples/production-renew-medical-licence/public/assets/govbb.css index b22bc21..d372bdb 100644 --- a/examples/production-renew-medical-licence/public/assets/govbb.css +++ b/examples/production-renew-medical-licence/public/assets/govbb.css @@ -297,3 +297,17 @@ details.govbb-details .body li { font-size: 16px; margin-bottom: 6px; } /* Fieldsets on the detail-correction pages */ .override-fieldset { border: 0; padding: 0; margin: 0 0 var(--bb-space-6, 24px); } .override-fieldset h1 { margin: 0; } + +/* Utilities. These replace inline style attributes, which the service's + Content-Security-Policy (style-src 'self') tells browsers to ignore. */ +.u-mt-8 { margin-top: 8px !important; } +.u-mt-24 { margin-top: 24px !important; } +.u-mb-0 { margin-bottom: 0 !important; } +.u-mb-8 { margin-bottom: 8px !important; } +.u-mb-12 { margin-bottom: 12px !important; } +.u-text-13 { font-size: 13px !important; } +.u-text-14 { font-size: 14px !important; } +.u-text-16 { font-size: 16px !important; } +.u-text-24 { font-size: 24px !important; } +.u-text-secondary { color: var(--bb-grey-mid) !important; } +.u-border-0 { border: 0 !important; } diff --git a/examples/production-renew-medical-licence/public/category-update.html b/examples/production-renew-medical-licence/public/category-update.html index 70723ad..dd5ce3c 100644 --- a/examples/production-renew-medical-licence/public/category-update.html +++ b/examples/production-renew-medical-licence/public/category-update.html @@ -47,12 +47,12 @@

Tell us what is wrong with your category

diff --git a/examples/production-renew-medical-licence/public/check.html b/examples/production-renew-medical-licence/public/check.html index 6354a11..6974130 100644 --- a/examples/production-renew-medical-licence/public/check.html +++ b/examples/production-renew-medical-licence/public/check.html @@ -107,12 +107,12 @@

What happens after you pay

diff --git a/examples/production-renew-medical-licence/public/confirm-details.html b/examples/production-renew-medical-licence/public/confirm-details.html index 08e141b..5df85f8 100644 --- a/examples/production-renew-medical-licence/public/confirm-details.html +++ b/examples/production-renew-medical-licence/public/confirm-details.html @@ -48,7 +48,7 @@

Dr. Sarah K. Williams

Where should we send your certificate? -

We'll email it to s.williams@example.bb. If you'd like to use a different email or have anything physical posted to a different address while you renew, let us know.

+

We'll email it to s.williams@example.bb. If you'd like to use a different email or have anything physical posted to a different address while you renew, let us know.

Use a different address
@@ -89,12 +89,12 @@

Something not right?

diff --git a/examples/production-renew-medical-licence/public/confirmation.html b/examples/production-renew-medical-licence/public/confirmation.html index ab18481..d9fb727 100644 --- a/examples/production-renew-medical-licence/public/confirmation.html +++ b/examples/production-renew-medical-licence/public/confirmation.html @@ -28,9 +28,9 @@
-

Application sent

+

Application sent

-

Your reference number is MED-2026-04857. The Council is reviewing your application.

+

Your reference number is MED-2026-04857. The Council is reviewing your application.

What happens next

@@ -60,7 +60,7 @@

What happens next

Keep a copy of this page -

A lot of doctors print this page or save it as a PDF in case the email goes missing.

+

A lot of doctors print this page or save it as a PDF in case the email goes missing.

@@ -77,12 +77,12 @@

Tell us what you thought

diff --git a/examples/production-renew-medical-licence/public/contact-update.html b/examples/production-renew-medical-licence/public/contact-update.html index 12263b2..ba24b65 100644 --- a/examples/production-renew-medical-licence/public/contact-update.html +++ b/examples/production-renew-medical-licence/public/contact-update.html @@ -51,12 +51,12 @@

What are your email and phone number?

diff --git a/examples/production-renew-medical-licence/public/contact.html b/examples/production-renew-medical-licence/public/contact.html index ab62301..6f3c33b 100644 --- a/examples/production-renew-medical-licence/public/contact.html +++ b/examples/production-renew-medical-licence/public/contact.html @@ -42,12 +42,12 @@

About this online service

diff --git a/examples/production-renew-medical-licence/public/context.html b/examples/production-renew-medical-licence/public/context.html index 4405b0d..8c5d884 100644 --- a/examples/production-renew-medical-licence/public/context.html +++ b/examples/production-renew-medical-licence/public/context.html @@ -31,39 +31,39 @@
-
+
Where will you be practising this year? Pick the one that's most true for you right now. We'll adjust the rest of the renewal to match.
- +
- +
- +
Standard renewal flow -

You'll go through the standard renewal: identity, practice details, CPD, payment, confirmation.

+

You'll go through the standard renewal: identity, practice details, CPD, payment, confirmation.

What's different if you're abroad -

We'll let you give us a different email or postal address while you're away. CPD from your overseas rotation counts – the next step explains what we accept.

+

We'll let you give us a different email or postal address while you're away. CPD from your overseas rotation counts – the next step explains what we accept.

You may need a different category -

The Medical Council has a restricted registration category for retired or occasional doctors. The CPD requirement and fee are different. Call the Council on 246-535-7400 before you continue if you're not sure. You can still complete the form below and we'll route it to the right reviewer.

+

The Medical Council has a restricted registration category for retired or occasional doctors. The CPD requirement and fee are different. Call the Council on 246-535-7400 before you continue if you're not sure. You can still complete the form below and we'll route it to the right reviewer.

@@ -80,12 +80,12 @@
diff --git a/examples/production-renew-medical-licence/public/cpd.html b/examples/production-renew-medical-licence/public/cpd.html index 0677c13..43e76cf 100644 --- a/examples/production-renew-medical-licence/public/cpd.html +++ b/examples/production-renew-medical-licence/public/cpd.html @@ -34,7 +34,7 @@

Add your CPD records

Specialists – check your College too -

If you hold a specialty qualification (MRCPCH, MRCP, MRCS, FAAP, FACS, FRCS, FRCOG and similar), your College usually requires more hours than the Council's minimum, and may require specialty-specific evidence. Filing 40 Council hours doesn't automatically meet your College's requirement.

+

If you hold a specialty qualification (MRCPCH, MRCP, MRCS, FAAP, FACS, FRCS, FRCOG and similar), your College usually requires more hours than the Council's minimum, and may require specialty-specific evidence. Filing 40 Council hours doesn't automatically meet your College's requirement.

@@ -49,7 +49,7 @@

Add your CPD records

  • Online accredited learning (BMJ Learning, NEJM Knowledge+, UpToDate-CME and similar)
  • Peer-reviewed publications (counted per Medical Council guidance)
  • -

    Not sure if something counts? Add it anyway and tell us what it was. We'll check.

    +

    Not sure if something counts? Add it anyway and tell us what it was. We'll check.

    @@ -78,7 +78,7 @@

    Add your CPD records

    -

    Got more to add? PDF, PNG, or JPG. Photos of paper records are fine.

    +

    Got more to add? PDF, PNG, or JPG. Photos of paper records are fine.

    @@ -101,12 +101,12 @@

    Add your CPD records

    diff --git a/examples/production-renew-medical-licence/public/feedback.html b/examples/production-renew-medical-licence/public/feedback.html index e5533ed..f2f9f99 100644 --- a/examples/production-renew-medical-licence/public/feedback.html +++ b/examples/production-renew-medical-licence/public/feedback.html @@ -51,12 +51,12 @@

    Tell us what you think

    diff --git a/examples/production-renew-medical-licence/public/help.html b/examples/production-renew-medical-licence/public/help.html index dd5602e..ed8af14 100644 --- a/examples/production-renew-medical-licence/public/help.html +++ b/examples/production-renew-medical-licence/public/help.html @@ -51,12 +51,12 @@

    If you are stuck

    diff --git a/examples/production-renew-medical-licence/public/id-lookup.html b/examples/production-renew-medical-licence/public/id-lookup.html index b08893d..d9b45c1 100644 --- a/examples/production-renew-medical-licence/public/id-lookup.html +++ b/examples/production-renew-medical-licence/public/id-lookup.html @@ -39,7 +39,7 @@

    What's your Trident ID?

    -

    We'll look up your name, contact details, and current registration category. You won't have to type them in.

    +

    We'll look up your name, contact details, and current registration category. You won't have to type them in.

    Pause any time. We'll save your progress.

    @@ -55,12 +55,12 @@

    What's your Trident ID?

    diff --git a/examples/production-renew-medical-licence/public/identity-help.html b/examples/production-renew-medical-licence/public/identity-help.html index 663a4e8..74784c5 100644 --- a/examples/production-renew-medical-licence/public/identity-help.html +++ b/examples/production-renew-medical-licence/public/identity-help.html @@ -46,12 +46,12 @@

    If the number was right

    diff --git a/examples/production-renew-medical-licence/public/index.html b/examples/production-renew-medical-licence/public/index.html index a50626f..b63ea42 100644 --- a/examples/production-renew-medical-licence/public/index.html +++ b/examples/production-renew-medical-licence/public/index.html @@ -36,7 +36,7 @@

    Renew your medical licence

    BBD 200
    Renewal fee (full registration)
    -
    Provisional, temporary, restricted and specialty-overseas registrations have different fees. We'll show you the right one once we know your category.
    +
    Provisional, temporary, restricted and specialty-overseas registrations have different fees. We'll show you the right one once we know your category.
    @@ -53,7 +53,7 @@

    How long it takes

    You can do this from anywhere in the world -

    If you're on rotation, on holiday, or working overseas, the service works the same way.

    +

    If you're on rotation, on holiday, or working overseas, the service works the same way.

    When you'll get your certificate

    @@ -61,7 +61,7 @@

    When you'll get your certificate

    If you can't renew online -

    Call the Medical Council on 246-535-7400 or book an appointment.

    +

    Call the Medical Council on 246-535-7400 or book an appointment.

    @@ -72,12 +72,12 @@

    When you'll get your certificate

    diff --git a/examples/production-renew-medical-licence/public/parish-update.html b/examples/production-renew-medical-licence/public/parish-update.html index 1c4f51b..2a6a510 100644 --- a/examples/production-renew-medical-licence/public/parish-update.html +++ b/examples/production-renew-medical-licence/public/parish-update.html @@ -86,12 +86,12 @@
    diff --git a/examples/production-renew-medical-licence/public/payment.html b/examples/production-renew-medical-licence/public/payment.html index 677089a..6536909 100644 --- a/examples/production-renew-medical-licence/public/payment.html +++ b/examples/production-renew-medical-licence/public/payment.html @@ -33,7 +33,7 @@

    Pay your renewal fee

    Renewal fee for full registration -

    BBD 200.00

    +

    BBD 200.00

    You'll be taken to the secure GovTech Barbados payment page. We accept debit and credit cards.

    @@ -45,18 +45,18 @@

    Pay your renewal fee

    -

    Your payment is handled by the shared GovTech Barbados payment gateway. We don't store your card details.

    +

    Your payment is handled by the shared GovTech Barbados payment gateway. We don't store your card details.