Repository navigation
fix(waf-detect): a signature counts where it acts, not where a page quotes it #693 - #884
Merged
Merged
Conversation
…uotes it #693 signatureViews splits the 10 KB sample into markup (tags bar <a>/<area>, inline script bodies) and text (no comments, script/style bodies or code elements). Content patterns, challenge markers and the 200-challenge fingerprints each read their view, so a tutorial or support page quoting a signature is neither attributed nor a challenge. Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/693-waf-quoted-signatures
branch
from
October 17, 2026 00:09
07bb67a to
6474cf1
Compare
nc9
marked this pull request as ready for review
October 17, 2026 00:09
|
Reviewed the diff and read
|
3 tasks
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 #693
What changed
packages/waf-detect/src/views.tsaddssignatureViews(html), one linear pass over the 10 KB sample, producing two readings:<a>,<area>: a link to a provider's script is a mention), plus inline<script>bodies. No text, so<script src="https://js.datadome.co/tags.js">in a tutorial is not DataDome.<code>,<kbd>,<samp>,<textarea>,<xmp>elements. Tags are kept, since the wording patterns allow tags between label and id. A bare<pre>stays, because CloudFront's own block page prints "Generated by cloudfront (CloudFront)" in one (existing waf-detect: read vendor cookie names, attribute a bot vendor over its CDN, and stop calling CloudFront AWS WAF #750 test). The<pre><code>that Markdown and syntax highlighters emit is removed by its<code>.Raw-text and RCDATA elements are skipped as the HTML parser does, and never self-close. Lowercasing is ASCII-only so offsets stay aligned.
Each
CONTENT_PATTERNSentry now names its view (Cloudflare and Imperva split into a text entry and a markup entry). The regexes themselves are unchanged. The same views now gate:challengeMarkers: challenge markup per view; challenge text on the text viewdetectFingerprintedChallenge: DataDome/Kasada 200 interstitials, which use only markup markersSo a quoted signature no longer sets a Cloudflare-served
200page aside as a challenge either.Wording in a paragraph
The AC lists "paragraph text". That holds for script and resource signatures. Block-page wording (ray id, reference id, incident line, Sucuri title, CloudFront footer) stays readable in a
<p>, because real block pages print it there:<p>Cloudflare Ray ID: <strong>…</strong></p>and Akamai's<P>…edgesuite…</P>are existing positives the AC requires to keep passing. Its quoted form is a code element.Acceptance criteria
<pre><code>/<code>, or (script/resource signatures) in paragraph text, is not attributed: the issue's three pages plus a generated quoted variant of every positive<script src>, an inline script or an<iframe src>is still attributedcontent-signatures.test.tspasses, and quoted variants of each are negatives (50 of the new assertions fail on origin/main'sdetect.ts)Also:
apps/cli/tests/crawler/cloud-fetcher.test.ts: the render-block fixture had challenge markers as body text. It now carries them where a challenge page does (an element id and a script), and the old text-only form is asserted not a block.docs/guides/failed-audits.mdx(#waf-challenge) says where signatures count.Tests: waf-detect 154/154, CLI waf + adapter-waf + cloud-fetcher 82/82, audit-engine soft404/waf-tech 21/21. Typecheck (waf-detect), oxlint on changed files, codex review (2 rounds; P2s on Unicode offsets, raw-text self-closing and the 200-fingerprint path fixed).