Repository navigation
Fix the wavedrom extra bypassing safe_mode - #767
Open
adityaanikam wants to merge 1 commit into
Open
adityaanikam wants to merge 1 commit into
adityaanikam wants to merge 1 commit into
Conversation
adityaanikam
force-pushed
the
fix-wavedrom-safe-mode
branch
from
November 5, 2026 10:31
2b1a342 to
ecfd928
Compare
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.
Fixes #765.
The wavedrom extra hashes the content of its fenced block before safe_mode sanitizes the HTML, so a block like
<script>...</script>or<img onerror=...>was restored unescaped in both theescapeandreplacemodes. The content is now passed through_sanitize_htmlwhen safe_mode is set, which is also what already happens to the<script type="WaveDrom">tags around it.One behaviour change to be aware of: with the wavedrom library installed and SVG embedding on, the generated SVG used to be restored raw in safe mode (next to an escaped
<div>wrapper), so the diagram rendered. With this change it is escaped like the rest. I did not find an input that makes the library emit a raw tag, so if you would rather keep that path as it is, I can limit the change to the script tag path.Added two test cases, one per mode. They fail on master and pass with this change.