Prevent custom elements from being considered formatting elements in HTML parser. [chromium/src : main]

0 views
Skip to first unread message

David Baron (Gerrit)

unread,
Mar 30, 2026, 3:17:55 PM (3 days ago) Mar 30
to David Baron, Mason Freed, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Mason Freed

David Baron added 1 comment

Commit Message
Line 27, Patchset 1 (Latest):
Thanks to Arthur Sonzogni for the tests, originally from
https://crrev.com/c/7706938
David Baron . unresolved

@arthurs...@chromium.org, I'm noticing that without this change I'm only seeing two of the tests fail: `adoption_agency_shift.html` with a `DCHECK failed: Contains(old_element)` and `adoption_agency_uaf.html` with a SEGV. I'm curious if some of the other tests were failing for you in a different configuration?

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I91a62c9afa45889b19d3f4dd356cc18996902504
Gerrit-Change-Number: 7712232
Gerrit-PatchSet: 1
Gerrit-Owner: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Mon, 30 Mar 2026 19:17:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
Mar 31, 2026, 1:10:51 PM (2 days ago) Mar 31
to David Baron, Michał Bentkowski, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from David Baron and Michał Bentkowski

Mason Freed added 4 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Mason Freed . resolved

The code looks good, and I agree it'll fix the bug. Just some questions.

+securitymb@ for the mXSS question

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1068, Patchset 1 (Latest): // Disallow custom elements from being on the stack of active formatting
// elements.
Mason Freed . unresolved

You might consider also saying that this isn't per-spec, but is a corner case we're willing to live with? Or something to that effect?

