diff --git a/.planning/notes/2026-11-14-mail-url-scheme-check.md b/.planning/notes/2026-11-14-mail-url-scheme-check.md
index 2abdb3e7..c5162ba7 100644
--- a/.planning/notes/2026-11-14-mail-url-scheme-check.md
+++ b/.planning/notes/2026-11-14-mail-url-scheme-check.md
@@ -1,7 +1,7 @@
# Decision: postcard checks URL schemes in decoded attribute values, never lets a site name stop a send, and prints the footer name literally
**Date:** 2026-11-14
-**Status:** Accepted
+**Status:** Accepted; amended the same day by the review fixes of 35-REVIEW.md (re-review of 35-08/35-09): CR-01 residual, CR-02, WR-01, WR-02, WR-03 (see "Amendment" below)
**Context:** Phase 35 re-verification gap (35-VERIFICATION.md `gaps:`, the CR-01 regression), 35-REVIEW.md CR-01, WR-01 and WR-05, Jakub's decisions of 2026-11-14 (two plans: this fix in 35-08, then the regression and unit tests in 35-09; WR-01 and WR-05 bundled with CR-01), plan 35-08
## The problem
@@ -25,19 +25,20 @@ Two related findings: the check read undecoded markup, so `href="javascript:
The rendered HTML is read with `golang.org/x/net/html`'s tokenizer (already a direct framework requirement, used by seaglass, tide and cabana). The tokenizer lower-cases attribute names and decodes character references in attribute values (`:`, `:`, `:`, `j`), so the check sees what a mail client sees.
- **Single-URL attributes** (`urlAttributes`): `action`, `background`, `cite`, `codebase`, `data`, `dynsrc`, `formaction`, `href`, `icon`, `longdesc`, `lowsrc`, `manifest`, `poster`, `profile`, `src`, `usemap`, `xlink:href`, and the SVG animation targets `from`, `to`, `by`. A value is refused when, decoded, with every ASCII whitespace and control character (U+0000 to U+0020 and U+007F) removed and lower-cased, it starts with `javascript:`, `vbscript:` or `data:` (`hasDangerousScheme`). Removing whitespace closes tab- and newline-split schemes.
-- **List-valued attributes** (`urlListAttributes`: `srcset`, `ping`, `archive`, `values`), **`style` attributes**, the **`content` attribute of `meta` elements**, the **text of `style` elements** and **comment data**: refused when the existing `dangerousScheme` pattern matches anywhere in the decoded value. The conservative rule stays for CSS and lists, where prose does not belong.
+- **List-valued attributes** (`urlListAttributes`: `srcset`, `ping`, `archive`, `values`), **`style` attributes**, the **`content` attribute of `meta` elements**, the **text of `style` elements** and **comment data**: refused when the existing `dangerousScheme` pattern matches anywhere in the decoded value with whitespace and control characters removed (`stripURLSpace`, shared with `hasDangerousScheme`; WR-01), so `values="java script:..."` is refused. The conservative rule stays for CSS and lists, where prose does not belong.
+- **Raw-text elements and comments are checked as markup too** (CR-02). The tokenizer reads the content of `iframe`, `noembed`, `noframes`, `noscript`, `plaintext`, `script`, `style`, `textarea`, `title` and `xmp` as one text token, also after a self-closing start tag. A mail client may parse it as markup (it renders with scripting off, so `noscript` content is markup; inside `svg`/`math` these are foreign elements with markup children), so `unsafeMarkup` checks the raw source of that content, and the data of every comment (Outlook conditional comments), again as markup. Each nested check reads a strictly shorter text; nesting deeper than eight levels (`maxMarkupDepth`) is refused ("rendered HTML nests raw-text elements or comments too deeply"). The raw source, not the decoded text, is re-read, so `<a href=...>` in a `title` stays text.
- **Text content is not checked for schemes.** It is not a URL; a mail client does not follow it. `metadata:` or `Big Data: Summit` in a body, a header or a footer passes.
-- **Event handlers.** The raw-markup regexes for `script`/`iframe`/`object`/`embed` tags and for whitespace-prefixed `on*=` stay as they are and run first. The tokenizer walk additionally refuses any attribute whose name starts with `on`, which closes `
`, the form the regex misses (no legitimate mail markup uses such an attribute).
+- **Event handlers.** The raw-markup regex for `script`/`iframe`/`object`/`embed` tags stays as it is and runs first. Event handlers are attributes only: the tokenizer walk refuses any attribute whose name starts with `on`, with or without whitespace before it (`
`), also inside raw-text elements and comments. The whole-document regex for whitespace-prefixed `on*=` is dropped (WR-02): it read text as well, so a variable such as `buy one = get one free` stopped its own message, and the footer's `© Online=Shop` stopped every send (CR-01 residual).
- **Error messages are unchanged** ("rendered HTML contains a dangerous URL scheme", "rendered HTML contains event handlers"). The snippet is the raw markup of the offending token, so an editor error shows the encoded form the administrator wrote.
- **Draft layout CSS** is checked as the content of a style element, so the error stays on `content_css`.
### Site names never stop a send (`postcard.UnsafeText`, `siteNameFrom`, `layoutSiteName`)
-- **`postcard.UnsafeText(s string) bool`** (exported, so cabana can refuse a name at save): a text is unsafe when, HTML-escaped with the standard library's `html.EscapeString` as html/template prints text, it fails the rendered-HTML checks (for example event-handler-shaped text such as `Shop onclick=x`), or when it holds a script URL (`scriptURLText`): `javascript:` or `vbscript:` at a scheme boundary, or `data:` at a scheme boundary directly followed by a non-space character (a data URL). A scheme boundary is the start of the text or a character that cannot belong to a URL scheme (anything but ASCII letters, digits, `+`, `.` and `-`). `Big Data: Summit`, `Metadata: Weekly` and `Metadata:Weekly` are safe; `javascript:alert(1)`, `javascript: Acme` and `data:text/html,x` are not.
+- **`postcard.UnsafeText(s string) bool`** (exported, so cabana can refuse a name at save): a text is unsafe when, HTML-escaped with the standard library's `html.EscapeString` as html/template prints text and placed where the built-in layouts print it (after `© 2000 ` in a footer paragraph, in the header span and in the logo's `alt`; `printContext`, CR-01 residual), it fails the rendered-HTML checks, or when it holds a script URL (`scriptURLText`): `javascript:` or `vbscript:` at a scheme boundary (whitespace may follow the colon, since `javascript: alert(1)` still runs), or a data URL: `data:` at a scheme boundary, an optional MIME type and the `;` or `,` every data URL has (WR-03). A scheme boundary is the start of the text or a character that cannot belong to a URL scheme (anything but ASCII letters, digits, `+`, `.` and `-`). Escaped text is never markup, so since the handler regex is gone the rendered-HTML part refuses nothing a layout prints as text; it stays as a guard for a later check that depends on context. `Big Data: Summit`, `Metadata: Weekly`, `Metadata:Weekly`, `Data:Lab`, `Online=Shop` and `Shop onclick=x` are safe; `javascript:alert(1)`, `javascript: Acme`, `data:text/html,x` and `data:,x` are not.
- **Render-time drop.** An unsafe Branding Site name is treated as empty, so the documented fallback applies (the display name of `mail.from`, if that one is safe); an unsafe `mail.from` display name gives no name. This holds on every render path: the file version, the override render built from it, the override-failure fallback and the editor. One warning per source per minute through the mailer's existing rate-limited `warn`, keyed `site_name:branding` or `site_name:mail.from`, message "postcard: site name left out of the layouts, it fails the mail safety check", with the source and never the value.
- **The Branding preview** of an unsaved draft drops the name the same way, so the preview shows what would be sent; the save is what refuses it.
- **Save rule.** cabana's `MailBrandSetting.BeforeValidate` refuses a name `postcard.UnsafeText` refuses: a 422 on `site_name` with `backend::lang.mail.brand.site_name_unsafe`, collected with the colour and logo details. Saving a template or a layout while an unsafe name is stored is not refused (the name is left out of the render).
-- **Copy** (`mail.brand.site_name_unsafe`): en "This name cannot be shown in mail. Remove addresses that start with javascript:, vbscript: or data: and text such as onclick=."; pl "Tej nazwy nie można pokazać w wiadomościach. Usuń adresy zaczynające się od javascript:, vbscript: lub data: oraz tekst w rodzaju onclick=."
+- **Copy** (`mail.brand.site_name_unsafe`): en "This name cannot be shown in mail. Remove addresses that start with javascript:, vbscript: or data:."; pl "Tej nazwy nie można pokazać w wiadomościach. Usuń adresy zaczynające się od javascript:, vbscript: lub data:." (the "text such as onclick=" clause was dropped with the handler regex, WR-02; 35-UI-SPEC.md and 35-08-PLAN.md still quote the 35-08 copy)
### The inliner never stops mail (WR-05 contradiction)
@@ -56,7 +57,16 @@ The `footer` partial gains a `text` argument, printed as plain text (a paragraph
## Residual risk accepted
- CSS escape sequences inside CSS (`\6a avascript:`) are not decoded. Mail clients do not run script URLs from CSS.
-- The unanchored raw handler regex `\son[a-z]+\s*=` still refuses prose such as " online = "; it is unchanged (out of the user's scope for this gap closure).
+- Re-reading raw-text element and comment content as markup over-refuses in the rare case where a client would read it as text (an HTML-context `textarea` holding markup, a CSS string holding ``). No mail markup needs either.
+- html/template escapes a template's literal `title` and `textarea` text itself, so an `