Repository navigation
fix(waf-detect): an unclosed <code> stops hiding wording at its block's end #904 - #916
Merged
Merged
Conversation
…'s end #904 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Reviewed the diff in
The linear-scan guarantee is preserved, since the change is O(1) per tag. I found no security concerns. The CHANGELOG entry is clear. |
This was referenced Oct 17, 2026
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.
Closes #904
Thank you @WilliamK112 for #905, which tackled the same problem and helped confirm the fix was needed. This PR takes a slightly different route so that code blocks built from nested blocks, such as Expressive Code and Starlight, keep their lines treated as quoted.
What changed
signatureViewsinpackages/waf-detect/src/views.tsdrops the text inside<code>,<kbd>and<samp>from the text view. Before this change, an unclosed<code>hid every word after it in the sample. The browser instead closes it at the end of its block. Now:</p>,</div>,</pre>,</li>,</td>,</body>and the like) ends any quote still open inside that block;<div>, as Expressive Code (Starlight) does, would expose its quoted lines to the text view.Tests
packages/waf-detect/tests/content-signatures.test.ts, 155/155:<code>before an Imperva incident line: attributed to Imperva<kbd>in a list item before a Cloudflare ray id: attributed to Cloudflare<pre><code>quoting the incident line: not attributed<pre><code><div>log</div>…incident line…</code></pre>: not attributed<figure><pre><code><div class="ec-line">…</div></code></pre></figure>) quoting an incident line and a ray id: not attributed. It fails if the nested-block counter is removed.Typecheck (waf-detect) and oxlint on the changed files pass. CHANGELOG entry under Unreleased. Skill: no change needed.