Skip to content
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

Fix: escape SVG data URLs #11639

Merged
merged 6 commits into from
Dec 13, 2023
Merged

Conversation

jared-hughes
Copy link
Contributor

@jared-hughes jared-hughes commented Aug 27, 2023

When a url() directly references an SVG data URL that's not base64-encoded, some characters (<>"'&) need to be escaped before the url is put into xlink:href. Dark reader was previously not doing it. This PR fixes that.

I encountered this as the default "error squiggle" for Codemirror.

Repro at Try Codemirror: Error Diagnostic (wait a second for the output on the right-half of the screen to load in. If your screen is narrow, you'll have to click the "Output" button).

Before PR:
image

After PR:
image

@bershanskiy bershanskiy self-assigned this Aug 30, 2023
@jared-hughes
Copy link
Contributor Author

Failures here seem unrelated. Anything I can do? Surprised the main-merge didn't fix it.

@bershanskiy bershanskiy changed the title Escape SVG data URLs Fix: Escape SVG data URLs Dec 13, 2023
@bershanskiy bershanskiy changed the title Fix: Escape SVG data URLs Fix: escape SVG data URLs Dec 13, 2023
@bershanskiy bershanskiy mentioned this pull request Dec 13, 2023
@bershanskiy
Copy link
Contributor

Thanks for your patience, the PR looks great. I tried to add an integration test for this behavior and stuck for some time.

@bershanskiy bershanskiy merged commit 403daf3 into darkreader:main Dec 13, 2023
2 checks passed
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.

None yet

2 participants