LibWebView: Escape HTML entities in attribute names

Otherwise, we can embed invalid HTML in the Inspector web view.
This commit is contained in:
Timothy Flynn 2024-07-29 17:23:52 -04:00 committed by Andreas Kling
parent 657bbd1542
commit 93f2af38b1
Notes: github-actions[bot] 2024-07-30 07:42:28 +00:00

View file

@ -544,7 +544,7 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
builder.append(" "sv);
builder.appendff("<span data-node-type=\"attribute\" data-tag=\"{}\" data-attribute-index={} class=\"editable\">", tag, dom_node_attributes.size());
builder.appendff("<span class=\"attribute-name\">{}</span>", name);
builder.appendff("<span class=\"attribute-name\">{}</span>", escape_html_entities(name));
builder.append('=');
builder.appendff("<span class=\"attribute-value\">\"{}\"</span>", escape_html_entities(value_string));
builder.append("</span>"sv);