Skip to content

security/leaked-secrets: scan the sources a repo scanner cannot see (source maps, config endpoints, framework payloads, comments) #362

Description

@nc9

Trufflehog scans repositories. A website exposes secrets in places a repo scanner never looks:

  • Source maps: bundles reference //# sourceMappingURL= and the SourceMap response header (already captured by script-fetcher.ts for perf/source-maps). Fetch the .map when it is same-origin and under the script size cap, and scan sourcesContent, which is the original source including inlined env values.
  • Framework payloads: __NEXT_DATA__, __NUXT__ / window.__NUXT__, Remix __remixContext, SvelteKit __sveltekit_* data blocks carry server-side props verbatim. Scan them as a distinct location framework-payload so the fix advice can say which loader leaked it.
  • Config endpoints referenced from scripts: /config.json, /env.js, /api/config, /.well-known/… that a bundle fetches at boot. Fetch same-origin ones referenced by literal URL in a scanned script, cap 10 per site.
  • HTML comments as a distinct location; today they are scanned as part of the serialised document but reported as html.
  • Exposed .env and .git/HEAD at the web root belong to the active-probing epic, not here.

Acceptance Criteria

  • A key in sourcesContent of a same-origin source map reports at location source-map (<map url>)
  • A key in __NEXT_DATA__ or __NUXT__ reports at location framework-payload, with the framework named in the message
  • A key in a same-origin JSON config fetched by a scanned bundle reports at location config-endpoint (<url>)
  • A key inside an HTML comment reports at location html-comment
  • Source-map and config fetches respect the site's fetch budget and never exceed 10 extra requests per audit; cross-origin maps are never fetched
  • Corpus harness gains one context per new location

Metadata

Metadata

Assignees

Labels

P3enhancementin-progressrulessecuritysize: L

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions