#6233 Improve css validation#6234
Draft
martgil wants to merge 1 commit into
Draft
Conversation
Collaborator
Author
|
Hi @sosnovsky - This one is ready for a review. Thank you! |
sosnovsky
reviewed
May 29, 2026
| const style = node.getAttribute('style')?.toLowerCase(); | ||
| if (style && (style.includes('url(') || style.includes('@import'))) { | ||
| node.removeAttribute('style'); // don't want any leaks through css url() | ||
| return; // stop processing: do not re-add any part of this style attribute |
Collaborator
There was a problem hiding this comment.
if return will be executed here, then all next checks will be skipped?
so if style property includes some URL, then other checks for node.tagName === 'IMG' and node.tagName === 'A' won't be executed?
for example, <img src="https://example.com/tracker.png" style="background-image: url(https://example.com/bg.png)"> will return <img src="https://example.com/tracker.png"> - style property removed, but remote image is loaded
Collaborator
Author
There was a problem hiding this comment.
Yes, but I realize I should formulate even better logic to fix this rather than what's current. BRB.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves currently implemented css validation on rendered elements in
pgp_block.Closes #6233
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):