docs(35): re-verify after review fixes - CR-02 quoted end-tag residual open
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
---
|
||||
phase: 35-mail-templates-and-layouts-editor
|
||||
verified: 2026-11-14T15:23:23Z
|
||||
verified: 2026-11-14T16:58:10Z
|
||||
status: gaps_found
|
||||
score: 18/22 must-haves verified
|
||||
score: 21/22 must-haves verified
|
||||
covered_files:
|
||||
- .planning/phases/35-mail-templates-and-layouts-editor/35-01-PLAN.md
|
||||
- .planning/phases/35-mail-templates-and-layouts-editor/35-01-SUMMARY.md
|
||||
@@ -205,67 +205,54 @@ covered_files:
|
||||
- modules/surf/serve.go
|
||||
- modules/surf/store_lookup_test.go
|
||||
- scripts/check-phase35.sh
|
||||
covered_digest: "v2:sha256:621fe9f6410fdd232b5b21c9b7b8b25050f32f17f113fa8f2ef654e1b2707c49"
|
||||
covered_digest: "v2:sha256:f7c3f2115a39b52bac7bbc970599c28a13b09b580c1289a09fb07f222deff9c4"
|
||||
behavior_unverified: 0
|
||||
overrides_applied: 0
|
||||
re_verification:
|
||||
previous_status: gaps_found
|
||||
previous_score: 13/14
|
||||
previous_score: 18/22
|
||||
gaps_closed:
|
||||
- "CR-01 colon class: a site name with ordinary colon prose ('Metadata: Weekly' from mail.from, 'Big Data: Summit' from Branding) now renders in header and footer and sends on the default and system layouts on every render path (TestSiteNameSend PASS; verifier probe UnsafeText false for both)"
|
||||
- "CR-01 script-URL class: a site name holding javascript:/vbscript:/data: is dropped at render with a rate-limited warning, refused on the Branding form (422 on site_name, en/pl), and stored ones do not block saves or sends (TestUnsafeSiteNameDropped, TestMailSiteNameSafety PASS)"
|
||||
- "WR-01 (prior advisory): footer prints the site name literally (TestFooterSiteNameLiteral PASS)"
|
||||
- "WR-05 (prior advisory), contradiction part: an inlined result that fails the check is sent as its style-block version (TestInlineUnsafeOutput PASS); encoded href=\"javascript:...\" is refused with inlining on and off (TestURLSchemeCheck PASS)"
|
||||
- "CR-01 residual: Branding 'Online=Shop'/'onboarding=team' and mail.from '\"Online=Shop\" <x@example.com>' now send on the default and system layouts (verifier probe: all 8 sends err=<nil>; TestSiteNameSend, TestUnsafeSiteNameDropped PASS); Editor.Validate of a template under Branding 'Online=Shop' is accepted; body text 'Ada, buy one = get one free' sends (WR-02, handler regex removed from templates.go)"
|
||||
- "CR-02, the payloads it named: javascript:/onerror inside <noscript>, <xmp>, SVG <title>/<textarea>/<style> (direct content) are refused by validateHTML and Editor.Validate; a layout override carrying the noscript payload falls back to the file version with inlining on and off (verifier probe)"
|
||||
- "WR-01 (advisory): values=\"java	script:...\" and meta refresh url=java	script: are refused (verifier probe)"
|
||||
- "WR-03 (advisory): UnsafeText('Data:Lab') is false (verifier probe)"
|
||||
gaps_remaining:
|
||||
- "Mail that already works keeps working / no Branding value stops mail on the built-in layouts: still FAILED for site names that begin with on<letters>= (CR-01 residual, reproduced by the verifier)"
|
||||
regressions:
|
||||
- "CR-02 (new in 35-08): replacing the whole-document scheme regex with a tokenizer-only walk lets javascript: URLs inside <noscript>, <xmp> and SVG <title>/<textarea>/<style> pass Editor.Validate and be sent; the pre-35-08 check (75669b34) refused them"
|
||||
- "CR-02 residual: the raw-text re-check reads only up to where x/net/html's tokenizer ends the element. A raw-text end tag inside a quoted attribute (<svg><style><a title=\"</style>\" href=\"javascript:alert(1)\">) ends the element early for the tokenizer, and the rest of the tag is checked as text. A conforming HTML parser reads it as a live link"
|
||||
regressions: []
|
||||
gaps:
|
||||
- truth: "Mail that already works keeps working: an application that sends mail today keeps sending it after upgrading, and no admin-saved Branding value can stop mail on the built-in layouts (roadmap goal clause; carried-forward CR-01 gap; 35-08/35-09 must-have)"
|
||||
status: failed
|
||||
reason: "CR-01 residual, reproduced by the verifier (overlay probe, no source change). UnsafeText(s) runs validateHTML(html.EscapeString(s)) on the name alone. The only check that can fire on escaped text is the whole-document eventHandler regex (?i)\\son[a-z]+\\s*= (templates.go:49, run at templates.go:830), which needs whitespace before 'on'. A trimmed name that starts with on<letters>= has none, so UnsafeText('Online=Shop') and UnsafeText('onboarding=team') are false: the Branding save accepts them (mail_admin.go:1810) and layoutSiteName keeps them. default.htm:5,34 and system.htm:9,39 print '© <year> <name>', which supplies the space; the rendered '<p>© 2026 Online=Shop</p>' matches the regex. Probe results: Send of acme.site::mail.hello (default) and acme.site::mail.notice (system) fails with 'error calling partial: postcard: rendered HTML contains event handlers' for Branding SiteName 'Online=Shop' and 'onboarding=team', and for mail.from '\"Online=Shop\" <x@example.com>' with no Branding (configuration alone, no admin action). Nothing is sent; the file version carries the same name, so there is no fallback. Editor.Validate of a template on the default layout under Branding 'Online=Shop' is refused ('draft layout: unsafe: ... © 2026 Online=Shop'). At v0.6.3 the same mail.from sent fine (default.htm printed no name). The trigger class is narrow, but it is the same failure mode the previous gap recorded, the docs promise a site name 'never stops a send' (postcard README:292, docs/services/mail.md:88), and no test covers a name whose risk depends on where it is printed (TestUnsafeText only checks names that already contain the space)."
|
||||
- truth: "The URL-scheme check of rendered HTML is anchored to URL-bearing attributes, style, comments and meta content after decoding, and javascript:/vbscript:/data: URLs are still refused at save and at send whether or not the layout opts out of inlining (35-08 must-have; D-13 as restated in .planning/notes/2026-11-14-mail-url-scheme-check.md; carried-forward CR-02 gap)"
|
||||
status: partial
|
||||
reason: "Reproduced by the verifier (overlay probes, no source change). unsafeMarkupAt (safety.go) re-checks the raw source of a raw-text element's content, but that content is what x/net/html's tokenizer reads up to the first '</style', '</noscript', '</title' or '</textarea'. If that end tag sits inside a quoted attribute value, the element ends early in the tokenizer's reading, and the rest of the start tag (' href=\"javascript:alert(1)\">x') is an outer TextToken, which is not checked. A mail client parsing the document reads the attribute quoting, so the tag is a live element. Evidence: validateHTML returns nil for '<svg><style><a title=\"</style>\" href=\"javascript:alert(1)\">x</a></style></svg>', the same with svg title/textarea, '<noscript><a title=\"</noscript>\" href=\"javascript:alert(1)\">' and '<noscript><img title=\"</noscript>\" src=x onerror=alert(1)>'. x/net/html's own parser (ParseWithOptions) reads the svg/style payload as svg:a href=javascript:alert(1) with scripting on and off, and the noscript payloads as a:href=javascript: and img onerror= with scripting off. Editor.Validate accepts a default-layout override with each of the five payloads (save). Send through that override with DisableAutoInlineCSS delivers the svg/style and noscript payloads intact. With inlining on, the inliner's side effects defuse them (premailer drops the svg style element and re-serializes the noscript remainder as escaped text). That is an incidental property of go-premailer, not the check. Template body overrides are not affected: goldmark leaves raw HTML out. The author needs the layouts permission, and whether this can be exploited depends on the client. Still, README:30 and docs/services/mail.md:158 promise that markup inside these elements is checked, the note's residual-risk list names only over-refusal, and the fixer's tests have no such case."
|
||||
artifacts:
|
||||
- path: "modules/postcard/safety.go"
|
||||
issue: "UnsafeText checks the name out of context (line 25-27); the footer context '© <year> <name>' and the header span/alt contexts are not checked"
|
||||
- path: "modules/postcard/templates.go"
|
||||
issue: "eventHandler regex (line 49) still runs over the whole rendered document, text included (line 830); it is what turns a site name into a send failure (WR-02 is the same root cause for body text)"
|
||||
- path: "modules/postcard/mailer.go"
|
||||
issue: "siteNameFrom/layoutSiteName rely on UnsafeText, so they pass an on<letters>= name into every built-in layout render, file version included"
|
||||
- path: "modules/cabana/mail_admin.go"
|
||||
issue: "MailBrandSetting.BeforeValidate (line 1810) accepts 'Online=Shop' because it reuses UnsafeText"
|
||||
issue: "unsafeMarkupAt re-reads only the tokenizer's raw-text token; a raw-text end tag inside a quoted attribute splits the start tag, and its remainder is an outer text token that is never checked"
|
||||
- path: "modules/postcard/safety_test.go"
|
||||
issue: "TestURLSchemeCheck has no payload with a raw-text end tag inside an attribute value"
|
||||
missing:
|
||||
- "Check the site name in the context the layouts print it (for example validateHTML of '<p>x '+esc+'</p><img alt=\"'+esc+'\">'), or better remove the cause: drop the whole-document eventHandler regex once the tokenizer walk covers raw-text elements (it already refuses every on* attribute), so text can never match"
|
||||
- "Regression tests: 'Online=Shop' and 'onboarding=team' through a Branding name and a mail.from display name on the default and system layouts, file-version, override and override-failure paths (TestSiteNameSend or TestUnsafeSiteNameDropped), plus TestUnsafeText and the cabana Branding save; if the regex is removed, a test that body text such as 'buy one = get one free' sends"
|
||||
- truth: "The URL-scheme check of rendered HTML is anchored to URL-bearing attributes, style, comments and meta content after decoding, and javascript:/vbscript:/data: URLs are still refused at save and at send whether or not the layout opts out of inlining (35-08 must-have; D-13 as restated in .planning/notes/2026-11-14-mail-url-scheme-check.md; WR-05)"
|
||||
status: failed
|
||||
reason: "CR-02, reproduced by the verifier (overlay probe, no source change), and a regression introduced by 35-08. unsafeMarkup (safety.go:98-145) uses xhtml.NewTokenizer without the parser, so after a noscript, title, textarea, xmp, noembed, noframes, plaintext or style start tag the rest of the element is one TextToken; only style text is inspected, and without entity decoding. Mail clients render with scripting off (noscript content is markup) and SVG/MathML title/textarea/style are foreign elements whose children are markup. Probe: validateHTML returns nil for '<noscript><a href=\"javascript:alert(1)\">', '<noscript><img src=\"x\"/onerror=alert(1)>', '<svg><title><a href=\"javascript:alert(1)\">', '<svg><textarea><a href=\"javascript:alert(1)\">', '<svg><style><a href=\"javascript:alert(1)\">' and '<xmp><a href=\"javascript:alert(1)\">'. Editor.Validate accepts a default-layout override with the noscript payload (the same payload outside noscript is refused), and Send delivers it with 'javascript:alert' intact, with inlining on and with DisableAutoInlineCSS. A template body override with the svg/title payload is sent with the URL intact too. The pre-35-08 validateHTML (75669b34) ran dangerousScheme over the whole document and refused every one of these unencoded payloads, so the gap closure weakened the D-13 guarantee. The author must hold the layouts or templates permission, and real exploitability depends on the mail client, but the phase's documented safety contract (postcard README:30, docs/services/mail.md:158) is false and the fix is local."
|
||||
artifacts:
|
||||
- path: "modules/postcard/safety.go"
|
||||
issue: "tokenizer-only walk: raw-text/RCDATA element contents are never re-tokenized; only inStyle text is checked, undecoded"
|
||||
missing:
|
||||
- "In unsafeMarkup, call z.NextIsNotRawText() after noscript, title, textarea, xmp, noembed, noframes, plaintext (and style, then check its CSS as text), or re-run unsafeMarkup on raw text of those elements; alternatively refuse noscript/plaintext/xmp outright in rawUnsafeTag"
|
||||
- "Add the six payloads above to TestURLSchemeCheck's refuses list, and a send through a layout override with inlining on and off"
|
||||
- "Also read the document as markup in a way that ignores raw-text state: for example a second tokenizer pass calling z.NextIsNotRawText() after every rawTextElements start tag (so attribute quoting decides where a tag ends), or re-check from the raw-text content start to the end of the document rather than to the tokenizer's end tag"
|
||||
- "Regression cases in TestURLSchemeCheck refuses: '<svg><style><a title=\"</style>\" href=\"javascript:alert(1)\">x</a></style></svg>', the svg title and textarea variants, '<noscript><a title=\"</noscript>\" href=\"javascript:alert(1)\">x</a></noscript>', '<noscript><img title=\"</noscript>\" src=x onerror=alert(1)></noscript>'; plus an Editor.Validate refusal and a send through a layout override with DisableAutoInlineCSS that falls back to the file version"
|
||||
- "Or, if the developer judges this acceptable (admin-authored, client-dependent), record it in the note's residual-risk section and the docs, and add an override to this file (see the report)"
|
||||
advisory:
|
||||
- finding: "WR-01 (35-REVIEW 2026-11-14): list-valued (values, srcset), meta content, style and comment checks use dangerousScheme on the unstripped decoded value, so values=\"java	script:...\" and meta content=\"0;url=java	script:...\" pass (verifier probe confirms)"
|
||||
- finding: "Outlook conditional comment with '-->' inside an attribute (<!--[if mso]><a title=\"-->\" href=\"javascript:alert(1)\">x</a><![endif]-->) passes validateHTML"
|
||||
category: security
|
||||
reason: "not a regression (the pre-35-08 whole-document regex did not match these encoded forms either); admin-authored payload; fold into the CR-02 fix by factoring stripURLSpace"
|
||||
evidence_status: "reproduced by verifier probe"
|
||||
- finding: "WR-02 (35-REVIEW): the whole-document eventHandler regex refuses ordinary text: Send with Name 'Ada, buy one = get one free' fails on default and system layouts"
|
||||
reason: "Browsers end the comment at the first '-->', so the remainder is text there; only an MSO-specific reading could differ, and Outlook's Word engine runs no script. Worth one test case if the CR-02 residual is fixed with a markup-only pass"
|
||||
evidence_status: "verifier probe (validateHTML nil); no client evidence"
|
||||
- finding: "35-REVIEW-DISPOSITION.md frontmatter still lists CR-01, CR-02, WR-01 as disposition: open (open: 9), while its table marks them fixed"
|
||||
category: other
|
||||
reason: "pre-existing since v0.6.3 and recorded as accepted residual risk in the 2026-11-14 note; it is also the root cause of the CR-01 residual gap, so removing it there closes both"
|
||||
evidence_status: "reproduced by verifier probe"
|
||||
- finding: "WR-03 (35-REVIEW): UnsafeText refuses names such as 'Data:Lab' (verifier probe: true), which the docs' 'ordinary text with a colon' sentence implies are accepted"
|
||||
reason: "Planning record inconsistency; re-run the disposition gate or edit the frontmatter"
|
||||
evidence_status: "file inspection"
|
||||
- finding: "WR-03 partial deviation: 'JavaScript: The Good Parts Club' is still refused as a site name (javascript: followed by whitespace)"
|
||||
category: other
|
||||
reason: "a refused name is dropped, not a send failure; cosmetic and documentation accuracy"
|
||||
evidence_status: "reproduced by verifier probe"
|
||||
- finding: "IN-01..IN-03 (35-REVIEW): footer Markdown body branch not exercised by the partial editor; settings.go localizes every settings model's BeforeValidate error without a README line; CSS escapes bypass CSS scheme checks (accepted residual, docs unqualified)"
|
||||
reason: "Deliberate, per the decision note ('javascript: Acme' is unsafe); a product decision for the user, not a defect. A refused name is dropped, and mail still sends"
|
||||
evidence_status: "35-REVIEW-FIX.md; code inspection"
|
||||
- finding: "35-UI-SPEC.md:427 and 35-08-PLAN.md:130 still quote the old Branding refusal copy with 'text such as onclick='"
|
||||
category: other
|
||||
reason: "info-level; none affects whether mail sends"
|
||||
reason: "Phrasebook en/pl changed in 31de2ff9; update UI-SPEC if it is a living copy contract"
|
||||
evidence_status: "35-REVIEW-FIX.md; not re-checked"
|
||||
- finding: "IN-01..IN-03 (35-REVIEW) and WR-04, WR-05, IN-04 (earlier review) remain open in the disposition record"
|
||||
category: other
|
||||
reason: "Info-level or outside the fix round; none stops a send"
|
||||
evidence_status: "code review; not re-run by verifier"
|
||||
- finding: "Earlier WR-02/WR-03/WR-04 of the 2026-11-13 review (advisory lock in request tx, swallowed TranslationWriter error, two-letter fallback rule) remain open"
|
||||
category: architectural
|
||||
reason: "outside the gap-closure diff; carried from the previous report's advisory list"
|
||||
evidence_status: "code inspection by review; no reproducing test"
|
||||
human_verified:
|
||||
- test: "Reset to file version"
|
||||
uat_row: 3
|
||||
@@ -276,213 +263,230 @@ human_verified:
|
||||
- test: "Confirm judgment-tier prohibition: postcard imports modules/lagoon/attach for AbsolutePublicURL."
|
||||
uat_row: 10
|
||||
recorded_at: "2026-11-13T21:09:53.000Z"
|
||||
human_verification: # pending human items, kept although status is gaps_found so they are not lost; run after the CR-01 residual / CR-02 gap closure
|
||||
human_verification: # pending human items, kept although status is gaps_found so they are not lost; run after the CR-02 residual is closed or overridden
|
||||
- test: "Template list"
|
||||
expected: "On the demo app rebuilt on this framework commit: Mail templates shows one row per template with a Customized locales column; opening a template shows the Language switcher under the title; switching to a locale without a file, saving it and switching back works behind the unsaved-changes confirm. Re-run UAT test 1 in full."
|
||||
why_human: "Placement and readability of the switcher and the Customized locales column in the embedded admin (35-VALIDATION Manual-Only, G-35-1)"
|
||||
why_human: "Placement and readability of the switcher and the Customized locales column in the embedded admin (35-VALIDATION Manual-Only). G-35-1 is marked resolved by 35-05/35-07 in 35-UAT.md but was never re-tested"
|
||||
retest_reason: "UAT row 1 was an issue (G-35-1); the fix (35-05, 35-07) landed after it"
|
||||
- test: "Preview"
|
||||
expected: "Scoped re-run: reset the UAT overrides of the user plugin's activate template and its layout; save Branding with a logo and a Site name; preview a template on the default and on the system layout with a body override calling {{ partial \"button\" \"url\" \"https://example.com\" \"body\" \"Go\" }}. Expect the logo header (or the name without a logo), the white card, the styled button and the footer (© year and name, printed literally)."
|
||||
why_human: "Visual rendering of the built-in layouts in the admin preview (35-VALIDATION Manual-Only, G-35-8 framework part)"
|
||||
why_human: "Visual rendering of the built-in layouts in the admin preview (35-VALIDATION Manual-Only)"
|
||||
retest_reason: "UAT row 8 was an issue (G-35-8, framework part); the fix (35-06, 35-07) landed after it"
|
||||
- test: "Customize and save a template"
|
||||
expected: "Saving a customized template still works and the saved version is sent"
|
||||
why_human: "Admin save flow in the embedded SPA"
|
||||
retest_reason: "modules/postcard/templates.go and modules/postcard/safety.go (save-time safety check) and modules/postcard/assets/default.htm changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
retest_reason: "the save-time safety check changed after the UAT pass (2026-11-13T21:09:53Z): modules/postcard/safety.go (35-08 tokenizer check, then CR-02 raw-text/comment re-check, WR-01 whitespace stripping) and modules/postcard/templates.go (WR-02 removed the handler regex)"
|
||||
- test: "Layout editor"
|
||||
expected: "Editing and saving a layout still works; an unsafe layout is refused with a line under the field"
|
||||
why_human: "Admin save flow in the embedded SPA"
|
||||
retest_reason: "modules/postcard/editor.go, templates.go and safety.go (layout validation) changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
retest_reason: "layout validation in modules/postcard/safety.go and templates.go changed after the UAT pass (2026-11-13T21:09:53Z), including the new 'nests raw-text elements or comments too deeply' refusal"
|
||||
- test: "Insert image into layout"
|
||||
expected: "An uploaded image inserted into a layout saves and previews"
|
||||
why_human: "Image picker flow in the embedded SPA"
|
||||
retest_reason: "modules/postcard/safety.go replaced the src/href check that validates the inserted img after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
retest_reason: "the src/href check that validates the inserted img was rewritten after the UAT pass (2026-11-13T21:09:53Z): tokenizer check in 35-08, stripURLSpace refactor in WR-01"
|
||||
- test: "Branding"
|
||||
expected: "Branding saves with a prose Site name; an unsafe Site name is refused with the translated message under the field (en and pl)"
|
||||
why_human: "Field-error rendering and copy in the embedded admin"
|
||||
retest_reason: "modules/cabana/mail_admin.go (BeforeValidate), modules/cabana/settings.go (error localization), phrasebook en/pl and modules/postcard/editor.go (brand preview) changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
expected: "Change a colour, set a logo and a prose Site name, Save, reload; values persist and the template preview uses them"
|
||||
why_human: "Settings form and preview in the embedded admin"
|
||||
retest_reason: "modules/cabana/mail_admin.go BeforeValidate now calls postcard.UnsafeText (35-08), whose rule changed again in CR-01 (printContext) and WR-03 (data-URL shape); modules/cabana/settings.go error localization and modules/postcard/editor.go brand preview changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
- test: "Branding refusal on the demo instance"
|
||||
expected: "On the demo app: Site name 'javascript:alert(1)' and 'data:text/html,x' are refused with the translated message under Site name (en and pl, copy without 'text such as onclick='); 'Online=Shop', 'Data:Lab' and 'Big Data: Summit' save and appear in the preview header and footer"
|
||||
why_human: "Field-error rendering and the new en/pl copy in the embedded admin; never seen by a human"
|
||||
- test: "Send test to me"
|
||||
expected: "Send test to me delivers the draft to the signed-in admin only"
|
||||
why_human: "Real delivery through the configured driver"
|
||||
retest_reason: "modules/postcard/mailer.go, templates.go and the default/system layouts and footer partial changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
retest_reason: "modules/postcard/mailer.go (site name selection), templates.go (send-time validateHTML, handler regex removed) and the default/system layouts and footer partial changed after the UAT pass (2026-11-13T21:09:53Z)"
|
||||
- test: "Review the CR-01, CR-02 and WR-02 safety-rule changes"
|
||||
expected: "Accept or reject the rule changes that 35-REVIEW-FIX.md marks 'requires human verification': (CR-01) UnsafeText checks the name where the layouts print it; (CR-02) raw-text element and comment content is re-checked as markup with an 8-level depth limit (see the open CR-02 residual gap); (WR-02) text shaped like an event handler is sent, and only attributes count as handlers. The decision note .planning/notes/2026-11-14-mail-url-scheme-check.md was amended to match"
|
||||
why_human: "Logic changes to the mail safety contract and a reversal of a documented accepted residual; the fixer asked for human sign-off"
|
||||
- test: "Inlined mail in a real inbox"
|
||||
expected: "Test-send a template in the default layout to a real webmail/Outlook inbox; the button and card keep their colours with the style block stripped"
|
||||
why_human: "Mail clients differ in what they keep of a style block; cannot be asserted by unit tests"
|
||||
- test: "Confirm judgment-tier prohibitions of 35-05..35-09"
|
||||
expected: "Accept: no sibling repository changed (sm-user-plugin and sm-paymentgateway-plugin trees clean before and after the verifier's consumers run); nothing pushed or tagged (master is 95 commits ahead of origin, newest tag v0.6.4 predates the gap closures); 35-09 changed only tests, the gate script and planning docs; framework code, docs and tests name no consuming application"
|
||||
- test: "Confirm judgment-tier prohibitions of 35-05..35-09 and the review fix round"
|
||||
expected: "Accept: no sibling repository changed (sm-user-plugin and sm-paymentgateway-plugin clean after the verifier's --consumers run); nothing pushed or tagged (master is 106 commits ahead of origin/master, newest tag v0.6.4 predates the gap closures); framework code, docs and tests name no consuming application (--marker passed)"
|
||||
why_human: "Judgment-tier prohibitions need explicit human resolution; the verifier's LLM judgment is non-authoritative"
|
||||
---
|
||||
|
||||
# Phase 35: Mail templates and layouts editor Verification Report
|
||||
|
||||
**Phase Goal:** Administrators edit every mail the application sends from the admin panel, as in WinterCMS's Mail templates screen. System mail and the templates plugins register through `pact.HasMailTemplates` appear in a list. Each template can get a database override of its subject and body, and the override can be reset to the file version. Layouts become admin-editable records assigned to templates, with a few predefined layouts seeded. Images can be uploaded and placed in layouts and templates. postcard renders the override when one exists, otherwise the plugin's file, so mail that already works keeps working.
|
||||
**Verified:** 2026-11-14T15:23:23Z
|
||||
**Verified:** 2026-11-14T16:58:10Z
|
||||
**Status:** gaps_found
|
||||
**Re-verification:** Yes. Second re-verification, after gap-closure plans 35-08 (fix) and 35-09 (tests) for the CR-01 gap of the 2026-11-13 report. The carried-forward gap got a full 3-level check; the previously passed truths got a regression check (named tests re-run). The 2026-11-14 code re-review (35-REVIEW.md, f1d22353) was checked independently against the code.
|
||||
**Re-verification:** Yes. Third re-verification, after the code-review fix round (2dbee305 CR-01, 1d481bb0 CR-02, baba524c WR-01, 31de2ff9 WR-02, 8deb56ff WR-03, 1d2e7e87 note). The two carried-forward gaps got a full check: the previous probe was re-run unchanged, and three new overlay probes were written by the verifier. The previously passed truths got a regression check (vet, the short suite once, named and Docker tests, gate stages). No repository source was modified.
|
||||
|
||||
## Goal Achievement
|
||||
|
||||
ROADMAP gives no Success Criteria for Phase 35 and `Requirements: TBD`, so must-haves are the goal's clauses (Option C) merged with the PLAN truths of 35-01..35-09. Rows 1-14 are the previous report's truths; rows 15-22 are the 35-08/35-09 truths.
|
||||
ROADMAP gives no Success Criteria for Phase 35 and `Requirements: TBD`, so the must-haves are the goal's clauses (Option C) merged with the PLAN truths of 35-01..35-09. The 22 rows are the same as in the previous report.
|
||||
|
||||
### Observable Truths
|
||||
|
||||
| # | Truth | Status | Evidence |
|
||||
| --- | --- | --- | --- |
|
||||
| 1 | Administrators edit mail from Settings → Mail (templates, layouts, partials, branding, images) | ✓ VERIFIED | Screens unchanged in shape; cabana Postgres tests pass; UAT rows 2, 5, 7, 9 passed earlier (re-test owed after 35-08 changes, see Human Verification) |
|
||||
| 2 | Templates appear one row per template (G-35-1) | ✓ VERIFIED | `TestMailLocaleGroups` PASS (re-run); visual re-run of UAT 1 owed |
|
||||
| 3 | Locale switcher; per-locale customize, reset, drift | ✓ VERIFIED | `TestMailLocaleGroups` subtests PASS (re-run) |
|
||||
| 4 | DB override of subject/body; Reset restores the file | ✓ VERIFIED | `TestOverride`, `TestFallback` PASS; UAT row 3 still valid (reset code unchanged) |
|
||||
| 5 | Layouts are editable records; default/system/minimal seeded | ✓ VERIFIED | assets present; `SyncIndex` unchanged |
|
||||
| 1 | Administrators edit mail from Settings → Mail (templates, layouts, partials, branding, images) | ✓ VERIFIED | Screens unchanged; cabana Postgres tests pass; UAT re-tests owed (Human Verification) |
|
||||
| 2 | Templates appear one row per template (G-35-1) | ✓ VERIFIED | `TestMailLocaleGroups` PASS; visual re-run of UAT 1 owed |
|
||||
| 3 | Locale switcher; per-locale customize, reset, drift | ✓ VERIFIED | `TestMailLocaleGroups` PASS |
|
||||
| 4 | DB override of subject/body; Reset restores the file | ✓ VERIFIED | `TestOverride`, `TestFallback` PASS; UAT row 3 stands (reset code untouched) |
|
||||
| 5 | Layouts are editable records; default/system/minimal seeded | ✓ VERIFIED | unchanged since previous report |
|
||||
| 6 | Built-in layouts finished (header, card, footer, button) | ✓ VERIFIED | `TestBuiltinLayoutsLogo`, `TestHeaderFooterPartials`, `TestButtonPartial` PASS |
|
||||
| 7 | Branding Site name, else mail.from display name | ✓ VERIFIED | `TestSiteName`, `TestMailBrandSiteName` PASS |
|
||||
| 8 | CSS inlined with per-layout opt-out; inliner failure never stops mail | ✓ VERIFIED | `TestInlineCSS`, `TestInlineFailure`, `TestMailLayoutInlineOptOut` PASS |
|
||||
| 9 | Images uploaded and placed in layouts and templates | ✓ VERIFIED | routes and picker unchanged since 35-03; re-test of UAT row 6 owed (src check rewritten) |
|
||||
| 10 | Override when present, else file; `<template>-<locale>` fallback | ✓ VERIFIED | `TestSendLocaleFallback`, `TestTemplateFor` PASS |
|
||||
| 11 | **Mail that already works keeps working**: no config that sends today and no admin-saved Branding value stops mail on the built-in layouts | ✗ FAILED | **CR-01 residual, reproduced.** Colon names now send, but Branding `Online=Shop`/`onboarding=team`, or mail.from `"Online=Shop" <x@example.com>` with no admin action, makes every default/system send fail: `error calling partial: postcard: rendered HTML contains event handlers`. `UnsafeText` checks the name alone; the footer's `© <year> ` adds the space the regex needs. See Gaps. |
|
||||
| 12 | `check-phase35.sh` gate: read-only consumers, new names required | ✓ VERIFIED | Verifier ran `--self-test`, `--additive` (8 packages vs v0.6.3) and `--consumers` (sibling trees clean after): all pass. `--all` not re-run by the verifier |
|
||||
| 13 | Decision notes recorded (D-05, D-10 superseded; 2026-11-14 scheme-check note) | ✓ VERIFIED | `.planning/notes/2026-11-14-mail-url-scheme-check.md` present, contains WR-05 and the residual-risk section |
|
||||
| 14 | Permission split, own-address test send, sandboxed preview | ✓ VERIFIED | no regression; `TestMailLocaleGroups/permissions_on_fallback_rows` PASS |
|
||||
| 15 | Sends on default and system succeed with mail.from `"Metadata: Weekly"` and Branding `Big Data: Summit` on file, override and override-failure paths; the name shows in header and footer | ✓ VERIFIED | `TestSiteNameSend` PASS; verifier probe `UnsafeText` false for both names |
|
||||
| 16 | A site name that would fail the safety check is left out at render with one rate-limited warning; send succeeds on every path and in the editor | ✗ FAILED | Holds for names `UnsafeText` catches (`TestUnsafeSiteNameDropped` PASS), but not for `Online=Shop`: it fails the check where it is printed, is not left out, and the send fails. Same root cause as row 11 |
|
||||
| 17 | Branding save of an unsafe name is a 422 on site_name (en/pl); template/layout saves under a stored unsafe name are not refused | ✗ FAILED | `TestMailSiteNameSafety` PASS (6 subtests, ran against Docker Postgres) for script-URL names, but `Online=Shop` saves, and then `Editor.Validate` of a template on the default layout is refused (`draft layout: unsafe: ... © 2026 Online=Shop`). Same root cause as row 11 |
|
||||
| 18 | URL-scheme check anchored to URL-bearing attributes, decoded; prose passes; `javascript:` URLs refused at save and send, inlining on or off | ✗ FAILED | Prose and encoded `href` forms correct (`TestURLSchemeCheck` PASS). **CR-02, reproduced:** `javascript:` inside `<noscript>`, `<xmp>`, SVG `<title>`/`<textarea>`/`<style>` passes `validateHTML` and `Editor.Validate`, and `Send` delivers it intact with inlining on and off. The pre-35-08 check refused these, so this is a regression. See Gaps |
|
||||
| 9 | Images uploaded and placed in layouts and templates | ✓ VERIFIED | routes and picker unchanged; UAT 6 re-test owed |
|
||||
| 10 | Override when present, else file; `<template>-<locale>` fallback | ✓ VERIFIED | `TestSendLocaleFallback`, `TestTemplateFor`, `TestMailOverrideSmoke/locale_fallback` PASS |
|
||||
| 11 | **Mail that already works keeps working**: no config that sends today and no admin-saved Branding value stops mail on the built-in layouts | ✓ VERIFIED | **Gap closed.** Re-run probe: Branding and mail.from `Online=Shop`/`onboarding=team` send on default and system (8 × `err=<nil>`); `Name: "Ada, buy one = get one free"` sends on both. The handler regex is gone from `templates.go` (`grep eventHandler` finds nothing). `TestSiteNameSend` (incl. `handler_shaped_variable`) PASS |
|
||||
| 12 | `check-phase35.sh` gate: read-only consumers, new names required | ✓ VERIFIED | Verifier ran `--self-test`, `--docs`, `--marker`, `--additive` (8 packages vs v0.6.3), `--consumers`: all exit 0 |
|
||||
| 13 | Decision notes recorded | ✓ VERIFIED | `.planning/notes/2026-11-14-mail-url-scheme-check.md` amended (1d2e7e87) with an Amendment section |
|
||||
| 14 | Permission split, own-address test send, sandboxed preview | ✓ VERIFIED | no regression; `TestMailLocaleGroups` PASS |
|
||||
| 15 | Sends with mail.from `"Metadata: Weekly"` / Branding `Big Data: Summit` on every path; name in header and footer | ✓ VERIFIED | `TestSiteNameSend` PASS; probe `UnsafeText` false for both |
|
||||
| 16 | An unsafe site name is left out at render with one rate-limited warning; send succeeds on every path and in the editor | ✓ VERIFIED | **Gap closed.** `TestUnsafeSiteNameDropped` PASS; `Online=Shop` is no longer unsafe (probe `UnsafeText` false) and is printed, so no class of name breaks a render |
|
||||
| 17 | Branding save of an unsafe name is a 422 on site_name (en/pl); template/layout saves under a stored name are not refused | ✓ VERIFIED | **Gap closed.** `TestMailSiteNameSafety` PASS against Docker Postgres, 7 subtests incl. `handler_shaped_name_sends`; probe `Editor.Validate` of both fixture templates under Branding `Online=Shop` = `<nil>` |
|
||||
| 18 | URL-scheme check anchored to URL-bearing attributes, decoded; prose passes; `javascript:` URLs refused at save and send, inlining on or off | ✗ FAILED (partial) | The six CR-02 payloads and the WR-01 encodings are now refused, and the noscript layout override falls back with inlining on and off. **CR-02 residual, reproduced by the verifier:** if a raw-text end tag sits inside a quoted attribute (`<svg><style><a title="</style>" href="javascript:alert(1)">`, the same for svg title/textarea and noscript), the check passes. x/net/html's parser reads it as a live `svg:a href=javascript:`. `Editor.Validate` accepts it, and a layout that opts out of inlining sends it intact. See Gaps |
|
||||
| 19 | An inlined result that fails the check is sent as its style-block version with a warning | ✓ VERIFIED | `TestInlineUnsafeOutput` PASS |
|
||||
| 20 | Footer prints the site name literally (WR-01) | ✓ VERIFIED | `TestFooterSiteNameLiteral` PASS; `footer.htm` `{{ if .text }}<p>{{ .text }}</p>` and layouts pass `"text" $copy` |
|
||||
| 21 | sm-user-plugin and sm-paymentgateway-plugin mail tests pass read-only | ✓ VERIFIED | `--consumers` passed, both trees clean |
|
||||
| 22 | 35-07 pin subtest gone; gate requires new names; IN-03 self-test uses `cmp` | ✓ VERIFIED | `unsafe_name_current_behaviour` not found in modules/; 8 new names in `check-phase35.sh`; `cmp -s` at line 621; `--self-test` passed |
|
||||
| 20 | Footer prints the site name literally | ✓ VERIFIED | `TestFooterSiteNameLiteral` PASS |
|
||||
| 21 | sm-user-plugin and sm-paymentgateway-plugin mail tests pass read-only | ✓ VERIFIED | `--consumers` passed, both trees clean after |
|
||||
| 22 | 35-07 pin subtest gone; gate requires new names; IN-03 self-test uses `cmp` | ✓ VERIFIED | `--self-test` passed |
|
||||
|
||||
**Score:** 18/22 truths verified (0 present, behavior-unverified). The four failures share two root causes: rows 11, 16 and 17 come from the site-name context gap, and row 18 from the raw-text bypass.
|
||||
**Score:** 21/22 truths verified (0 present, behavior-unverified). The CR-01 residual root cause is gone. One root cause remains: the CR-02 raw-text re-check is bounded by the tokenizer's reading of where the element ends.
|
||||
|
||||
### Deferred Items
|
||||
|
||||
| # | Item | Addressed In | Evidence |
|
||||
|---|------|-------------|----------|
|
||||
| 1 | G-35-8 plugin part: user and paymentgateway plugin CTAs through the button partial, finished plugin layouts, framework bump | Plugin follow-up after the framework tag (user decision 2026-11-13; no roadmap phase) | 35-06-PLAN "Follow-ups", 35-UAT G-35-8 `closure_note`. Informational, not a gap |
|
||||
| 1 | G-35-8 plugin part: user and paymentgateway plugin CTAs through the button partial, finished plugin layouts, framework bump | Plugin follow-up after the framework tag (user decision 2026-11-13; no roadmap phase) | 35-06-PLAN "Follow-ups", 35-UAT G-35-8. Informational |
|
||||
|
||||
No later roadmap phase covers the two gaps. Phase 35 is the last numbered phase; only backlog phases 999.x follow, and none is about mail safety.
|
||||
No later roadmap phase covers the remaining gap: Phase 35 is the last numbered phase, and backlog 999.1/999.2 are newsletter and SEO work.
|
||||
|
||||
### Advisory (New Scope, Unevidenced)
|
||||
|
||||
| # | Finding | Category | Why Advisory |
|
||||
|---|---------|----------|--------------|
|
||||
| 1 | WR-01 (new review): `values`/`meta content`/style/comment checks skip whitespace stripping (`java	script:` passes) | security | Reproduced, but not a regression (the old regex missed it too); fold into the CR-02 fix |
|
||||
| 2 | WR-02 (new review): whole-document handler regex refuses body text such as `buy one = get one free` | other | Reproduced; pre-existing since v0.6.3 and accepted in the 2026-11-14 note. It is also the root cause of the row 11 gap |
|
||||
| 3 | WR-03 (new review): `UnsafeText("Data:Lab")` is true | other | Reproduced; a refused name is dropped, mail still sends |
|
||||
| 4 | IN-01..IN-03 (new review) | other | Info-level, no send impact |
|
||||
| 5 | Earlier WR-02/03/04 (2026-11-13 review) | architectural | Outside the gap-closure diff, still open |
|
||||
| 1 | Conditional comment with `-->` inside an attribute passes `validateHTML` | security | Browsers end the comment at the first `-->`; no client evidence of a different reading |
|
||||
| 2 | 35-REVIEW-DISPOSITION.md frontmatter says CR-01/CR-02/WR-01 `open`, while its table says `fixed` | other | Planning-record inconsistency |
|
||||
| 3 | WR-03 deviation: `JavaScript: The Good Parts Club` still refused | other | Deliberate per the note; product decision; the name is dropped, mail sends |
|
||||
| 4 | 35-UI-SPEC.md:427, 35-08-PLAN.md:130 quote the old copy | other | Copy contract drift |
|
||||
| 5 | IN-01..IN-03, WR-04, WR-05, IN-04 open | other | Info-level or outside the fix round |
|
||||
|
||||
### Required Artifacts
|
||||
|
||||
| Artifact | Expected | Status | Details |
|
||||
| -------- | -------- | ------ | ------- |
|
||||
| `modules/postcard/safety.go` | tokenizer scheme check, `func UnsafeText` | ⚠️ substantive with defects | exists, wired from `validateHTML` (templates.go:833), `siteNameFrom` (mailer.go:200) and cabana (mail_admin.go:1810); carries both gaps |
|
||||
| `modules/postcard/safety_smoke_test.go` | `TestMailSafetySmoke` | ✓ VERIFIED | passes |
|
||||
| `.planning/notes/2026-11-14-mail-url-scheme-check.md` | decision note, WR-05 | ✓ VERIFIED | present |
|
||||
| `modules/postcard/assets/partials/footer.htm` | `.text` argument | ✓ VERIFIED | plain-text branch in both sections |
|
||||
| `modules/postcard/sitename_test.go` | `TestUnsafeSiteNameDropped` etc. | ✓ VERIFIED (incomplete coverage) | passes; has no case for a name that is only unsafe in context |
|
||||
| `modules/postcard/safety_test.go` | `TestURLSchemeCheck` | ✓ VERIFIED (incomplete coverage) | passes; no raw-text-element payloads |
|
||||
| `modules/cabana/mail_site_name_postgres_test.go` | `TestMailSiteNameSafety` | ✓ VERIFIED | 6 subtests PASS |
|
||||
| `scripts/check-phase35.sh` | requires new names | ✓ VERIFIED | contains `TestMailSiteNameSafety` and the others |
|
||||
| Earlier artifacts (store, templates, inline, layouts, LocaleVariantSwitcher, dist) | | ✓ VERIFIED | no regression; dist, admin and go.mod unchanged since 75669b34 |
|
||||
| `modules/postcard/safety.go` | tokenizer check, raw-text/comment re-check, `stripURLSpace`, `printContext`, `UnsafeText` | ⚠️ substantive with one defect | wired from `validateHTML` (templates.go), `siteNameFrom` (mailer.go) and cabana `BeforeValidate`; carries the CR-02 residual |
|
||||
| `modules/postcard/templates.go` | `validateHTML` without the whole-document handler regex | ✓ VERIFIED | `rawUnsafeTag` then `unsafeMarkup`; no `eventHandler` |
|
||||
| `modules/postcard/safety_test.go` | `TestURLSchemeCheck` with CR-02/WR-01 cases | ✓ VERIFIED (incomplete coverage) | PASS; no end-tag-inside-attribute case |
|
||||
| `modules/postcard/sitename_test.go` | `TestSiteNameSend` with `Online=Shop`, handler-shaped variable | ✓ VERIFIED | PASS |
|
||||
| `modules/cabana/mail_site_name_postgres_test.go` | `handler_shaped_name_sends` | ✓ VERIFIED | 7 subtests PASS (Docker) |
|
||||
| `modules/postcard/override_smoke_test.go` | fallback via Markdown `data:` image | ✓ VERIFIED | `TestMailOverrideSmoke/fallback` PASS (Docker) |
|
||||
| phrasebook en/pl, README, docs/services/mail.md | copy and contract updated | ✓ VERIFIED | `--docs` passed; docs promise raw-text content is checked (see gap) |
|
||||
| Earlier artifacts | | ✓ VERIFIED | admin/, boardwalk/dist, pact, go.mod/go.sum unchanged since 980ba487 |
|
||||
|
||||
### Key Link Verification
|
||||
|
||||
| From | To | Via | Status | Details |
|
||||
| ---- | --- | --- | ------ | ------- |
|
||||
| `postcard/templates.go` | `postcard/safety.go` | `validateHTML` → `unsafeMarkup` | ✓ WIRED | templates.go:833; the raw `eventHandler` check still runs first (line 830) |
|
||||
| `postcard/mailer.go` | `postcard/safety.go` | `layoutSiteName` → `siteNameFrom` → `UnsafeText` | ✓ WIRED | mailer.go:158, 200, 215; editor.go:330 |
|
||||
| `cabana/mail_admin.go` | `postcard/safety.go` | `BeforeValidate` → `postcard.UnsafeText` | ✓ WIRED | mail_admin.go:1810 |
|
||||
| `assets/default.htm`, `system.htm` | `partials/footer.htm` | `partial "footer" "text" $copy` | ✓ WIRED | default.htm:5,34; system.htm:9,39 |
|
||||
| `scripts/check-phase35.sh` | new tests | GO_TESTS / DOCKER_TESTS names | ✓ WIRED | 8 names present |
|
||||
| Earlier links (35-01..35-07) | | | ✓ WIRED | unchanged; regression tests pass |
|
||||
| `postcard/templates.go` | `postcard/safety.go` | `validateHTML` → `unsafeMarkup` → `unsafeMarkupAt` (recursive) | ✓ WIRED | only `rawUnsafeTag` runs first now |
|
||||
| `postcard/safety.go` | `printContext` | `UnsafeText` → `validateHTML(printContext(esc))` | ✓ WIRED | |
|
||||
| `postcard/mailer.go` | `postcard/safety.go` | `layoutSiteName` → `siteNameFrom` → `UnsafeText` | ✓ WIRED | |
|
||||
| `cabana/mail_admin.go` | `postcard/safety.go` | `BeforeValidate` → `postcard.UnsafeText` | ✓ WIRED | |
|
||||
| Earlier links (35-01..35-09) | | | ✓ WIRED | regression tests pass |
|
||||
|
||||
### Data-Flow Trace (Level 4)
|
||||
|
||||
| Artifact | Data Variable | Source | Produces Real Data | Status |
|
||||
| -------- | ------------- | ------ | ------------------ | ------ |
|
||||
| Layout header/footer | `siteName` | Branding row / mail.from via `siteNameFrom` | Yes | ✓ FLOWING (an `on<letters>=` name still breaks the render: row 11) |
|
||||
| Layout header/footer | `siteName` | Branding row / mail.from via `siteNameFrom` | Yes | ✓ FLOWING (handler-shaped names now render) |
|
||||
| Branding refusal | `site_name` | form → `BeforeValidate` → `UnsafeText` | Yes | ✓ FLOWING |
|
||||
| Earlier flows (list, switcher, fallback send, inlined HTML) | | | Yes | ✓ FLOWING |
|
||||
| Earlier flows | | | Yes | ✓ FLOWING |
|
||||
|
||||
### Behavioral Spot-Checks
|
||||
|
||||
| Behavior | Command | Result | Status |
|
||||
| -------- | ------- | ------ | ------ |
|
||||
| vet | `go vet ./modules/postcard ./modules/cabana` | clean | ✓ PASS |
|
||||
| Full short suite | `go test -short ./...` (once) | all ok | ✓ PASS |
|
||||
| postcard gap-closure and regression tests | `go test -short ./modules/postcard -run '^(TestSiteNameSend\|TestUnsafeSiteNameDropped\|TestUnsafeText\|TestFooterSiteNameLiteral\|TestURLSchemeCheck\|TestInlineUnsafeOutput\|TestMailSafetySmoke\|TestInlineCSS\|TestInlineFailure\|TestOverride\|TestFallback\|TestTemplateFor\|TestSendLocaleFallback\|TestBuiltinLayoutsLogo\|TestHeaderFooterPartials\|TestButtonPartial\|TestSiteName)$'` | ok | ✓ PASS |
|
||||
| cabana Postgres (Docker) | `go test ./modules/cabana -run '^(TestMailSiteNameSafety\|TestMailBrandSiteName\|TestMailLocaleGroups\|TestMailLayoutInlineOptOut)$'`; `-v` confirms TestMailSiteNameSafety ran 6 subtests | ok | ✓ PASS |
|
||||
| Gate stages | `check-phase35.sh --self-test`, `--additive`, `--consumers` | all passed | ✓ PASS |
|
||||
| CR-01 residual probe | overlay test (scratchpad): `UnsafeText`, Send on default/system with Branding and mail.from `Online=Shop`/`onboarding=team` | `UnsafeText` false; all 8 sends fail `rendered HTML contains event handlers` | ✗ FAIL (gap) |
|
||||
| CR-02 probe | overlay test: `validateHTML`, `Editor.Validate` and Send through a default-layout override with noscript and svg/title payloads, inlining on/off | `validateHTML` nil for 6 payloads; Validate accepts; sent HTML contains `javascript:alert` in all 4 sends; control payload outside noscript refused | ✗ FAIL (gap) |
|
||||
| Regression baseline | `git show 75669b34:modules/postcard/templates.go` | old `validateHTML` ran `dangerousScheme` over the whole document, so it refused these payloads | confirms regression |
|
||||
| vet | `go vet ./...` | clean | ✓ PASS |
|
||||
| Full short suite (once) | `go test -short ./...` | all ok | ✓ PASS |
|
||||
| postcard named tests | `go test -short ./modules/postcard -run '^(TestSiteNameSend\|TestUnsafeSiteNameDropped\|TestUnsafeText\|TestFooterSiteNameLiteral\|TestURLSchemeCheck\|TestInlineUnsafeOutput\|TestMailSafetySmoke\|TestInlineCSS\|TestInlineFailure\|TestOverride\|TestFallback\|TestTemplateFor\|TestSendLocaleFallback\|TestBuiltinLayoutsLogo\|TestHeaderFooterPartials\|TestButtonPartial\|TestSiteName)$'` | 17 PASS | ✓ PASS |
|
||||
| cabana Postgres (Docker) | `go test ./modules/cabana -run '^(TestMailSiteNameSafety\|TestMailBrandSiteName\|TestMailLocaleGroups\|TestMailLayoutInlineOptOut)$' -v` | PASS; TestMailSiteNameSafety ran 7 subtests | ✓ PASS |
|
||||
| postcard Docker smoke | `go test ./modules/postcard -run '^TestMailOverrideSmoke$' -v` | `fallback`, `locale_fallback` PASS | ✓ PASS |
|
||||
| Gate stages | `check-phase35.sh --self-test`, `--docs`, `--marker`, `--additive`, `--consumers` | all exit 0 | ✓ PASS |
|
||||
| Previous probe (re-run) | `go test -short -overlay .../scratchpad/probe/overlay.json ./modules/postcard -run TestZZVerifier -v` | CR-01: 8 sends + 2 prose sends `err=<nil>`; CR-02: all 9 payloads refused; noscript layout falls back (inline on/off); `Editor.Validate` refuses noscript layout; accepts templates under `Online=Shop` | ✓ PASS (gaps closed) |
|
||||
| svg/title "containsJS" claim | probe2 `TestZZV2BodySend` | sent HTML holds `<a href="javascript:...` (escaped text, raw HTML omitted by goldmark). Fixer's explanation confirmed | ✓ PASS |
|
||||
| CR-02 residual (new) | probe2 `TestZZV2Validate`/`TestZZV2LayoutSend` (overlay2.json) | `validateHTML` nil for 8 end-tag-in-attribute payloads; `Editor.Validate` accepts 5 of 5 in a layout; with `DisableAutoInlineCSS` the noscript and svg/style payloads are sent with `href="javascript:alert(1)"` intact | ✗ FAIL (gap) |
|
||||
| Parser reading of the residual | probe3 `TestZZV3Parse` (overlay3.json), `xhtml.ParseWithOptions` | svg/style → `svg:a href=javascript:alert(1)` with scripting on and off; noscript → `a href=javascript:` and `img onerror=` with scripting off | confirms live markup |
|
||||
| Inlining on | probe4 `TestZZV4InlineOn` (overlay4.json) | premailer removes the svg style element; noscript remainder re-serialized as escaped text; no live href sent | incidental mitigation |
|
||||
|
||||
Probe files (scratchpad, not in the repo): `/tmp/claude-1000/-media-nvme-dev-golem15-summercms-io-summercms-summercms-go/0c86abd1-8e0c-485b-8ad1-fd321a8a0fda/scratchpad/probe/zz_verifier_probe_test.go`, `zz_verifier_probe2_test.go`, `zz_verifier_probe3_test.go`, `zz_verifier_probe4_test.go` in the same directory, with `overlay.json` .. `overlay4.json`.
|
||||
|
||||
### Probe Execution
|
||||
|
||||
No `scripts/*/tests/probe-*.sh` is declared or present for this phase, so this step is N/A. The phase gate stages above were run directly.
|
||||
No `scripts/*/tests/probe-*.sh` is declared or present for this phase, so this step is N/A. The phase gate stages and the verifier's overlay probes above were run directly.
|
||||
|
||||
### Requirements Coverage
|
||||
|
||||
REQUIREMENTS.md has no row naming Phase 35 (`grep -c "Phase 35"` = 0) and no `CR-01`/`WR-01`/`WR-05` IDs. The plan `requirements:` values are review and decision IDs:
|
||||
REQUIREMENTS.md has no row naming Phase 35 (`grep -c "Phase 35"` = 0). Plan `requirements:` values are review and decision IDs:
|
||||
|
||||
| Requirement | Source Plan | Description | Status | Evidence |
|
||||
| ----------- | ---------- | ----------- | ------ | -------- |
|
||||
| CR-01 | 35-08, 35-09 | site name never stops mail | ✗ BLOCKED (partly) | colon and script-URL classes closed; `on<letters>=` class still stops mail (row 11) |
|
||||
| CR-01 | 35-08, 35-09, fix 2dbee305/31de2ff9 | site name never stops mail | ✓ SATISFIED | rows 11, 16, 17 |
|
||||
| WR-01 (2026-11-13) | 35-08, 35-09 | literal footer | ✓ SATISFIED | row 20 |
|
||||
| WR-05 | 35-08, 35-09 | decoded scheme check; inliner never stops mail | ✗ BLOCKED (partly) | encoding and inliner parts satisfied; raw-text bypass regressed (row 18) |
|
||||
| D-13 | 35-08 | unsafe URLs refused at save and send | ✗ BLOCKED | CR-02 |
|
||||
| D-10, D-14 | 35-08 | Branding rules; a failing override never stops mail | ✗ BLOCKED (partly) | row 11 (file-version fallback fails as well) |
|
||||
| WR-05 | 35-08, 35-09 | decoded scheme check; inliner never stops mail | ✗ BLOCKED (partly) | encoding and inliner parts satisfied; opt-out layouts can ship the CR-02 residual payload |
|
||||
| D-13 | 35-08 | unsafe URLs refused at save and send | ✗ BLOCKED (partly) | CR-02 residual (row 18) |
|
||||
| D-10, D-14 | 35-08 | Branding rules; a failing override never stops mail | ✓ SATISFIED | rows 11, 17 |
|
||||
| D-21 | 35-09 | tests last, gate | ✓ SATISFIED | gate stages pass |
|
||||
| Earlier D-01..D-25, G-35-1, G-35-8 | 35-01..07 | | ✓ SATISFIED | unchanged from the previous report |
|
||||
| Earlier D-01..D-25, G-35-1, G-35-8 | 35-01..07 | | ✓ SATISFIED | unchanged; G-35-1/G-35-8 still need the UAT re-test |
|
||||
| Orphaned | — | — | none | no REQUIREMENTS.md row maps to Phase 35 |
|
||||
|
||||
### Anti-Patterns Found
|
||||
|
||||
| File | Line | Pattern | Severity | Impact |
|
||||
| ---- | ---- | ------- | -------- | ------ |
|
||||
| 25 non-planning files changed in 75669b34..HEAD | — | TBD/FIXME/XXX | none found | — |
|
||||
| `modules/postcard/safety.go` | 25-27 | site name checked out of print context | 🛑 Blocker | row 11 (carried-forward gap) |
|
||||
| `modules/postcard/templates.go` | 49, 830 | whole-document `\son[a-z]+\s*=` over text | 🛑 Blocker (same root cause) | turns the footer text into a send failure |
|
||||
| `modules/postcard/safety.go` | 98-145 | tokenizer without `NextIsNotRawText`; raw-text contents unchecked | 🛑 Blocker | row 18; file created after the previous `verified:` timestamp, and the verifier's probe is deterministic evidence |
|
||||
| `modules/postcard/safety.go` | 122-124, 136, 140 | `dangerousScheme` on unstripped values | ⚠️ Warning | advisory 1 |
|
||||
| 11 non-planning files changed in 980ba487..HEAD | — | TBD/FIXME/XXX/TODO/HACK in added lines | none found | — |
|
||||
| `modules/postcard/safety.go` | `unsafeMarkupAt`, TextToken branch | re-check bounded by the tokenizer's raw-text end; text after a split start tag unchecked | 🛑 Blocker | row 18. This is the carried-forward CR-02 gap, the file was modified after the previous `verified:` timestamp, and the verifier's probes are deterministic evidence, so the re-verification evidence gate keeps it blocking |
|
||||
|
||||
### Prohibitions
|
||||
|
||||
| Statement (plan) | Tier | Verdict | Flag |
|
||||
| --------- | ---- | ------- | ---- |
|
||||
| pact/postcard/cabana API changes additive only (35-08) | automated | Holds: `--additive` passes against v0.6.3; `modules/pact` unchanged since 75669b34 | none |
|
||||
| No new dependency, go.mod/go.sum unchanged (35-08, 35-09) | automated | Holds: empty diff since 75669b34 | none |
|
||||
| admin/ and boardwalk/dist unchanged (35-08) | automated | Holds: empty diff since 75669b34 | none |
|
||||
| Tests and gate never write a sibling repository (35-09) | automated | Holds: both trees clean after `--consumers` | none |
|
||||
| No sibling repository changed (35-08) | judgment | Holds (LLM, non-authoritative) | unverified-prohibition, human review recommended |
|
||||
| Nothing pushed or tagged (35-08, 35-09) | judgment | Holds: 95 ahead of origin/master, newest tag v0.6.4 | unverified-prohibition, human review recommended |
|
||||
| 35-09 changes no production code | judgment | Holds per diff of 35-09 commits (tests, gate, validation doc) | unverified-prohibition, human review recommended |
|
||||
| Framework code, docs, tests name no consuming application (35-08) | judgment | Holds: no consumer names in the 25 changed files | unverified-prohibition, human review recommended |
|
||||
| pact/postcard/cabana API changes additive only | automated | Holds: `--additive` passes against v0.6.3 | none |
|
||||
| No new dependency, go.mod/go.sum unchanged | automated | Holds: empty diff since 980ba487 | none |
|
||||
| admin/ and boardwalk/dist unchanged (35-08) | automated | Holds: empty diff since 980ba487 | none |
|
||||
| Tests and gate never write a sibling repository | automated | Holds: both trees clean after `--consumers` | none |
|
||||
| No sibling repository changed | judgment | Holds (LLM, non-authoritative) | unverified-prohibition, human review recommended |
|
||||
| Nothing pushed or tagged | judgment | Holds: 106 ahead of origin/master, newest tag v0.6.4 | unverified-prohibition, human review recommended |
|
||||
| Framework code, docs, tests name no consuming application | judgment | Holds: `--marker` passed; no consumer names in the changed files | unverified-prohibition, human review recommended |
|
||||
| postcard does not import lagoon (35-01) | judgment | Deviates (`lagoon/attach`) | resolved: accepted in UAT row 10 |
|
||||
|
||||
### Human Verification Required
|
||||
|
||||
UAT rows 3, 4 and 10 stand as human evidence: the reset, drift and import code they exercised did not change. Rows 2, 5, 6, 7 and 9 passed before 35-08 changed the safety check, the editor, the Branding save path, the mailer and the layouts, so each carries a `retest_reason`. Rows 1 and 8 are still open issues from the first UAT. All items should run after the gaps below are closed:
|
||||
UAT rows 3, 4 and 10 stand as human evidence: the reset, drift and import code they exercised did not change. Rows 1 and 8 were issues whose fixes (35-05..35-07) were never re-tested. Rows 2, 5, 6, 7 and 9 passed before the safety check, the Branding save path, the mailer and the layouts changed, so each has a `retest_reason`. Run them after the gap below is closed or overridden:
|
||||
|
||||
1. **Template list** (UAT 1 re-run): one row per template, Language switcher, unsaved-changes confirm.
|
||||
2. **Preview** (UAT 8 scoped re-run): logo or name header, card, button, literal © footer on default and system.
|
||||
1. **Template list** (UAT 1 re-run, G-35-1).
|
||||
2. **Preview** (UAT 8 scoped re-run, G-35-8): logo or name header, card, button, literal © footer on default and system.
|
||||
3. **Customize and save a template**: re-test (save-time check changed).
|
||||
4. **Layout editor**: re-test (layout validation changed).
|
||||
5. **Insert image into layout**: re-test (src check rewritten).
|
||||
6. **Branding**: re-test; also check the translated refusal under Site name in en and pl.
|
||||
7. **Send test to me**: re-test (mailer and layouts changed).
|
||||
8. **Inlined mail in a real inbox**: colours survive when the style block is stripped.
|
||||
9. **Judgment-tier prohibitions of 35-05..35-09**: accept or reject.
|
||||
6. **Branding**: re-test of UAT 7.
|
||||
7. **Branding refusal on the demo instance**: script/data names refused with the new en/pl copy; `Online=Shop`, `Data:Lab`, `Big Data: Summit` saved and shown.
|
||||
8. **Send test to me**: re-test (mailer, validateHTML and layouts changed).
|
||||
9. **CR-01, CR-02, WR-02 safety-rule changes**: accept or reject, as 35-REVIEW-FIX.md requests.
|
||||
10. **Inlined mail in a real inbox**: colours survive when the style block is stripped.
|
||||
11. **Judgment-tier prohibitions**: accept or reject.
|
||||
|
||||
### Gaps Summary
|
||||
|
||||
The 2026-11-13 gap is closed for the cases it named. "Metadata: Weekly" and "Big Data: Summit" now send. Script-URL names are dropped at render and refused on the Branding form, and the footer prints the name literally. The 35-REVIEW.md re-review is right on both critical findings; the verifier reproduced each with overlay probes and changed no source file.
|
||||
The fix round closed the CR-01 residual at its cause. The whole-document handler regex is gone, so text, including a site name such as `Online=Shop` printed after `© <year> ` and a variable such as `buy one = get one free`, can no longer stop a send. The re-run probe and the new tests confirm this on the default and system layouts, from Branding and from `mail.from`, and through the editor. The goal clause "mail that already works keeps working" now holds. WR-01 and WR-03 are fixed as well.
|
||||
|
||||
1. **CR-01 residual (goal-blocking, carried forward).** The goal clause "mail that already works keeps working" is still false for one class of names. `UnsafeText` checks the site name on its own, but the layouts print it after `© <year> `. A name that begins with `on<letters>=`, such as `Online=Shop` or `onboarding=team`, passes the check and is saved. In the footer it then matches the whole-document handler regex, and every send on the default and system layouts fails, file-version fallback included. Template saves on those layouts are refused too. The trigger can be a `mail.from` display name with no admin action, which is the failure mode the previous gap described. The class is narrow, but the failure is total, and the docs promise that a site name never stops a send. Fixing it means checking the name in its print context. Better: remove the raw `eventHandler` regex once the tokenizer covers raw-text elements, which also resolves WR-02.
|
||||
One gap remains: the **CR-02 residual** (row 18, partial). The fix re-checks a raw-text element's content as markup, but only the content up to where x/net/html's tokenizer ends that element. When the matching end tag appears inside a quoted attribute value, as in `<svg><style><a title="</style>" href="javascript:alert(1)">x</a></style></svg>`, the tokenizer ends the element early. The remainder of the tag, `href="javascript:alert(1)">`, then reaches the outer loop as plain text and is never checked. A conforming parser keeps the attribute together and builds a live `svg:a` link (and, with scripting off, live noscript links and handlers). `Editor.Validate` accepts such a layout. A layout that opts out of inlining sends it intact. With inlining on, go-premailer's re-serialization happens to defuse it, and template bodies are safe because Markdown leaves raw HTML out. This is the same threat class and the same exposure as CR-02: the author needs the layouts permission, and impact depends on the client. The README and docs/services/mail.md say this markup is checked, and the residual-risk notes do not mention it.
|
||||
|
||||
2. **CR-02 (regression introduced by 35-08, blocks a 35-08 must-have and D-13).** Replacing the whole-document scheme regex with a bare tokenizer hides `<noscript>`, `<xmp>` and SVG `<title>`/`<textarea>`/`<style>` contents from the check. Unencoded `javascript:` links inside them now pass save validation and are sent intact, with inlining on and off. The pre-35-08 check refused them. Only an administrator with the layouts or templates permission can author such a payload, and whether it can be exploited depends on the mail client, so on its own it does not stop an administrator from editing mail. It is still a weakening of the phase's documented safety contract, introduced by the gap closure itself. The fix sits in the same function (`z.NextIsNotRawText()` after those tags, plus whitespace stripping for WR-01).
|
||||
The fix is local to `unsafeMarkupAt`: add a markup reading that does not honour raw-text state (`z.NextIsNotRawText()` after each raw-text start tag, as a second pass), plus the five payloads as regression cases, an `Editor.Validate` refusal and an opt-out-layout send that falls back. That is one small fix plan plus a tests plan (the project rule puts tests last). If the developer accepts the residual instead, record it in the note's residual-risk section and the docs, then add an override:
|
||||
|
||||
Both fixes are in `modules/postcard/safety.go` and `templates.go`, with tests in `sitename_test.go`/`safety_test.go` and the cabana site-name test. One gap-closure plan for the fix plus a tests plan (the project rule puts tests last) would cover them. No later phase covers either gap. Everything else verified in the previous report still holds on fresh test runs.
|
||||
```yaml
|
||||
overrides:
|
||||
- must_have: "The URL-scheme check of rendered HTML is anchored to URL-bearing attributes, style, comments and meta content after decoding, and javascript:/vbscript:/data: URLs are still refused at save and at send whether or not the layout opts out of inlining"
|
||||
reason: "Raw-text end tag inside an attribute (svg style/title/textarea, noscript) accepted as residual risk: admin-authored layouts only, client-dependent; documented in .planning/notes/2026-11-14-mail-url-scheme-check.md"
|
||||
accepted_by: "{name}"
|
||||
accepted_at: "{ISO timestamp}"
|
||||
```
|
||||
|
||||
With the gap closed or overridden, every automated check passes, and the status would be `human_needed` for the 11 items above.
|
||||
|
||||
---
|
||||
|
||||
_Verified: 2026-11-14T15:23:23Z_
|
||||
_Verified: 2026-11-14T16:58:10Z_
|
||||
_Verifier: Claude (msd-verifier)_
|
||||
|
||||
Reference in New Issue
Block a user