fix(35): WR-02 drop the whole-document event-handler regex
validateHTML ran (?i)\son[a-z]+\s*= over the rendered document, text included, so a variable such as "buy one = get one free" stopped its own message, and it is what made Online=Shop in the footer a send failure. The tokenizer walk refuses every on* attribute, and since CR-02 it also reads raw-text element and comment content as markup, so the regex is dropped. Text shaped like a handler is now sent; such site names are shown and saved, and the Branding refusal copy no longer mentions onclick=.
This commit is contained in:
@@ -29,6 +29,10 @@ func TestURLSchemeCheck(t *testing.T) {
|
||||
{"textarea_escaped_link", `<textarea><a href="javascript:x"></textarea>`},
|
||||
{"title_escaped_link", `<svg><title><a href="javascript:x"></title></svg>`},
|
||||
{"noscript_safe_link", `<noscript><a href="https://example.com/">Open</a></noscript>`},
|
||||
// Text shaped like an event handler is text (WR-02).
|
||||
{"prose_handler_shaped", `<p>Ada, buy one = get one free, online = yes</p>`},
|
||||
{"footer_handler_shaped_name", `<p>© 2026 Online=Shop</p>`},
|
||||
{"title_escaped_handler", `<svg><title><img onerror=x></title></svg>`},
|
||||
{"outlook_conditional_vml", `<!--[if mso]><v:roundrect href="https://example.com/" style="height:40px"><w:anchorlock/></v:roundrect><![endif]-->`},
|
||||
}
|
||||
for _, tc := range accepts {
|
||||
@@ -67,6 +71,7 @@ func TestURLSchemeCheck(t *testing.T) {
|
||||
{"entity_first_letter", `<a href="javascript:alert(1)">x</a>`, `javascript:alert(1)`, schemeMsg},
|
||||
{"tab_split", `<a href="java	script:alert(1)">x</a>`, `java	script:alert(1)`, schemeMsg},
|
||||
{"newline_split", `<a href="java
script:alert(1)">x</a>`, `java
script:alert(1)`, schemeMsg},
|
||||
{"handler_with_space", `<p class="x" onclick="x()">x</p>`, `onclick="x()"`, "event handlers"},
|
||||
{"handler_without_space", `<img src="x.png"onerror="alert(1)">`, `onerror="alert(1)"`, "event handlers"},
|
||||
// Raw-text element content that a mail client parses as markup
|
||||
// (scripting off, foreign content in svg) (CR-02).
|
||||
|
||||
Reference in New Issue
Block a user