Skip to content

Tech detection: include first-party JS bundle contents, and run tech-detect locally when the cloud service isn't used #1254

Description

@nc9

Problem

Technology detection only sees each page's HTML, response headers, script URLs and the first KB of inline scripts. It never sees the contents of external JavaScript bundles. Single-page apps built with Vite, Lovable, Bolt, Next.js and similar tools ship a nearly empty HTML shell, and the libraries live in /assets/index-*.js or /_next/static/chunks/*. So stacks such as Supabase (createClient(...), *.supabase.co), Firebase, Clerk and others are undercounted exactly where they're most common. The 184 script-content fingerprints in tech-detect can never match bundle code today.

The CLI already downloads these bundles for the secret rules, so the bytes are in hand during every audit.

Also: tech detection runs through the credited cloud service. Signed-out and --offline audits get no technologies, although @squirrelscan/tech-detect is an MIT package in this repo.

Expected

  • Tech detection receives each page's first-party script bodies, the first 64 KB of each bundle (capped per page and per audit), from the bytes the crawl already fetched. It never refetches.
  • Run @squirrelscan/tech-detect locally when the cloud service is not used (signed out or --offline), so every report has a technologies section.
  • Keep the pathological-regex guard (fix(tech-detect): bound unbounded fingerprint patterns (requirejs 70 s on hostile page) #1244 #1245 bounded patterns) and a per-page time budget, so a hostile bundle can't stall the audit.

Acceptance Criteria

  • A Vite SPA fixture whose HTML is an empty shell and whose bundle calls createClient("https://x.supabase.co", ...) is detected as Supabase
  • A Next.js fixture with Firebase SDK and Clerk code only in chunks detects both
  • Signed-out and --offline audits include technologies from local detection; signed-in audits keep using the cloud service, with identical results on the same input
  • Bundle bytes passed to detection are capped (64 KB per bundle, configurable), and detection on a 1 MB hostile bundle finishes within the per-page budget
  • No additional network requests are made for tech detection (verified by a request-count test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancementsize: M

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions