-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Put safeguards around attribute nodes #47
Comments
Perhaps we can simply disable the offending functions? At least the ones related to attribute nodes seem to be on the way to being deprecated in DOM4. |
Disabling setAttributeNode would work.
aElement.attributes.href.value = ...
aElement.getAttributeNode('href').value = ... |
The text node in scripts vector should be covered in #133 (https://chromium-review.googlesource.com/c/chromium/src/+/1547746) Regarding attribute node deprecation, this is probably not happening soon in practice: https://github.com/search?l=JavaScript&q=setAttributeNode&type=Code. Assuming they are here to stay, and are used it sounds like we need to guard them. It seems like the attribute nodes are immutable, apart from their value (in specific, changing the
A more elegant fix would be to require cc @otherdaniel |
Closing this, see #50 (comment) for rationale (for cross-realm nodes). As for the script node text manipulation via child nodes, we addressed this in #133. |
Reopening for attribute nodes. We should
|
A possible solution outlined in whatwg/dom#789 (comment) |
…checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298
…checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298
…checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298
…checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#716193}
…checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#716193}
…ipulation with Trusted Types checks., a=testonly Automatic update from web-platform-tests [Trusted Types] Cover attribute node manipulation with Trusted Types checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#716193} -- wpt-commits: 36362f1a77faf18831c8b596e7b5bee081629817 wpt-pr: 20228
…ipulation with Trusted Types checks., a=testonly Automatic update from web-platform-tests [Trusted Types] Cover attribute node manipulation with Trusted Types checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Cr-Commit-Position: refs/heads/master@{#716193} -- wpt-commits: 36362f1a77faf18831c8b596e7b5bee081629817 wpt-pr: 20228
…ipulation with Trusted Types checks., a=testonly Automatic update from web-platform-tests [Trusted Types] Cover attribute node manipulation with Trusted Types checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Mike West <mkwstchromium.org> Cr-Commit-Position: refs/heads/master{#716193} -- wpt-commits: 36362f1a77faf18831c8b596e7b5bee081629817 wpt-pr: 20228 UltraBlame original commit: 5765ef6d9f1a1d561d37a365cda5c2084245145f
…ipulation with Trusted Types checks., a=testonly Automatic update from web-platform-tests [Trusted Types] Cover attribute node manipulation with Trusted Types checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Mike West <mkwstchromium.org> Cr-Commit-Position: refs/heads/master{#716193} -- wpt-commits: 36362f1a77faf18831c8b596e7b5bee081629817 wpt-pr: 20228 UltraBlame original commit: 5765ef6d9f1a1d561d37a365cda5c2084245145f
…ipulation with Trusted Types checks., a=testonly Automatic update from web-platform-tests [Trusted Types] Cover attribute node manipulation with Trusted Types checks. Element::setAttribute will perform trusted types checks, which (currently) can be circumvented by obtaining the DOM's attribute node and setting the value directly. This fixes this bypass, by performing identical checks when the attribute node values are set, and/or the attribute node is attached to an element. Bug: 1008012 Bug: w3c/trusted-types#47 Change-Id: I1d8ead85b3fa11821c329e1f4af60c1e85ea8298 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911215 Commit-Queue: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Mike West <mkwstchromium.org> Cr-Commit-Position: refs/heads/master{#716193} -- wpt-commits: 36362f1a77faf18831c8b596e7b5bee081629817 wpt-pr: 20228 UltraBlame original commit: 5765ef6d9f1a1d561d37a365cda5c2084245145f
Closing this, the followup is in whatwg/dom#809. |
If I understand right this was resolved without disabling setAttributeNode, right? I’m looking to confirm because currently setAttributeNode is (afaik) the only way to set attributes with names that don’t pass the “Name production in XML”* step in setAttribute/setAttributeNS.
|
The value of the node goes through a default policy, if the elem it's attaching to + attribute name matches what needs Trusted Types. If there's no default policy (or the value is rejected by it), |
There are two cases where moving a node from one parent to another might be problematic.
We need to be suspicious of append to
<script>
elements regardless, but there's also a problem with attributes.But what about when a node comes from one context to a similar context?
Should we support this kind of transparent DOM restructuring?
The text was updated successfully, but these errors were encountered: