Skip to content

fix(waf-detect): recognise x-cdn: Imperva as Imperva #604 - #643

Merged
nc9 merged 2 commits into
mainfrom
fix/waf-imperva-xcdn-604
Oct 11, 2026
Merged

nc9 merged 2 commits into
mainfrom
fix/waf-imperva-xcdn-604

Conversation

@nc9

@nc9 nc9 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Closes #604

detectWafFromHeaders matched Imperva's x-cdn header only on /incapsula/i. Imperva now sends x-cdn: Imperva (www.imperva.com, 2026-10-09), so a response with that header and no x-iinfo was not identified, and when both were present the x-cdn header was missing from indicators.

  • packages/waf-detect/src/providers.ts: the x-cdn pattern is now /incapsula|imperva/i.
  • apps/cli/tests/utils/waf.test.ts: x-cdn: Imperva alone is Imperva, Imperva + x-iinfo lists both indicators, x-cdn: Fastly is not Imperva; the existing x-cdn: Incapsula case stays.
  • CHANGELOG [Unreleased] entry.

Verified: the two new positive cases fail on main and pass here; bun test tests/utils/waf.test.ts 32/32; tsgo --noEmit in packages/waf-detect clean.

Docs: no page names the WAF header signatures, so no docs change. Skill: no change needed.

@nc9
nc9 marked this pull request as ready for review October 11, 2026 03:49
@claude

claude Bot commented Oct 11, 2026

Copy link
Copy Markdown

Reviewed the diff: the change is small and correct. I found no issues that should block merging.

  • (nit) packages/waf-detect/src/providers.ts:40 The new line is over 80 columns, so Prettier or Biome may reformat it. Please run the formatter if CI checks formatting.
  • (nit) The /imperva/ match is unanchored, so a value like x-cdn: not-imperva-cdn would also match. That is the same looseness as the existing incapsula pattern, and the test covers the Fastly negative case, so this is acceptable.

Tests cover the Imperva-only case, the case with both headers, and a negative. The CHANGELOG entry is clear. I did not run the tests myself.

@claude

claude Bot commented Oct 11, 2026

Copy link
Copy Markdown

Reviewed the diff. The change is correct, small and tested. The new regex /incapsula|imperva/i fixes the reported case. The three new tests cover Imperva alone, Imperva with x-iinfo, and a negative case with Fastly.

  • (low) packages/tech-detect/src/fingerprints/generated.ts:2663 has the same X-CDN: Incapsula header pattern for tech detection. It is generated, so the fix probably belongs in the upstream fingerprint source or generator. Until then, tech detection will still miss x-cdn: Imperva. Consider a follow-up issue.
  • (nit) providers.ts:40 is now over typical prettier line width. Run the formatter if CI checks it.

I did not run the tests myself.

@nc9

nc9 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Review triage (head 33ba2bb): (low) tech-detect X-CDN: Incapsula: deliberate skip here. #604 is scoped to waf-detect, and packages/tech-detect/src/fingerprints/generated.ts is generated from packages/tech-detect/data/research-fingerprints.json, so that fix belongs in the source data plus a regen, in its own follow-up. (nit) line width: Format, lint, and typecheck passes on this head.

@nc9
nc9 merged commit 8312d0b into main Oct 11, 2026
15 checks passed
@nc9
nc9 deleted the fix/waf-imperva-xcdn-604 branch October 11, 2026 05:28
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.

bug(waf-detect): x-cdn: Imperva is not recognised as Imperva

1 participant