Skip to content

🐛 Escape attribute values and text content in getHtml#40534

Open
madib06ops wants to merge 1 commit into
ampproject:mainfrom
madib06ops:get-html-escape
Open

🐛 Escape attribute values and text content in getHtml#40534
madib06ops wants to merge 1 commit into
ampproject:mainfrom
madib06ops:get-html-escape

Conversation

@madib06ops

Copy link
Copy Markdown

getHtml assembles an HTML string by hand and writes attribute values and text nodes into it unescaped, so any host-page value carrying a quote or angle bracket escapes the markup it is serialized into: a title of x" onmouseover="evil() comes back as a live event handler, and a text node holding comes back as real markup. An ad iframe reaches this through the GET_HTML message when the slot sets data-html-access-allowed, and the serialized string is returned to that frame. Escaping both sinks with escapeHtml matches what the friendly-iframe-embed serializer already does and leaves plain values untouched, so the existing tests are unaffected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant