Client system-role messages were forwarded to the model
Anyone could send the chat API a message labelled as coming from the system and override the assistant's instructions, turning the demo into a free general-purpose model on the project's key.
Case notes
api/chat.js passed client messages through untouched. v3.0 whitelists roles to user and assistant, drops everything else, and caps length and count.Before: attacker system message forwarded at index 1 of 2 system messages After: 0 client-controlled system messages; exactly one system message in every provider payload Gate: test/gate-endpoint.mjs: role whitelist Status: fixed
The deployed sales persona had no crisis clause
The red-team's first Critical fix (stop and point to emergency help if someone mentions self-harm) existed in the design doc and the offline prompt but had dropped out of the live sales prompt during a rewrite.
Case notes
Personas now live in one file (backend/personas/personas.json) used by the server and injected into the page at build; a rule list (personas/rules.json) is asserted against every persona and the built page.Before: sales persona: 0 crisis clauses After: 9 required rules present in both personas and in the built page Gate: test/gate-static.mjs: persona rules Status: fixed
Visitor knowledge-base edits could fill most of the system prompt
The 'edit the knowledge base' feature let a visitor push up to 36 edited passages of 1,500 characters each into the prompt with no marking, so 65% of what the model read could be visitor text.
Case notes
Edits are now capped at 3 passages of 240 characters, control characters stripped, each labelled VISITOR-EDITED in the sources block, and the persona declares such passages untrusted data.Before: 4,494 of 6,931 system-prompt bytes (65%) visitor-controlled, unlabelled After: at most 3 x 240 characters, labelled; attacker share under 20% in the gate Gate: test/gate-endpoint.mjs: kbEdits caps and label Status: fixed
Provider error bodies were echoed to the browser
When the model provider rejected a request, its raw error text (which can include key fragments and internal details) was sent to the visitor.
Case notes
Provider errors are logged server-side; the client receives fixed honest copy with a short error code (model_unavailable, provider_rate_limited).Before: HTTP 500 with the provider's 401 body including a key fragment After: HTTP 502/503 with fixed copy; provider text absent Gate: test/gate-endpoint.mjs: error copy Status: fixed
No guard against the assistant claiming it did something
The assistants cannot take actions, but a reply like 'I've processed your refund' rendered with no warning, and one phrasing even produced an affirmative ticket card.
Case notes
A completion-claim guard flags first-person action claims and passive completion phrasing; the ticket card renders only when the visitor asked to escalate; a distinct 'Handed off (illustrative ticket)' badge replaces the misleading 'Not in knowledge base' badge on escalations.Before: 20 of 20 phantom claims rendered with no specific warning; 1 got an affirmative card After: 20 of 20 flagged, 0 of 20 legitimate answers flagged, cards only with escalation intent Gate: test/gate-ui.mjs: claim guard 20+20 Status: fixed
Wildcard CORS and no security headers
Any website could call the demo's API from a visitor's browser, and the page shipped without the standard browser protections.
Case notes
CORS now echoes only an explicit ALLOW_ORIGIN list (the same-origin page needs none). vercel.json is generated with a Content-Security-Policy whose script-src pins the SHA-256 of each inline script (computed by build.mjs), plus nosniff, frame-ancestors none, referrer and permissions policies.Before: access-control-allow-origin: *; no headers block After: no ACAO without an allowlist; CSP with per-script hashes; 5 protective headers Gate: test/gate-static.mjs: CSP hashes match built scripts; test/gate-endpoint.mjs: CORS Status: fixed
On a phone the first screen had no chat
After 'Enter the demo' a phone visitor saw badges, picker cards and a tips popup; the chat was almost two screens down.
Case notes
Under 640px the layout is chat first: compact hero, picker as a horizontal strip, sidebar after the chat, tips popup suppressed, min-width 0 on grid items.Before: chat top at 1,409px on an 844px viewport After: chat visible in the first screen on 390x844 (gate asserts chat top below viewport height) Gate: test/gate-ui.mjs: phone layout (Playwright) Status: fixed
Docs claimed things the code did not do
README and design docs said the sales bot books demos, every answer is cited, a faithfulness check runs, the RAG toggle works, and the prompts are used verbatim. None of those were true of the deployed site.
Case notes
README, backend README, DEPLOY-GUIDE rewritten; design docs and June test reports marked historical; the static gate forbids the specific overstatements.Before: 9 unsupported claims After: 0 forbidden claim strings in the docs (gate list) Gate: test/gate-static.mjs: forbidden doc claims Status: fixed
The repo contained no tests and no CI
The project described itself as tested, but a clean clone had nothing to run.
Case notes
Root package.json with npm test (build, static gate, endpoint gate, UI gate, retrieval eval, audit probe), declared devDependencies, GitHub Actions workflow.Before: 0 test files, no package.json, no workflow After: 5 gates plus the eval and the probe run on every push Gate: npm test Status: fixed
271 em and en dashes, including the title
A project rule forbids dashes in copy, docs and code comments; the repo had 271 across 19 files.
Case notes
Full sweep; the static gate fails on any em or en dash in the repo.Before: 271 dashes in 19 files After: 0 Gate: test/gate-static.mjs: dash sweep Status: fixed
One client could lock every visitor out for a day
Rejected requests still counted against the shared daily budget, so a single script could take the free demo offline for everyone on a server instance.
Case notes
lib/limits.mjs checks the caller first and counts only accepted requests; each address also gets a daily share (120 chat, 30 voice) and the log notes 80% and 100% of the budget. A Vercel WAF rate-limit rule in front of it is a dashboard step (DEPLOY-GUIDE.md).Before: 600 requests from one IP, then a new visitor got 429 After: attacker limited at request 21, rejected requests spend nothing, a new visitor is served Gate: test/gate-endpoint.mjs: N-01; probe-2026-11.mjs Status: fixed
A knowledge-base edit steered the bot into asking for card numbers
A visitor's own edit to a passage could make the assistant tell them to email a full card number. It only affects the editor's session, but it is the injection path a shared knowledge base would open.
Case notes
Phase 1 guard layer: deterministic output rules block any reply that asks for card numbers, passwords or codes (R-SECRET) and remove emails, links and phone numbers that are not in the original knowledge base or the visitor's own messages (R-CONTACT). A request carrying visitor edits is answered as checked JSON, never streamed, the answer is tagged 'Uses your edit', and the source drawer shows the original passage beside the edit.Before: 1 of 2 live runs asked for a card number After: card-number request replaced by the safe reply; injected contact removed; edits never streamed Gate: test/gate-endpoint.mjs: N-02; test/gate-ui.mjs: N-02 Status: fixed
Personal data and the Gemini free tier
Google's terms ask that personal information not be sent to its unpaid tier, and the sales bot asked for names and work emails.
Case notes
A privacy note now sits under the composer and on the intro, the sales persona suggests example values (Alex Example, alex@example.com), and the 'free AI quota' copy is gone. Attaching billing to the key's Cloud project is an owner step.Before: names and emails requested; voice clips sent; free-tier copy in the UI After: privacy note shipped, example values suggested; paid tier pending the owner Gate: test/gate-ui.mjs: N-03 privacy note; persona drift gate Status: partially fixed: paid tier is an owner step
Switching bots mid-reply misfiled the answer
Ask Support a question, switch to Sales before the reply arrives, and the Support answer showed up in the Sales transcript.
Case notes
send() captures the bot at send time and appends the reply to that bot's history; the DOM updates only if that bot is still active.Before: answer shown in the other transcript After: answer stays with the bot that was asked Gate: test/gate-ui.mjs: bot switch Status: fixed
A suggestion clicked while busy erased the draft
Clicking a sidebar suggestion while a reply was pending overwrote whatever you were typing and sent nothing.
Case notes
Suggestions route through ask(): if a reply is pending the suggestion is queued and runs after it; drafts are never overwritten.Before: draft replaced, suggestion dropped After: draft preserved, suggestion queued and sent Gate: test/gate-ui.mjs: queued suggestion Status: fixed
Controls that did nothing on the live site
The RAG toggle and the API-key gear were visible but ignored when the backend was in use, and a TOP_K setting was read and never applied.
Case notes
Both controls are hidden in backend mode (body.backend-mode); TOP_K is applied (default 3, max 6).Before: RAG off still cited; gear save changed nothing; TOP_K unused After: controls hidden; TOP_K respected Gate: test/gate-ui.mjs: dead controls; test/gate-endpoint.mjs: TOP_K Status: fixed
The identity check could not be completed by a visitor
The support bot asks for an email on file and a workspace URL, but nothing on the page told visitors what to type.
Case notes
A demo-account card in the support sidebar shows owner@acme-co.example and acme-co with honest copy that the check is illustrative and low-assurance.Before: 0 hints on the page After: demo values on screen next to the chat Gate: test/gate-ui.mjs: credentials card Status: fixed
Over-escalation and a stretched discount
Asking whether there is a phone number produced a ticket instead of the honest answer that support is by email, and the student-discount answer extended an institutional discount to students.
Case notes
Persona rules added: a question about how to reach support is a question, not a request; published discounts are never extended to unnamed groups. Escalations now carry a Handed off badge instead of Not in knowledge base.Before: ticket 3 of 3; over-extension 2 of 3 (live) After: rules shipped; live repeats pending after deploy Gate: live matrix (manual, three repeats) Status: fixed in prompt, live verification pending
Rate limit keyed on a client-writable header
The fair-use limiter read the first value of x-forwarded-for, which a client can prepend to.
Case notes
clientIp() prefers x-real-ip and otherwise the last hop of x-forwarded-for, the one the platform appends.Before: 25 requests with a rotating prefix, never limited After: limited at request 21 regardless of prefix Gate: test/gate-endpoint.mjs: limiter keying Status: fixed
Question words polluted keyword retrieval
Words like 'what' were not stopwords, so a passage headed 'What is included' could rank for 'what is your refund policy'.
Case notes
Shared retriever with an extended stopword list and a rule that a single common term is not evidence; the same module runs on the server and in the page.Before: junk keyword-only chunk in top 3 After: 0 keyword-only junk for the gate query; page and server rank identically Gate: test/gate-endpoint.mjs: junk keyword; test/gate-static.mjs: injected retriever equals module Status: fixed
Ticket IDs repeated across visitors
The model was inventing ticket numbers and kept reusing the same few.
Case notes
The server generates a random NIM id per request and instructs the model to use exactly that id; the gate asserts two requests get different ids.Before: 4 distinct IDs in 10 escalations After: unique per request Gate: test/gate-endpoint.mjs: ticket uniqueness Status: fixed
Retrieval quality had no evidence
There was no gold set and no published number; the page's suggested questions reuse knowledge-base wording, so any number on them would be optimistic.
Case notes
eval/gold.json (30 items: paraphrases, vocabulary matches, and out-of-scope questions) runs through the shipped retriever; keyword-path recall is stamped into the page at build and labelled in-sample-adjacent; the hybrid number requires a live key and is reported as not yet measured until eval/run.mjs is run with API_KEY.Before: no gold set, no number After: gold set shipped, keyword-path recall stamped, held-out protocol documented Gate: test/eval-retrieval.mjs Status: partially fixed: hybrid number pending a live run
The support bot printed its own instructions
Asked for its system prompt, the bot printed it verbatim despite a rule against it. The prompts are public in the page source, so nothing secret leaked, but the rule was not true.
Case notes
An output rule replaces any reply that overlaps the bot's own instructions verbatim (R-PROMPT, four or more shared 8-word runs), and the sidebar links the published prompts, since they are public by design.Before: live reply matched the persona verbatim After: recitation replaced; prompts linked as public Gate: test/gate-endpoint.mjs: N-04; test/gate-ui.mjs: N-04 Status: fixed
The student discount was still stretched (G-15)
The sales bot told a college student the institutional education discount applied to them.
Case notes
The sales persona names the case, and an output rule (R-STUDENT) appends the institutional rule to any reply that tells a student the education discount applies. Gold-set questions added; a live rerun remains.Before: 2 of 2 live runs over-extended After: rule appended deterministically; prompt rule shipped Gate: test/gate-endpoint.mjs: N-05; eval/gold.json Status: fixed in prompt and output rule, live verification pending
Plural questions missed the pricing passages
Asking 'What plans do you offer?' retrieved security and refund passages, because 'plans' never matched 'plan'.
Case notes
Light plural stemming in the shared tokenizer, a common term counts as evidence when it is in the passage heading, and fusion drops keyword-only hits under 40% of the best keyword score. Plural cases added to eval/gold.json.Before: keyword top-3: security.hipaa, data.export, billing.refunds After: pricing passages ranked for the plural question; keyword recall@3 0.73 to 0.81 on a larger gold set Gate: test/gate-endpoint.mjs: N-06; eval/run.mjs Status: fixed
A malformed voice token crashed the function
A broken page token made the voice endpoint fail with a server crash instead of a polite refusal.
Case notes
verifyToken validates the shape and length before comparing, never throws, and every malformed token is a 401.Before: live 500 FUNCTION_INVOCATION_FAILED After: 401 for every malformed shape tested Gate: test/gate-endpoint.mjs: N-07; probe-2026-11.mjs Status: fixed
Earlier assistant turns can be forged
The browser sends the chat history, so a visitor can write a fake earlier reply and the model treats it as its own.
Case notes
Every answer leaves the server with an HMAC over the bot and the exact text; the page sends it back, and assistant turns without a valid signature (forged, edited, or from the other bot) are dropped before the model sees them.Before: forged turn forwarded to the model After: forged and tampered turns dropped; genuine signed turns kept, streamed or not Gate: test/gate-endpoint.mjs: N-08; test/gate-ui.mjs: N-08; probe-2026-11.mjs Status: fixed
One request could carry 164,000 characters
A single request could push a whole novel's worth of text to the model, and an empty request still cost a model call.
Case notes
Requests are capped at 12 turns and 12,000 characters (oldest turns drop first), a request without a visitor message is a 400 before any provider call, and each request logs counts only.Before: 164,326 characters forwarded; empty POST made one provider call After: at most 12 turns and 12,000 characters; empty request refused with no provider call Gate: test/gate-endpoint.mjs: N-09; probe-2026-11.mjs Status: fixed
Server files were served as public URLs
The server code, prompts and knowledge-base JSON could be downloaded from the live site.
Case notes
Only backend/public/ is the static root (vercel.json outputDirectory). Server code, prompts and the knowledge base are bundled into the functions, and unknown paths get a 404 page.Before: /lib/security.mjs, /personas/*.json, /kb.json and others returned 200 After: 404 for every server path; public assets still served Gate: test/gate-endpoint.mjs: N-10 Status: fixed
Dark mode failed text contrast
Blue accent text, the Live badge and the phone Send button were too faint to read comfortably.
Case notes
Accent is split into a fill token (white text on it is at least 4.5:1) and an ink token for accent-coloured text; light-mode green and badge colours were darkened.Before: up to 26 failing elements per view After: axe: no serious issues in any view, theme or phone Gate: test/gate-ui.mjs: N-11/N-23 axe Status: fixed
Keyboard focus escaped the intro and the source drawer
Tabbing on the intro reached hidden controls behind it, and opening a source did not move focus to it.
Case notes
The page behind the intro is inert until you enter; the source drawer is a labelled modal dialog that takes focus, keeps Tab inside, and returns focus to the citation on close.Before: focus behind the cover after 5 Tab stops; drawer had no dialog role After: focus stays in the intro; drawer takes and returns focus Gate: test/gate-ui.mjs: N-12 Status: fixed
The model is legacy-gated and unmonitored
The default model is only served to existing Gemini users, and nothing checks that it still answers.
Case notes
Request bodies are model-aware (Gemini 2.5 thinking off; Gemini 3 at its defaults with token headroom), /api/health?deep=1 runs a cached canary call that drives the status pill, and a daily GitHub Action checks the live model. Switching CHAT_MODEL to Gemini 3.5 Flash-Lite and rerunning the live eval is an owner step.Before: /api/health reports the model but never calls it After: canary drives the pill and runs daily; model switch ready Gate: test/gate-endpoint.mjs: N-13; .github/workflows/canary.yml Status: partially fixed: switching CHAT_MODEL is an owner step
On phones the composer started below the fold
After entering on a phone, the message box sat off screen and many controls were small to tap.
Case notes
On phones the chat card fills the rest of the first screen with the composer in view, and every control is at least 44 px.Before: composer below the fold at 390x844; 21 controls under 44 px After: composer in view at 360x740, 375x667 and 390x844; 0 controls under 44 px Gate: test/gate-ui.mjs: N-14 Status: fixed
Voice endpoint usable as anonymous speech-to-text
Anyone could post audio to the transcription API without loading the demo.
Case notes
A short-lived page token (issued by GET /api/health, HMAC of a timestamp, 15 minute life) is required; daily ceiling lowered to 150 per instance. This is a friction control, not authentication, and is described as such.Before: anonymous POST accepted After: 401 without token; 200 with the page token Gate: test/gate-endpoint.mjs: voice token Status: fixed
Keyboard and navigation gaps
Escape did not close the source drawer, there were no direct links to the X-ray or the evidence page, and the tips popup covered the phone layout.
Case notes
Escape closes the drawer and the modal; #kb, #xray, #tested and #chat deep links skip the cover; tips are hidden under 640px.Before: drawer open after Escape; no deep links After: Escape closes; deep links work Gate: test/gate-ui.mjs: Escape and deep links Status: fixed
No version stamp and an unreproducible card image
The page carried no version, the package version never changed, and the social card was generated by a script that was not in the repo.
Case notes
version.json feeds the page stamp, the health endpoint, and the card; tools/og-image.py is committed; CHANGELOG.md added.Before: no stamp; generator absent After: v3.0.0 stamped; generator committed Gate: test/gate-static.mjs: version stamp and generator present Status: fixed
No link to the sister project
The page and README did not mention the Harlan & West project built with the same method.
Case notes
Footer and README cross-link via the sisterUrl field in version.json.Before: no mention After: cross-linked Gate: test/gate-static.mjs: cross-link present Status: fixed
X-ray copy overstated its scope
The README promised the X-ray scores the whole knowledge base; it showed ten passages.
Case notes
The endpoint now returns all 36 passages with scores; the page shows ten and offers Show all.Before: 10 of 36 returned After: 36 returned, 10 shown, fold for the rest Gate: test/gate-endpoint.mjs: retrieve returns 36 Status: fixed
The voice endpoint read any file type
The transcription endpoint would pass images or PDFs to the model, making it a free document reader.
Case notes
Only WAV audio is accepted: the declared type must be WAV and the bytes must start with a RIFF/WAVE header.Before: application/pdf forwarded with 200 After: 415 for PDF and for non-WAV bytes labelled WAV Gate: test/gate-endpoint.mjs: N-15; probe-2026-11.mjs Status: fixed
Invisible Unicode passes into prompts
Hidden tag characters, zero-width and direction controls reach the model unchanged.
Case notes
Visitor messages and edits are NFKC-normalized and stripped of tag characters, zero-width and bidi controls and variation selectors; requests that contained them are counted in the logs.Before: all three survive into the prompt After: no invisible characters reach the model Gate: test/gate-endpoint.mjs: N-16; probe-2026-11.mjs Status: fixed
Citation lists showed as raw text, even on a refusal
Answers citing '[S1, S2, S3]' showed the raw markers, and one was attached to a refusal.
Case notes
Citation lists render as one button per source, and both personas say citations belong only on facts taken from the sources.Before: raw '[S1, S2, S3]' on a refusal After: three citation buttons, no raw markers; refusal rule in both personas Gate: test/gate-ui.mjs: N-17 Status: fixed in code and prompt, live verification pending
Bad JSON was reported as a model outage
A malformed request got a 'model unavailable' error instead of telling the caller the request was wrong.
Case notes
Both endpoints parse the body defensively and answer 400 invalid_json.Before: 502 model_unavailable After: 400 invalid_json Gate: test/gate-endpoint.mjs: N-18; probe-2026-11.mjs Status: fixed
The intro animation kept running after entering
A timer on the hidden intro kept animating in the background.
Case notes
The pipeline animation runs only while the intro is visible and the tab is in view.Before: 14 class changes in 5 s while hidden After: 0 changes after entering Gate: test/gate-ui.mjs: N-19 Status: fixed
Dead bring-your-own-key code shipped
Hidden settings for pasting an OpenAI or Anthropic key, and stale copy, were still in the production page.
Case notes
The modal, gear, RAG toggle and third-party model calls are removed; only the embedding adapter used by the UI gate remains.Before: hidden modal and browser calls to OpenAI and Anthropic After: 0 dead controls, 0 third-party model URLs Gate: test/gate-ui.mjs: N-20 Status: fixed
No security.txt, crawler files or CSP reporting
There was no standard place to report a vulnerability, no robots or sitemap, and no way to learn about blocked content.
Case notes
RFC 9116 security.txt (GitHub private advisories), robots.txt, sitemap.xml, a counts-only /api/csp-report endpoint, COOP and CORP same-origin, and no-store on the API.Before: 404 or absent After: served; CSP violations logged as directive, origin and path only Gate: test/gate-endpoint.mjs: N-21 Status: fixed
The voice-token secret came from the API key
Rotating the model key and rotating the page-token secret were the same act.
Case notes
A separate TOKEN_SECRET is used whenever it is set; until the owner sets it, the old derivation keeps deployments working.Before: secret = hash of the provider key After: TOKEN_SECRET supported and gated Gate: test/gate-endpoint.mjs: N-22 Status: partially fixed: set TOKEN_SECRET in Vercel
Missing landmarks, skipped headings, a tips card over content
Screen-reader navigation lacked a main region, heading levels skipped, and the tips popup covered the page for 13 seconds.
Case notes
Header, main and footer landmarks; headings in order; the intro is a labelled dialog; tips are docked in the sidebar and remembered once dismissed.Before: axe landmark-one-main, region, heading-order After: axe: no serious issues Gate: test/gate-ui.mjs: N-11/N-23 axe Status: fixed
A link was told apart by colour only
The audit link on the Tested page looked like the surrounding text except for its colour.
Case notes
Links inside running text are underlined.Before: link-in-text-block 1.44:1 After: underlined Gate: test/gate-ui.mjs: axe Status: fixed
Deliberately still open: live reruns of the prompt-level fixes (N-05, N-17), owner steps in the Vercel and Google dashboards (N-03, N-13, N-22), faithfulness and refusal numbers (needs a model budget), the held-out question set, and the live hybrid retrieval number.