Line 1070, Patchset 1 (Latest): if (token->GetAttributeItem(html_names::kIsAttr) &&
Mason Freed . unresolved

Per my offline comment, my concern is that this might (?) introduce mXSS concerns? I.e. the behavior within trees of nested formatting elements will be different, depending on whether the formatting element has `is=something`. So if a sanitizer is stripping out `is` attributes, and then serializing the resulting tree, the resulting HTML will be parsed into a different tree because of the lack of `is`.

@securitymb for comments.

File third_party/blink/web_tests/external/wpt/html/syntax/parsing/reconstruct_active_formatting_elements_uaf.html
File-level comment, Patchset 1 (Latest):
Mason Freed . unresolved

Perhaps just `-crash.html` rather than `_uaf.html`? This test doesn't actually make real use of `testharness`. (Also replace "use after free" with "crash" in the content of the test?)

This comment applies to a few tests above. Perhaps all of them.

Open in Gerrit

Related details

Attention is currently required from:
  • David Baron
  • Michał Bentkowski
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I91a62c9afa45889b19d3f4dd356cc18996902504
Gerrit-Change-Number: 7712232
Gerrit-PatchSet: 1
Gerrit-Owner: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Reviewer: Michał Bentkowski <secur...@google.com>
Gerrit-Attention: David Baron <dba...@chromium.org>
Gerrit-Attention: Michał Bentkowski <secur...@google.com>
Gerrit-Comment-Date: Tue, 31 Mar 2026 17:10:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Michał Bentkowski (Gerrit)

unread,
Apr 1, 2026, 8:04:51 AM (22 hours ago) Apr 1
to David Baron, Mason Freed, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from David Baron and Mason Freed

Michał Bentkowski added 2 comments

Patchset-level comments
Michał Bentkowski . resolved

Removing myself from reviewers as I don't actually have permission to vote.

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1070, Patchset 1 (Latest): if (token->GetAttributeItem(html_names::kIsAttr) &&
Mason Freed . resolved

Per my offline comment, my concern is that this might (?) introduce mXSS concerns? I.e. the behavior within trees of nested formatting elements will be different, depending on whether the formatting element has `is=something`. So if a sanitizer is stripping out `is` attributes, and then serializing the resulting tree, the resulting HTML will be parsed into a different tree because of the lack of `is`.

@securitymb for comments.

Michał Bentkowski

I think this should be fine. The list of active formatting elements is meant to handle mis-nested tags. So the sanitizer should create a valid HTML structure (i.e. no mis-nested tags) and on re-parsing this algorithm shouldn't kick in.

Open in Gerrit

Related details

Attention is currently required from:
  • David Baron
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I91a62c9afa45889b19d3f4dd356cc18996902504
Gerrit-Change-Number: 7712232
Gerrit-PatchSet: 1
Gerrit-Owner: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Attention: David Baron <dba...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Apr 2026 12:04:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

David Baron (Gerrit)

unread,
Apr 1, 2026, 12:47:39 PM (18 hours ago) Apr 1
to David Baron, Mason Freed, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from Mason Freed

David Baron added 2 comments

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1068, Patchset 1: // Disallow custom elements from being on the stack of active formatting
// elements.
Mason Freed . resolved

You might consider also saying that this isn't per-spec, but is a corner case we're willing to live with? Or something to that effect?

David Baron

Better, I filed https://github.com/whatwg/html/issues/12327 and I'll link to it.

File third_party/blink/web_tests/external/wpt/html/syntax/parsing/reconstruct_active_formatting_elements_uaf.html
File-level comment, Patchset 1:
Mason Freed . resolved

Perhaps just `-crash.html` rather than `_uaf.html`? This test doesn't actually make real use of `testharness`. (Also replace "use after free" with "crash" in the content of the test?)

This comment applies to a few tests above. Perhaps all of them.

David Baron

Moved to `crashtests` subdirectory, renamed, changed them to use crashtest infrastructure (`class="test-wait"` and `TestRendered` event).

Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I91a62c9afa45889b19d3f4dd356cc18996902504
Gerrit-Change-Number: 7712232
Gerrit-PatchSet: 2
Gerrit-Owner: David Baron <dba...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Wed, 01 Apr 2026 16:47:27 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
Apr 1, 2026, 8:06:04 PM (10 hours ago) Apr 1
to David Baron, chromium...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org
Attention needed from David Baron

Mason Freed voted and added 3 comments

Votes added by Mason Freed

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Mason Freed . resolved

LGTM!

File third_party/blink/renderer/core/html/parser/html_construction_site.cc
Line 1068, Patchset 1: // Disallow custom elements from being on the stack of active formatting
// elements.
Mason Freed . resolved

You might consider also saying that this isn't per-spec, but is a corner case we're willing to live with? Or something to that effect?

David Baron

Better, I filed https://github.com/whatwg/html/issues/12327 and I'll link to it.

Mason Freed

even better

Line 1070, Patchset 1: if (token->GetAttributeItem(html_names::kIsAttr) &&
Mason Freed . resolved

Per my offline comment, my concern is that this might (?) introduce mXSS concerns? I.e. the behavior within trees of nested formatting elements will be different, depending on whether the formatting element has `is=something`. So if a sanitizer is stripping out `is` attributes, and then serializing the resulting tree, the resulting HTML will be parsed into a different tree because of the lack of `is`.

@securitymb for comments.

Michał Bentkowski

I think this should be fine. The list of active formatting elements is meant to handle mis-nested tags. So the sanitizer should create a valid HTML structure (i.e. no mis-nested tags) and on re-parsing this algorithm shouldn't kick in.

Mason Freed

Thanks!

Open in Gerrit

Related details

Attention is currently required from:
  • David Baron
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I91a62c9afa45889b19d3f4dd356cc18996902504
    Gerrit-Change-Number: 7712232
    Gerrit-PatchSet: 2
    Gerrit-Owner: David Baron <dba...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Attention: David Baron <dba...@chromium.org>
    Gerrit-Comment-Date: Thu, 02 Apr 2026 00:05:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    Comment-In-Reply-To: David Baron <dba...@chromium.org>
    Comment-In-Reply-To: Michał Bentkowski <secur...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages