Last updated

JS Reconnaissance

JS Recon Settings

JS Recon is RedAmon's deep JavaScript reconnaissance engine. It runs as GROUP 5b in the recon pipeline -- immediately after resource enumeration -- and analyzes every JavaScript file discovered by crawlers (Katana, Hakrawler, GAU) plus any manually uploaded files. The goal is to extract secrets, endpoints, dependency confusion risks, source map exposures, DOM XSS sinks, and framework fingerprints embedded in client-side code.

Pipeline position: GROUP 5b runs whenever JS_RECON_ENABLED (JS Recon in the project form) is true. It is not a scan module: there is no js_recon entry to add to scanModules, and an older project or preset that still lists one loads fine but that entry does nothing. JS Recon cannot browse. It analyzes the JS files that resource enumeration's crawlers and HTTP probing found, so keep Resource Enumeration (or at least HTTP Probing) in the scan modules; with neither, it analyzes only manually uploaded files. JS Recon feeds discovered subdomains back into the pipeline and updates the Neo4j graph in a background thread.


What JS Recon Discovers

JS Recon runs seven parallel analysis modules via ThreadPoolExecutor(max_workers=4), and the optional TruffleHog engine in a fifth worker:

ModuleWhat It FindsSeverity Range
Pattern Scanning90+ secret patterns (cloud credentials, payment keys, auth tokens, infrastructure URLs, info leaks)Critical - Info
Secret ValidationLive validation of 21 secret types against their APIs (GitHub, Stripe, Slack, AWS, etc.)Critical - High
TruffleHog (on by default for new projects)TruffleHog's detectors, run in an isolated container over local copies of the same files; its keys merge with Pattern Scanning's, one finding per key, and with key validation on it checks the keys it finds (details)Critical - Info
Source Map DiscoveryExposed .map files via comment parsing, HTTP headers, and path probing; the map's own sources go through every other moduleLow - Info (what the sources hold is reported as its own Secret, Endpoint and DOM-sink findings)
Dependency ConfusionScoped npm packages not registered on public npm (attacker could register them)Critical - High
Endpoint ExtractionREST APIs, GraphQL, WebSocket, router definitions, admin/debug paths, API docsHigh - Info
Framework & SecurityFramework detection (12 built-in), DOM XSS sinks (15 patterns), dev comments with sensitive keywordsCritical - Info
AI SDK Detection (Phase 6)LLM/vector-DB SDK imports, hard-coded provider keys, dangerouslyAllowBrowser opt-in, AI-frontend product markers in JS chunks, provider base URLsCritical - Info

Module Details

1. Pattern Scanning (Secrets Detection)

Scans every JS file against 90+ hardcoded regex patterns organized into seven categories:

CategoryExamples
CloudAWS Access Key, GCP API Key, Azure Client Secret, DigitalOcean Token, Firebase Config
PaymentStripe Secret/Publishable Key, Square Access Token, PayPal Client ID, Razorpay Key
AuthGitHub Token, GitLab PAT, Slack Token/Webhook, Discord Bot Token, Twilio SID, Telegram Bot Token
JS ServicesSentry DSN, Algolia API Key, Mapbox Token, Supabase Key, OpenAI API Key
General SecretsJWT tokens, generic API keys, private keys, database URIs, NPM tokens
InfrastructureS3 bucket URLs, GCP Storage URLs, Azure Blob Storage URLs
Info LeaksEmail addresses, private IPs (RFC 1918), UUIDs, debug flags

Each finding includes a confidence level (high/medium/low), severity, the full value (shown as its last four characters with a copy button), line number, and surrounding code context. A minimum confidence filter (JS_RECON_MIN_CONFIDENCE) controls which findings are kept.

Confidence. high is kept for a value with a provider-specific shape (AKIA…, ghp_…, xoxb-…, sk_live_…). A pattern that finds a generic run of characters only because a keyword sits nearby says medium: AWS Secret Key, Azure AD Client Secret, Azure Connection String, Plaid Secret Key, GoCardless API Token, Notion API Token, Harness API Key and Basic Auth Header. The Priority Board reads high as enough confidence for "Act soon", so an unvalidated keyword-anchored hit now stays in "Plan" at most. Raising JS_RECON_MIN_CONFIDENCE to high therefore also drops these patterns.

Keyword-anchored patterns are bounded. About 70 patterns look for a value near a keyword (etsy … "<24 characters>"). The keyword and the value may be at most 120 characters apart, and the nearest value is taken. On a minified bundle, one line used to let a match run from the keyword to the last candidate anywhere on the line. The Azure AD client secret also needs the value to be assigned to the client-secret key (clientSecret: "…", client_secret = "…"), with azure, msal or aad within those 120 characters: "azure" anywhere on the line plus any long quoted string later (MSAL's empty clientSecret: "" default did it) is no longer a hit.

Context around each secret. Each Secret stores up to 400 characters of the code around the match, as context: on a line over 1,000 characters (minified code) about 150 characters either side of the match, otherwise the line itself with the nearest 150 characters of the lines above and below. Every secret-shaped value in that text, the match itself and any other key on the same line, is shown in its redacted form (AKIAQ7...B3V6), whole even where the edge of the window cuts it. Emails, private IPs, UUIDs and bucket URLs stay readable. The Priority Board's reviewer reads it as evidence. The same window with nothing masked is kept as raw_context for you (it is in the JS Recon export), and the agent's graph queries never return it.

Keys that are public by design. A browser key, a publishable key, a DSN or a write-only analytics key ships to every browser that loads the page. These are written at severity info and flagged public_client_key, not dropped (an unrestricted Google key can still be billed against a paid API):

FamilyPattern names
Google / FirebaseGCP API Key (AIza…), Firebase API Key
Analytics and monitoringSegment Write Key, Amplitude API Key, New Relic Browser API Token (NRJS-…), Sentry DSN
Payments and mapsStripe Publishable Key (pk_live_…), Google reCAPTCHA Key, Mapbox Token (pk.…), Flutterwave Public Key
Search, chat, realtimeAlgolia App ID, Algolia Search Key, Intercom App ID, Pusher Key
Auth and mailClerk Publishable Key, Mailgun Public Key (pubkey-…)
SupabaseSupabase anon key, Supabase Publishable Key (sb_publishable_…)

An Algolia key is the public search-only key only when its label says so (searchKey, search_only_api_key, …); the admin key has the same format, so an unlabelled one stays a high Algolia API Key. The Priority Board ranks public keys in Track, the client report lists them on an "Expected-public client keys" line instead of counting them, the Red Zone secrets table shows them at info with a public key chip, and Mute Rules can select them with Public by design. A node written by an earlier release has no flag and keeps its old severity until JS Recon runs again; every reader also treats its pattern name as public meanwhile.

Keys that look public but are not. Some values have a public twin:

FindingSeverityHow it is told apart
Supabase service_role keycritical (high confidence)A Supabase key is a JWT. Its payload is base64url-decoded (never verified, at most 4 KB; anything unreadable leaves the finding as it was) and its role claim read: service_role bypasses row-level security, anon is the public key above. A Supabase key matched both by the Supabase pattern and the JWT pattern is one finding.
Supabase Secret Key (sb_secret_…)criticalThe new key format; sb_publishable_… is its public twin
Signed URL in client codemedium, low once expiredA presigned S3 URL (X-Amz-Signature with its X-Amz-Credential) or a GCS signed URL (X-Goog-Signature): whoever holds it reads or writes the object until it expires. X-Amz-Date / X-Goog-Date plus -Expires in the past makes it low.
Zapier Webhook, Make Webhookhighhooks.zapier.com/hooks/catch/… and hook.<region>.make.com/…: a POST runs the owner's automation, like a Slack or Discord webhook

CSS-module class names. A CSS-modules build names a form field's class after the field: password: "LoginForm_password__3xYz9". A value shaped like a CSS-module class (<Component>_<class>__<hash>, or css-loader's ___ and -- forms) is noise, like a route, a selector or an i18n key.

Embedded binary data. A match sitting inside a long base64 run (an embedded image or font) or right next to a font marker (@font-face, fontFamily, base64,, .woff) is dropped as noise. Only the text around the match counts: a match is inside a base64 run only when the run reaches well past it, so a long JWT, a Bearer header or a 1Password service-account token is kept; and on a line over 1,000 characters only the 300 characters either side of the match are checked for font markers, so one fontFamily near the top of a minified bundle no longer hides every secret on that line.

A provider rule wins over a generic one. A generic rule (Generic API Key, Generic Token, Generic Secret, Hardcoded Password) whose match holds a provider rule's match on the same line has found that provider's key: the generic finding is dropped and its name is added to the provider finding's alternate_names. Generic never wins over generic and specific never wins over specific, so a Gemini key keeps its critical rule beside the public GCP API Key.

A private key needs key data. The six BEGIN … PRIVATE KEY rules (RSA, DSA, EC, OpenSSH, PGP, generic) report only when at least 64 base64 characters follow the marker, read through escaped newlines (\n), string quotes, + concatenation over the next lines and PGP armor headers. A crypto library's parser branch or runtime template ("-----BEGIN RSA PRIVATE KEY-----\n" + body) is not a key. A -----BEGIN CERTIFICATE----- (pattern PKCS12 Certificate) is severity info, since a certificate is public; its name and category are unchanged, so its id is too.

Loose shapes need their provider's word or a boundary. Yandex AWS Access Token (YC + 38 characters, also the shape of a webpack chunk id) reports only with "yandex" in the 120 characters before the match. Resend (re_…) and Databricks (dapi…) need a left boundary: no letter, digit or underscore just before the prefix, so configure_… / prepare_… identifiers and integrity hashes no longer match. A generic match whose value is a bare UUIDv4 (a config, feature-flag or object id) is kept at severity low.

A vendor prefix needs a left boundary. Every rule that starts with a vendor's literal prefix (AKIA, ghp_, glpat-, xoxb-, sk_live_, ...) reports only when no letter or digit sits right before the prefix: foosk_live_… or xghp_… is the tail of a longer string, not a key the vendor issued. Anything else is a boundary, an underscore included, and so are quotes, =, / and an escape ending in a letter or digit (\n, %22, \x22, "), so a key inside an encoded string still fires. A real key keeps its id; a match inside a longer identifier is pruned at the next scan.

Rules added: AWS Session Key (ASIA…, high, medium confidence), Stripe Webhook Secret (whsec_…, high), Credentials in URL (an http(s), ftp, amqp(s) or smtp URL with a username and password before the host, high; placeholders such as user:password@, ${PASS} or <pass> stay silent) and JDBC with password (a jdbc: URL with a password= or pwd= parameter, high).

None of these changes alters a surviving finding's name or matched text, so its id, mute, verdict and node-filter rules still attach. A finding that disappears (a generic overlap, a private-key marker with no key) is pruned at the next scan; a muted or judged one is kept with stale_since. GitHub Secret Hunting applies the same key-data and Yandex checks to its own rules of the same names.

Custom patterns: Upload a JSON or TXT file with additional regex patterns via the project settings UI.


2. Secret Validation

When JS_RECON_VALIDATE_KEYS is enabled, discovered secrets are tested against their respective service APIs with a single, minimally-scoped request per secret. Per-service rate limiting (1 req/sec) prevents abuse.

Supported services (21):

ServiceValidation Method
AWSSTS GetCallerIdentity
GitHub/user endpoint
GitLab/api/v4/user
Slackauth.test
Stripe/v1/charges?limit=1
Google MapsGeocode API
Twilio/Accounts
SendGrid/v3/scopes
Mailgun/domains
Mailchimp/3.0/ping
HubSpot/crm/v3/objects/contacts
Heroku/account
FirebaseRealtime Database URL: one anonymous /.json?shallow=true read. 200 (publicly readable) is validated; 401 (the database rules refuse the read) is rejected; 403 is unknown
DigitalOcean/v2/account
Telegram/getMe
Discord/users/@me
Postmark/server
Okta/api/v1/users?limit=1
Shopify/admin/api/shop.json
Cloudflare/client/v4/user
OpenAI/v1/models

Each validation returns one of the following statuses, plus scope/permissions info when available. What the provider said and what it could not tell are kept apart: only rejected means the key is dead.

StatusBadgeMeaning
validatedLIVE (red)API call confirmed the key is active and working. The scope/permissions field shows what access the key grants (e.g., user=admin, 3 scopes, database publicly readable). This is a confirmed, exploitable finding.
rejectedrejectedThe provider said it does not accept the key: a 401, or the provider's own answer (Slack invalid_auth, token_revoked…; Google "The provided API key is invalid"). The key was real at some point but no longer works; the Priority Board moves it out of the ranking (inactive). A Firebase database whose rules refuse an anonymous read (401) is rejected too ("Database locked"): the protection works, so it is never proof.
unknowncould not checkNo verdict: a timeout, a 429 or 5xx, a network error, a call the validator's circuit breaker skipped, or a 403 (often a live key missing the scope or SSO grant the check needed). The key may well be live; it stays ranked.
format_invalidmalformedThe value fails the format check of a validator that makes no call (a Twilio SID or Twitter bearer token with too little entropy).
format_validatedformat okThe value passes a format-only check; nothing was called.
unvalidatedno validatorNo automated validator exists for this secret type, or the pattern did not include a validator_ref. The key may or may not be live -- manual verification is needed. Most generic regex matches (e.g., Generic API Key) fall into this category.
incompleteincompleteA validator exists but requires additional context that was not found alongside the key. For example, AWS validation needs both the Access Key ID and Secret Key; Twilio needs both the Account SID and Auth Token. Only one half was discovered.
skippednot checkedValidation was not attempted. This happens when: (1) the Validate Keys setting is disabled in project settings, or (2) the finding has low confidence and was excluded from validation to avoid false API calls.

Findings written by an earlier release hold invalid, which mixed rejections with calls that never got an answer, and sometimes error. They keep that word until JS Recon runs again; the Priority Board still reads an invalid with a 401 as rejected and anything else as open, and a mute rule on invalid also matches rejected and format_invalid.

The TruffleHog engine

TruffleHog in the Key Validation block (jsReconTrufflehogEnabled, on by default for new projects; a project created before it existed keeps it off) runs TruffleHog 3.96.0 beside the pattern rules, over the same files: the downloaded bundles, the sources recovered from source maps, and uploaded files. It is the engine and image the Secret Multiscanner uses, here over JS Recon's files only. It reads local copies only and never fetches anything from the target. JS Recon's own rules stay for everything JavaScript-specific, including key formats TruffleHog has no detector for; TruffleHog adds its detectors and, with key validation on, its own check of the keys it finds. How it is isolated is under Security Measures.

JS Recon Key Validation block with the TruffleHog switch on and the three result classes ticked

Existing projects keep it off. ./redamon.sh update adds the setting to every existing project switched off; only projects created afterwards start with it on, and a project switched on by hand stays on through later updates. To turn TruffleHog on for every existing project that runs JS Recon (an operator's choice; it is not done for you):

UPDATE projects SET js_recon_trufflehog_enabled = true WHERE js_recon_enabled = true;

Rules TruffleHog supersedes. A rule that fired on clean library code while TruffleHog detects its key type at 99% or more, and that has no precise provider prefix, reports only what TruffleHog confirmed, when TruffleHog ran: today Travis CI Token (3 hits on 300 clean library files; TruffleHog's TravisCI detector found 199 of 200 invented tokens). A Travis CI Token hit TruffleHog matched stays, with its own id and mute; one it did not match is dropped. When TruffleHog is off, failed or missing, the rule reports exactly as before. PostgreSQL URI also fired on clean code, but TruffleHog's Postgres detector is excluded (its check dials the URI's host), so it never confirms one and the rule stays as it is.

One finding per key.

  • A key both engines find keeps JS Recon's finding: its id, name, severity and matched text, so mutes, verdicts and fix items stay attached. It gains TruffleHog:<Detector> in alternate_names and what TruffleHog said in validation_info.trufflehog.
  • A key only TruffleHog finds becomes a Secret of its own with detection_method: 'trufflehog'. It takes JS Recon's name for that key type where there is one (TruffleHog's AWS is an AWS Access Key ID, GoogleGeminiAPIKey a GCP API Key), otherwise TruffleHog's detector name, and its id is built the way JS Recon builds one. Confidence is high when TruffleHog verified it, medium otherwise. A public type is info with public_client_key, like the pattern rule's.
  • JS Recon finds the key in its file itself, because a minified bundle is one line and TruffleHog's line number says little there: line_number and the masked context come from that search. A key TruffleHog decoded (base64 inside atob(), \uXXXX escapes) is not in the file as written and gets no context.

What TruffleHog's verification can change. Only TruffleHog's "verified" changes a status: to validated, with checked_by: trufflehog. Any other answer leaves a TruffleHog-only key unknown with key validation on, because "not verified" is ambiguous (a check that cannot reach the provider answers exactly as it does for a dead key), and skipped with key validation off. TruffleHog never writes rejected; JS Recon's own validators remain the only source of it.

JS Recon's validators all stay. A key TruffleHog verified costs no second provider call. The Firebase check (the anonymous database read) and the Google Maps check (the key's API restriction) always run, because they test what the key opens rather than whether it is live. When TruffleHog verified a key and such a check did not, the key stays validated and keeps the validator's answer beside it (validator_status).

Which TruffleHog-only keys are kept. Keep TruffleHog-only keys that are (jsReconTrufflehogResults, all three by default) chooses among Verified (the provider accepted the key), Unknown (the check errored) and Unverified (not shown live, or not checkable); the last two are both stored as unknown. A key JS Recon also found is always kept. The filter applies only with key validation on: with it off nothing is verified, so every key is kept and the scan log says the filter was ignored. Nothing ticked means all three.

Found by TruffleHog. The Red Zone secrets table shows a TruffleHog-only key's source as TruffleHog (JS Recon). The JS Recon table's Detection column reads TruffleHog or Regex, its Line column shows line_number, and "also: …" lists the alternate names; the CSV, JSON and Markdown exports list them too. The Priority Board evidence for a key TruffleHog touched gains Found by: TruffleHog (<detector>), or Found by: JS Recon and TruffleHog (<detector>) for a key both engines found, and a TruffleHog-only key it could not confirm reads Validation: unknown — TruffleHog could not confirm it, which is not proof it is dead. Every other Secret's evidence is unchanged, so no earlier review expires.

JS Recon Secrets tab: Detection reads Regex or TruffleHog, and keys both engines found list "also: TruffleHog (Stripe)", "(Gitlab)" and "(TravisCI)"


3. Source Map Discovery

Discovers exposed source maps through three methods:

  1. Comment parsing -- extracts //# sourceMappingURL= and /*# sourceMappingURL= directives
  2. HTTP header checking -- looks for SourceMap and X-SourceMap response headers
  3. Path probing -- tests 8 default paths (e.g., {url}.map, {url}.js.map) plus custom probe paths

When a source map is accessible, JS Recon:

  • Extracts original source filenames (up to 100)
  • Hands each of the target's own sources with text (not node_modules or the bundler runtime, which are public code full of example keys) to every module, as a file of its own named <map URL>#<source path> (for example https://app.example.com/static/js/main.js.map#src/config.ts). A key in src/config.ts becomes a Secret with that source_url, under its own JS file node, and goes through validation like any other; a fetch("/api/v2/orders") there becomes an Endpoint; DOM sinks and developer comments are found in the readable code. A source over 2 MB, and anything past 50 MB of recovered sources in one run, is not analyzed (the run records it). A framework that every original file imports is reported once per map
  • Reports the map itself as source_map_exposure: low when it embeds the target's own source text, info when it lists only file paths, low when every source is a library. secrets_in_source counts the Secrets found in its sources. Discovery has at most half of the JS Recon timeout, so the other modules always get their share. Under an engagement rate ceiling every map request also waits for its slot (see Security Measures), and those waits count against that half: fewer files are checked for a map, and the ones left over are logged (Source-map budget spent: N JS file(s) not checked for a map) and recorded as not checked, so their hosts keep their earlier JS Recon findings
  • Reports a map that is referenced but not served as source_map_reference (info) only when that says something: an access refusal (401 or 403), or a map on another host it could not or may not reach. A 403 needs corroboration, because S3 without ListBucket, and CloudFront in front of it, refuse keys that do not exist: a 403 carrying S3 markers (<Code>AccessDenied</Code>, Server: AmazonS3, an x-amz-* header) is not reported, and otherwise one made-up sibling (<map URL>.<random>) is requested; if it is refused alike the row is dropped. A sibling check that gets no answer keeps the row, marked control_check: failed. No map is fetched from a host the Rules of Engagement exclude
  • Fetches a map only on a host of the run: one of its targets (a map on a target that served no script included), a host it fetched JavaScript from, or, in a full-discovery run, any subdomain of a scanned root. A map URL on any other host is never requested and is reported as an info source_map_reference with fetch_result: out_of_scope
  • Fetches the map URL and every redirect it answers with hop by hop (at most 5 redirects), checking each hop, the first included, before it is sent: the Rules of Engagement (the name and, with IP or CIDR entries, every address it resolves to), the scope above, then the guard that refuses internal and cloud-metadata addresses. A refused hop is not requested; a redirect loop reads as unreachable. Credential headers are dropped on a hop to another host

Custom probe paths: Upload a TXT file with additional URL templates to test.


4. Dependency Confusion Detection

Extracts scoped npm packages (@scope/package) from JavaScript code using multiple patterns:

  • ES6 imports (import ... from '@scope/pkg')
  • CommonJS requires (require('@scope/pkg'))
  • Dynamic imports (import('@scope/pkg'))
  • Export statements (export ... from '@scope/pkg')
  • Webpack chunk names

Each scoped package is checked against the public npm registry:

ConditionSeverityRisk
Package not on public npmCriticalAttacker can register the package name and inject malicious code
Package exists, and the internal-package list names itHighVerify ownership -- could be a squatted name
Registry gave no answer (timeout, connection error, rate limit, npm circuit breaker open)No findingNot checked this run (see below)

32 well-known public scopes (@types, @babel, @angular, ...) are skipped to reduce noise.

Where the finding sits: a package imported by several files gives one finding. Its source_urls lists the first five importing files in sorted order, and the finding hangs off the first of them, on that file's host. At the end-of-run prune it counts as on every host its source_urls name: when any of those hosts could not be re-checked this run (the JS Recon file cap, an unreachable host), the finding is kept.

What the finding stores: package_name, package_scope (the @scope; scope in the recon JSON), npm_exists (the registry's own yes or no; absent when the registry gave no answer, shown as - in the Dependencies table) and recommendation.

Registry gave no answer: the package is not checked, not "published". The hosts of the files that import it keep their earlier JS Recon findings (when only an upload or the internal-package list names the package, every JS Recon finding is kept), and the report's Coverage Limitations lists an npm gap and a JS Recon gap "npm registry did not answer".

Custom packages: upload a TXT file listing known internal package names (Upload 3). Each is checked even when no file imports it; one that exists on public npm is reported as High.


5. Endpoint Extraction

Deep pattern-based parsing extracts multiple endpoint types:

TypeDetection Method
REST APIfetch(), axios, $.ajax, XMLHttpRequest, Node http clients, superagent, and any receiver's .get/.post/.put/.patch/.delete/.head/.options (this.get("/v1/orders"), minified n.get("/users")), plus a request object passed to a call (r({url: "/api/export", method: "GET"}))
GraphQLGraphQL endpoint URLs, introspection queries
WebSocketnew WebSocket(), socket.io connections
Router definitionsReact Router, Vue Router, Express route patterns
Config objectsbaseURL, apiUrl, serverUrl patterns
API documentationSwagger, OpenAPI, GraphQL Playground paths
Admin/DebugAdmin panels, debug endpoints, internal tools (classified as HIGH severity)

Endpoints are categorized and deduplicated per origin, on method and path: the same /api/v1 called from bundles on two hosts becomes one endpoint on each host. A relative path takes the origin of the file it was found in, an absolute URL its own. Each one carries two labels: category holds the words every RedAmon module writes (authentication, admin, api, upload, file_access, search, dynamic, static, other), so the Priority Board, Route Exposure and the agent read a JS Recon endpoint like a crawler's; js_recon_category keeps JS Recon's own label (api_documentation, admin_debug, authentication, api, file_upload, graphql, websocket...), which Route Exposure ranks on (admin_debug ranks like admin). Query parameters are extracted from URL patterns.

The URL may be a single-, double- or backtick-quoted string, after a base the code adds in front: fetch(API_BASE + "/v2/items") yields /v2/items. A template literal keeps its literal part: axios.get(`/api/users/${id}`) is stored as path /api/users/ with path_template /api/users/${id} on the Endpoint. A path without a leading slash (api.get("v1/accounts")) counts only from a call that is HTTP by name (fetch, axios, api, http, client); from any other receiver, map.get("key"), params.get("q") or headers.get("content-type") is a lookup, not an endpoint. Express-style app.get / router.get calls stay route definitions.

Tool miss: when 20 or more files were analyzed and not one endpoint came out, the app most likely calls its API in a way the extractor does not read. The run says so in its log, sets endpoint_extraction_miss in the JS Recon scan metadata, and records a js_endpoint_extraction note in the report's Coverage Limitations, so "no endpoints" is not read as "the app calls nothing".

An endpoint's HTTP method comes from its own call: the verb the call names (axios.post(...), client.put(...), xhr.open('PATCH', ...)), then a method: or type: key in that call's own options; a call that names neither is GET. Other code on the same line, such as a postMessage in a minified bundle, never changes it.

Endpoint validation (Validate Endpoints, off by default): each extracted endpoint on an in-scope host is probed once, with GET for a GET endpoint and HEAD or OPTIONS for any other method, so nothing is changed. An accepted status makes it hittable, but a server that answers every path alike (a single-page app returning its index page) would make every endpoint hittable. So a hittable endpoint is checked against a control: the same host is asked, the same way, for a made-up path next to it. When the made-up path gets the same answer the endpoint is catch_all and, like a not_hittable one, gets no Endpoint node. A control that cannot be sent or read keeps the endpoint hittable.

Custom keywords: Upload a TXT file with additional endpoint search keywords.


6. Framework Detection, DOM Sinks & Dev Comments

Framework detection identifies 12 built-in frameworks with version extraction:

React, Next.js, Vue.js, Nuxt, Angular, jQuery, Svelte, Ember.js, Backbone.js, Lodash, Moment.js, Bootstrap

DOM sink detection flags 15 XSS-vulnerable patterns:

Sink TypeExamples
Direct injectioninnerHTML, outerHTML, document.write()
Code executioneval(), Function(), setTimeout(string), setInterval(string)
Navigationlocation.href, location.assign(), window.open()
Prototype pollution__proto__, constructor.prototype, Object.assign misuse
React-specificdangerouslySetInnerHTML

Dev comment extraction finds TODO/FIXME/HACK comments containing sensitive keywords (password, secret, admin, bypass, hardcoded).

Custom frameworks: Upload a JSON file with additional framework signatures.


7. AI SDK Detection (Phase 6 — Adversarial AI rollout)

Detects AI/LLM signals inside every JavaScript file the previous modules already downloaded. Reads from recon/helpers/ai_signal_catalog.py — the same single source of truth used by every other Adversarial AI hook. Pure pattern matching; sends no additional traffic to the target.

Five new JsReconFinding.finding_type values:

finding_typeWhat it catchesTypical severity
ai-sdk-clientVendor SDK imports shipped to the browser. openai, @anthropic-ai/sdk, @google/genai, @langchain/* (12 sub-packages), @llamaindex/*, ai/react + @ai-sdk/* (12 providers), @modelcontextprotocol/sdk, Pinecone/Qdrant/Chroma/Weaviate clients, langfuse, langsmith, portkey-ai, ollama. 65 SDK families total.medium–high
ai-sdk-key-literalHard-coded provider API keys. Two tiers: prefix-anchored (OpenAI sk-proj-*T3BlbkFJ*, Anthropic sk-ant-api03-*AA, HuggingFace hf_*, Groq gsk_*, Replicate r8_*, Langfuse sk-lf-*, Pinecone pcsk_*, OpenRouter sk-or-v1-*, etc.) and constructor-context (paired with the SDK class to suppress false positives). Includes NEXT_PUBLIC_* env-var hydration leaks and Bearer <key>/x-api-key header literals.critical
ai-sdk-browser-allowedThe OpenAI/Anthropic SDK dangerouslyAllowBrowser: true escape hatch. Catches bareword JS, terser-minified !0, and JSON-stringified "dangerouslyAllowBrowser":true (the form seen in Next.js __NEXT_DATA__ blobs).critical
ai-frontend-detectedAI-product markers in shipped JS chunks the http_probe HTML/title channels cannot see (those live in async-loaded chunks). Open WebUI WEBUI_* constants, Gradio customElements.define("gradio-app",...), Streamlit stApp testids, Flowise chatflowid, LobeChat @lobehub/*, AnythingLLM, NextChat, BetterChatGPT, SillyTavern, ComfyUI, AUTOMATIC1111, InvokeAI, Jupyter-AI, Chainlit.medium–high
ai-provider-urlProvider base URLs hard-coded in bundles. OpenAI, Anthropic, Cohere, Gemini, Vertex AI, HuggingFace Inference, Replicate, Groq, Together, DeepSeek, Perplexity, Fireworks, Mistral, xAI, OpenRouter, AWS Bedrock regional endpoints, Azure OpenAI, Helicone/Portkey/Cloudflare AI gateways, Langfuse Cloud, LangSmith API.medium

Catalogue size: 164 patterns across the 5 channels (33 prefix-anchored keys + 18 constructor-context + 65 SDK imports + 3 browser flags + 23 frontend markers + 22 provider URLs).

Constructor-context suppression. The pattern new OpenAI({apiKey: "sk-proj-...T3BlbkFJ..."}) would match both the constructor-context regex AND the prefix-anchored regex. Without dedup that's two findings for one underlying problem. The matcher records each constructor match's byte range in a "claimed" set; subsequent prefix matches whose span falls inside a claimed range are suppressed. Result: exactly one finding per leaked key, attributed to its SDK (OpenAI SDK constructor rather than generic OpenAI API Key).

Gemini disambiguation. Google's AIzaSy[A-Za-z0-9_-]{33} key shape is shared by Gemini, Maps, Firebase, YouTube Data, Translate, and Cloud Functions. A naive match would flood reports with false positives. The catalogue scans ±2KB around each match for Gemini-specific tokens (@google/genai, @google/generative-ai, GoogleGenerativeAI, generativelanguage.googleapis.com, gemini-1.5, x-goog-api-key); if any are present the finding escalates to Google Gemini API Key / critical, otherwise it stays at Google API Key (likely Maps/Firebase) / medium.

Secret enrichment (value-prefixed reuse). When an ai-sdk-key-literal finding's captured value overlaps an existing Secret node (caught earlier by the legacy JS_SECRET_PATTERNS scan), the matching Secret gets ai_provider and ai_finding_id properties set. The Cypher dedup is gated on the Secret's matched_text starting with a known AI-key prefix (sk-, hf_, lsv2_, gsk_, r8_, pcsk_, pplx-, xai-, csk-, tgp_, pa-, AIzaSy, co_, rpa_, pk-lf-, fw_) so Stripe/Slack/AWS literals that happen to co-locate in the same JS file are never wrongly enriched. Existing "show me all leaked API keys" queries automatically gain AI context: MATCH (s:Secret) WHERE s.ai_provider IS NOT NULL.

Toggle. JS Recon → AI SDK Detection (default on). Disabling skips the pass entirely; existing js_recon findings are unaffected.

Example queries.

// Sites shipping an LLM SDK to the browser
MATCH (b:BaseURL)-[:HAS_JS_FILE]->(:JsReconFinding {finding_type:'js_file'})
  -[:HAS_JS_FINDING]->(jf:JsReconFinding {finding_type:'ai-sdk-client'})
RETURN b.url, jf.sdk_name, jf.source_url AS js_file
ORDER BY b.url;

// CRITICAL: hard-coded keys in client-shipped JS
MATCH (jf:JsReconFinding {finding_type:'ai-sdk-key-literal', severity:'critical'})
RETURN jf.source_url, jf.sdk_name, jf.sample;

// Pivot from generic Secret to AI provider
MATCH (s:Secret) WHERE s.ai_provider IS NOT NULL
RETURN s.source_url, s.secret_type, s.ai_provider, s.validation_status;

For the full catalogue rationale, signal channel architecture, and per-vendor cite list see Adversarial AI Recon → JS Recon AI SDK Detection.


File Collection

JS Recon collects files from two sources:

  1. Pipeline output -- JS URLs discovered by Katana, Hakrawler, GAU, and jsluice during resource enumeration, and URLs HTTP probing found
  2. Manual uploads -- files uploaded via the JS Recon Upload API (/api/js-recon/{projectId}/upload)

The crawler's exclude list does not hide JS from JS Recon. Katana and Hakrawler drop URLs that match KATANA_EXCLUDE_PATTERNS, and the shipped list holds /static/, /_next/static, .chunk.js, .bundle.js, /dist/, /build/ and .min.js: exactly where React, Next.js and webpack apps keep their own code. Every in-scope JS URL a crawler saw is handed to JS Recon (and jsluice) before that filter. The exclude list still keeps those files out of the crawl's URL list and out of the Endpoint nodes. A partial JS Recon run reads the JS files the last run analyzed (its JS file nodes) as well as the graph's Endpoints.

Filtering rules:

  • A JS file is one whose name ends in .js, .mjs, .jsx, .ts or .tsx, also with a cache-busting suffix (app.js__v_3fa2, bundle.mjs~1, main.js-1a2b; the query string is ignored), but not app.js.map or app.js.gz. An extensionless name under /js/ or /javascript/, or a URL HTTP probing saw answer with a JavaScript Content-Type, counts too
  • Downloads from the target (the scripts, their source maps and the map probes, and the endpoint checks) do not verify the target's TLS certificate, as httpx and the crawlers do not: a self-signed or internal certificate does not hide a host's scripts. The key validators, which call a provider's API, do verify
  • At download, an HTML page is never analyzed: a single-page app answers a missing .js with its HTML shell and a 200. A JavaScript or ECMAScript Content-Type is accepted on any URL; otherwise the name must say JS (S3 and CDNs serve bundles as application/octet-stream)
  • Skipped: node_modules/, CDN libraries, jQuery/Bootstrap minified files
  • Optional: framework chunks (.chunk.js, .bundle.js), archived URLs from GAU/Wayback
  • A host the Rules of Engagement exclude is dropped, whichever source named it

Limits:

  • Max files: 10,000 (JS_RECON_MAX_FILES; 50 in stealth mode, and the memory governor can lower it). The budget is shared round-robin between hosts, so one large site cannot take it all, in a fixed order: within a host, the app's own entry points and page chunks (main, app, index, _app, pages/, chunks/) first, vendor and runtime files last. The JS Recon scan metadata records, per host, how many files there were, how many were taken and how many were cut, and a cut appears in the report's Coverage Limitations as js_recon_file_cap
  • Max file size: 5 MB per file
  • Download concurrency: 10 threads (configurable)
  • Lines longer than 500k characters are skipped to prevent regex DoS
  • Volume, measured: a 520-chunk Next.js-style site with a first-party source map per chunk (544 files, 21 MB, plus 1,046 recovered sources) is downloaded in seconds and analyzed in about a minute, at under 300 MB of memory

What a run could not re-check is kept. At the end of a run, js_recon findings it did not report again are removed, except where the run could not look:

  • no JS file came from the pipeline although the target had live URLs (Resource Enumeration off or failed, a crawl that found nothing usable), or JS Recon crashed: every earlier js_recon finding is kept;
  • the JS_RECON_MAX_FILES cap cut the file list, or an analyzer failed or timed out: the findings on the hosts of the files it did not analyze are kept, and the hosts it did analyze are cleaned up as usual.

A run with no live target at all keeps nothing back. What was cut is listed in the report's Coverage Limitations.

What each host got is recorded on it. Every web host the run looked at (each live one HTTP probing answered, each one it was handed pages on, each one serving a candidate file) gets a coverage stamp on its BaseURL: complete with how many files it read and how many findings came out, no_input when the host served no JavaScript, partial with the reason (file cap, host unreachable, analyzer failed or timed out), or failed. A host the Rules of Engagement exclude gets none, and neither does one that answered only with a 5xx and served no candidate file. A partial JS Recon run stamps the hosts it analyzed even when it found nothing, so "analyzed, nothing found" stays apart from "never analyzed". A TruffleHog run that did not complete adds trufflehog <status>: <reason> to the reason without changing the status (what it means).

JS File Sources (toggles)

Three toggles control which JS files are collected beyond the default crawler output:

ToggleDefaultDescription
Include Webpack ChunksOnAnalyze .chunk.js and .bundle.js files that Katana may exclude. These contain application code with embedded secrets
Include Framework JSOnFetch Next.js (/_next/static/chunks/) and Nuxt.js (/_nuxt/) bundles that Katana excludes. Often contain API keys and Firebase configs
Include Archived JSOnAnalyze JS files that only web archives know (GAU, URLScan, ParamSpider). Old builds often contain hardcoded keys removed from production. Off, a JS URL that only an archive reported is left out; one a crawler or HTTP probing also saw is always analyzed. Needs GAU (or URLScan) on to have anything to add

Manual JS File Upload

Upload JS files directly for analysis without crawling. This is useful for files obtained from:

  • Burp Suite -- exported JS responses from intercepted traffic
  • Mobile APKs -- extracted JavaScript bundles from hybrid mobile apps
  • Browser DevTools -- saved JS files from authenticated areas
  • Internal apps -- JS files from applications not reachable by crawlers

How to use:

  1. Open your project settings and expand the JS Recon Scanner section
  2. Scroll to Manual JS File Upload at the bottom
  3. Click Upload JS Files and select one or more files
  4. Uploaded files appear in a list with size and a delete button

Manual upload is only available in edit mode (after the project has been created).

Constraints:

RuleValue
Accepted extensions.js, .mjs, .map, .json
Max file size10 MB per file
Multiple filesYes (select multiple in the file dialog)
Storage location/data/js-recon-uploads/{projectId}/

Uploaded files are automatically merged with pipeline-discovered JS files during the scan. They can also be analyzed standalone when JS Recon runs in manual_upload mode.


Custom Extension Files

Five upload slots let you extend the built-in detection capabilities with target-specific data. These are additive -- they run alongside the defaults, never replacing them. Each upload type has client-side validation that runs before the file is sent to the server; if validation fails, a modal shows the exact error.

Custom extension files are only available in edit mode (after the project has been created). Click the Custom Extension Files collapsible header in the JS Recon settings to reveal all five slots.

Each upload slot has:

  • An Upload button to select the file
  • A display of the current file name and size (if uploaded)
  • A Delete button to remove the current file
  • A ? icon that opens a format guide modal with examples and how-it-works explanation

Upload 1: Custom Secret Patterns

Purpose: Add your own regex patterns to detect company-specific secrets, internal API key formats, or custom tokens that the built-in 90+ patterns do not cover.

Accepted formats: .json or .txt

JSON Schema

[
  {
    "name": "MyCompany API Key",
    "regex": "MYCO-[a-f0-9]{32}",
    "severity": "critical",
    "confidence": "high"
  },
  {
    "name": "Internal Service Token",
    "regex": "svc_tok_[A-Za-z0-9]{40}",
    "severity": "high",
    "confidence": "medium"
  }
]
FieldTypeRequiredValues
namestringYesDisplay name for the pattern
regexstringYesPython-compatible regex (compiled via re module)
severitystringNocritical, high, medium, low, info (default: medium)
confidencestringNohigh, medium, low (default: medium)

TXT Format

One pattern per line, pipe-delimited:

MyCompany API Key|MYCO-[a-f0-9]{32}|critical|high
Internal Token|svc_tok_[A-Za-z0-9]{40}|high|medium
# Lines starting with # are comments

Field order: name | regex | severity | confidence (severity and confidence are optional).

Validation Rules

  • JSON: Must be a non-empty array. Each item must have name (string) and regex (string). Each regex is compiled to verify syntax. severity must be one of critical/high/medium/low/info. confidence must be one of high/medium/low.
  • TXT: Each non-comment line must have at least 2 pipe-separated fields (name|regex). Each regex is compiled to verify syntax.

How It Works

Each pattern is compiled as a Python regex and applied line-by-line to every downloaded JS file. When a match is found, a finding is created with the specified severity and confidence. The matched text is redacted in the output (first 6 + last 4 chars shown). Patterns with a high false-positive rate should use confidence low.

Regex syntax: Patterns run in Python (re module), not JavaScript. Avoid JS-only syntax like (?<name>...) named groups -- use (?P<name>...) or plain capture groups instead.


Upload 2: Source Map Probe Paths

Purpose: Add extra URL path templates to probe when looking for .map source map files. The scanner already tries 8 default paths. Use this to add paths specific to your target application's build tool or CDN structure.

Accepted format: .txt

File Format

One path template per line:

{base}/assets/maps/{filename}.map
{base}/sourcemaps/{filename}.map
{base}/build/static/js/{filename}.map
{base}/_assets/{filename}.map
# Lines starting with # are comments

Template Variables

VariableExpands ToExample
{url}Full JS file URLhttps://example.com/js/app.js
{base}Scheme + hosthttps://example.com
{filename}JS filename onlyapp.js

Validation Rules

  • File must contain at least one non-comment line
  • Each line must contain either a { template variable or a / path separator

How It Works

For each downloaded JS file, the scanner first checks for a sourceMappingURL comment and SourceMap HTTP header. If neither is found, it probes each path template by replacing {url}, {base}, and {filename} with actual values and making an HTTP GET request. If a valid source map JSON (with "version" and "sources" fields) is returned, the scanner parses it, extracts original source filenames, and hands each first-party source in sourcesContent to every analysis module as a file of its own (see Source Map Discovery above).


Upload 3: Internal Package Names

Purpose: List known internal/private npm package names used by the target organization. These are ALWAYS checked against the public npm registry, even if not found in the JS code via import/require statements. This is useful when minified JS strips import names.

Accepted format: .txt

File Format

One scoped package name per line:

@mycompany/auth-sdk
@mycompany/api-client
@mycompany/shared-utils
@internal/config
@targetcorp/payment-lib
# Lines starting with # are comments

Validation Rules

  • File must contain at least one non-comment line
  • Every line must use the @scope/name format (must start with @ and contain /)
  • Well-known public scopes (@types, @babel, @angular, @vue, @react, etc. -- 32 scopes) are automatically skipped during scanning

How It Works

For each package name, the scanner makes a GET request to https://registry.npmjs.org/{package}:

npm Registry ResponseFinding SeverityMeaning
404 (not found)CriticalPackage does not exist on public npm. An attacker could register it and inject malicious code when the target runs npm install
200 (exists)HighPackage exists but is listed as "internal." Verify ownership -- could be a squatted name
No answer (timeout, connection error, rate limit, npm circuit breaker open)No findingNot checked this run: earlier JS Recon findings are kept and the report's Coverage Limitations names the gap

Results appear in the Dependencies tab of the JS Recon dashboard.


Upload 4: Endpoint Keywords

Purpose: Add extra keywords to search for in JavaScript content. When a keyword is found inside a quoted string in the JS code, the surrounding URL is extracted as a discovered endpoint. Use this for target-specific API paths that the built-in patterns might miss.

Accepted format: .txt

File Format

One keyword per line:

/internal-api/v2/
/backoffice/
mycompany-service
admin-panel
graphql-gateway
/legacy/api/
# Lines starting with # are comments

Validation Rules

  • File must contain at least one non-comment line
  • Each keyword must be at least 2 characters long

Tips

  • Use path fragments like /internal-api/ for precision
  • Use service names like mycompany-service for broader matching
  • Avoid very short keywords (< 4 chars) to reduce false positives

How It Works

For each keyword, the scanner searches all JS file content using a case-insensitive regex. When a match is found, it extracts the surrounding quoted string (the URL/path containing the keyword). Each discovered URL is classified by category (admin, debug, auth, api, etc.) and assigned a severity. Results appear in the Endpoints tab of the JS Recon dashboard.


Upload 5: Framework Signatures

Purpose: Add detection signatures for custom or internal JavaScript frameworks not covered by the 12 built-in ones. Each signature defines regex patterns that identify the framework and optionally extract its version.

Accepted format: .json

JSON Schema

[
  {
    "name": "MyCompanyFramework",
    "patterns": [
      "MyFramework\\.init",
      "__MY_FRAMEWORK__",
      "myfw-version"
    ],
    "version_regex": "MyFramework\\.version\\s*=\\s*[\"']([0-9.]+)[\"']"
  },
  {
    "name": "InternalRouter",
    "patterns": [
      "InternalRouter\\.navigate",
      "__INTERNAL_ROUTER__"
    ],
    "version_regex": null
  }
]
FieldTypeRequiredDescription
namestringYesDisplay name for the framework
patternsstring[]YesNon-empty array of regex strings. If any pattern matches, the framework is detected
version_regexstring or nullNoRegex with capture group 1 for version extraction. Set to null if not needed

JSON Escaping Rules

Since regexes live inside JSON strings, backslashes need double-escaping:

Regex IntentIn JSONNotes
Literal dot\\.One backslash + dot in JSON string
Whitespace \s\\sOne backslash + s in JSON string
Quote in regex[\"'] or ['\"]Escaped quote inside JSON

Validation Rules

  • Must be a non-empty JSON array
  • Each item must have name (string) and patterns (non-empty array of strings)
  • Every pattern string is compiled as a regex to verify syntax
  • version_regex (if not null) is compiled as a regex to verify syntax

How It Works

Each signature's patterns are compiled as Python regexes (re module) and searched in the JS file content. If any pattern matches, the framework is detected. The version_regex (if provided) is then used to extract the version number from capture group 1. Detected frameworks appear in the Security tab of the JS Recon dashboard under "Frameworks." Version information enables targeted CVE lookups.

Regex syntax: Use Python regex syntax. Avoid JS-only features like (?<name>...) named groups -- use (?P<name>...) instead.


Subdomain Feedback Loop

JS Recon extracts hostnames from discovered endpoints, source map URLs, and cloud asset URLs. New in-scope subdomains are merged back into combined_result['dns']['subdomains'] with source='js_recon', making them available to downstream pipeline modules.


Graph Integration

JS Recon creates and updates the following Neo4j node types:

Node TypeRelationshipCreated When
JsReconFinding (finding_type='js_file')(BaseURL)-[:HAS_JS_FILE]->(JsReconFinding) (or Domain for uploaded files)One per analyzed JS file; acts as the parent for all other findings
JsReconFinding (finding types below)(JsReconFinding{js_file})-[:HAS_JS_FINDING]->(JsReconFinding)Dependency confusion, source maps, DOM sinks, frameworks, dev comments, emails, internal IPs, object references (UUID/IDOR candidates), cloud assets
JsReconFinding (finding_type='external_domain')(Domain)-[:HAS_JS_FINDING]->(JsReconFinding)3rd-party domains leaked in JS URLs (no single parent JS file)
Secret(JsReconFinding{js_file})-[:HAS_SECRET]->(Secret)Discovered secrets (with source='js_recon')
Endpoint(JsReconFinding{js_file})-[:HAS_ENDPOINT]->(Endpoint)Discovered endpoints (with source='js_recon' or js_recon_source=true)

All nodes include user_id and project_id for multi-tenant isolation. Graph updates run in a dedicated background thread.

JsReconFinding finding_type values: js_file, dependency_confusion, source_map_exposure, dom_sink, dev_comment, framework, email, internal_ip, object_reference, cloud_asset, external_domain, plus the Phase 6 AI SDK values: ai-sdk-client, ai-sdk-key-literal, ai-sdk-browser-allowed, ai-frontend-detected, ai-provider-url

AI SDK findings carry extra properties beyond the core set: sdk_name (canonical vendor product name), ai_provider (mirror of sdk_name for prefix-consistent queries), sample (redacted form of captured key — first 6 chars + ... + last 4, never the full secret), byte_offset (stable across re-scans for idempotent MERGE), detection_method='ai_sdk_catalogue'.

Secret enrichment. For ai-sdk-key-literal findings, the Phase 6 mixin also enriches matching Secret nodes (caught by the legacy JS_SECRET_PATTERNS scan) with ai_provider and ai_finding_id. This means existing "all leaked secrets" queries automatically gain AI context without a parallel taxonomy.

What every JS Recon Secret records about its detection, whether TruffleHog is on or off:

  • detection_method: regex, or trufflehog for a key only TruffleHog found.
  • line_number: the line of the key in its file (on a minified bundle that is usually 1).
  • alternate_names: the other rules that matched the same key (a generic rule whose match held it, an overlapping provider rule), and TruffleHog:<Detector> when TruffleHog found it too.

With TruffleHog on, validation_info also holds a trufflehog object: the detector, whether it verified the key, a short error class (timeout, dns, network, http_<code>, error), and an allowlisted extra (account, resource type, token type, version, rotation guide). It never holds a key value. A node written before these properties existed has none of them until JS Recon runs again.

A TruffleHog run that did not complete prunes nothing of its own. When it failed, timed out, was truncated, stopped or skipped, its earlier TruffleHog-only Secrets on the files it was given are kept alive, and a key both engines found keeps what TruffleHog said about it in an earlier run. Regex findings prune as always.

// Keys TruffleHog found, alone or with JS Recon's rules
MATCH (s:Secret {source: 'js_recon'})
WHERE s.detection_method = 'trufflehog'
   OR any(a IN coalesce(s.alternate_names, []) WHERE a STARTS WITH 'TruffleHog:')
RETURN s.secret_type, s.validation_status, s.source_url, s.line_number, s.alternate_names;

JsReconFinding core properties: id, finding_type, severity, confidence, title, detail, evidence, source_url, base_url, source, discovered_at, user_id, project_id, updated_at

JsReconFinding type-specific properties:

  • cloud_asset -> cloud_provider (aws/gcp/azure), cloud_asset_type
  • external_domain -> times_seen, sample_urls
  • object_reference -> potential_idor (boolean; heuristic flag, not actual IDOR detection -- only means the value matched a UUID v4 pattern and could be worth testing manually)
  • dependency_confusion -> package_name, package_scope, npm_exists (absent when the registry gave no answer), recommendation, source_urls

Security Measures

  • Secret values -- the full key is kept (secret_value; for a key pair such as AWS, the other half in paired_secret; the code around it unmasked in raw_context) and shown in the tables as its last four characters with a button that copies the whole value. The context that reviewers and models read stays masked, and the agent's graph queries never return the display-only fields
  • Rate limiting -- per-service 1 req/sec rate limit during secret validation. Under an engagement rate ceiling every request JS Recon sends also takes a slot of the clock all of recon's own requests share: each download and source-map hop, the missing-key control, every endpoint probe and catch-all control, each key validation and each npm lookup. A target's 429 on a download, a map or an endpoint probe holds every requester back by its Retry-After; a key validator's or the npm registry's 429 does not. The waits are wall-clock time, so they count against JS_RECON_TIMEOUT
  • Target-controlled URLs are fetched hop by hop -- a JS download, a source map and each redirect they answer with are sent with redirects off and checked one hop at a time, the first URL included. Every hop passes the Rules of Engagement (the name and, with IP or CIDR entries, every address it resolves to; a refusal is logged [-][RoE] js_recon: not sent to ...) and the guard that refuses internal and cloud-metadata addresses (the run's own private hosts are still read). A JS download applies no scope of its own, so a bundle redirected to a public CDN still loads; a source map must sit on a host of the run (see Source Map Discovery)
  • File size limits -- 10 MB per JS file download, 10 MB per manual upload
  • Project isolation -- uploaded files stored in /data/js-recon-uploads/{projectId}/
  • Regex DoS prevention -- lines exceeding 500k characters are skipped

The TruffleHog sidecar

A hardened container per run. The recon container starts redamon-trufflehog:latest (TruffleHog 3.96.0) through the Docker broker, which allows only listed images and stamps the run's labels on it, so pausing or stopping the scan reaches it. It runs with --cap-drop ALL, a read-only root filesystem, /tmp as a 256 MB tmpfs, at most 256 processes and 2 CPUs, as user 10001, and a memory cap from the resource governor. The files are copied to a stage directory of their own (/tmp/redamon/js_recon_th_<run>_<id>) and mounted read-only. No credential or environment secret is passed in. Its running-time budget comes from the JS Recon timeout (15 to 600 seconds), and a paused scan does not spend it.

No network unless keys are validated. With key validation off, the container runs with --network none. With it on, it joins redamon-trufflehog-net, a plain Docker bridge (never the host network), to check keys with their providers. Stealth mode forces key validation off, so in stealth TruffleHog runs with no network.

Detectors that would dial a host from the JavaScript are excluded. The scanned JavaScript is hostile input. A verifier that connects to a host written in that text, or sends key data to a third party, would make the sidecar a probe the target steers. 33 detectors are therefore excluded, with validation on and off alike, so the findings are the same either way:

  • database, broker, directory and file-server drivers, which dial the host in the connection string (Postgres, MongoDB, JDBC, SQLServer, Redis, RabbitMQ, LDAP, FTP);
  • URI, JWT, GCP and Docker, whose verifier fetches a URL taken from the credential (the URI's host, a JWT's iss, a service account's token_uri, a registry);
  • self-hosted products whose base URL can be any host (Jira, Confluence, Bitbucket Data Center, Metabase, Portainer);
  • detectors whose provider-looking host pattern the text can escape with #, /, ?, an unescaped dot or a missing dot before the provider's domain;
  • PrivateKey, which sends a key fingerprint to keychecker.trufflesecurity.com.

The list is TRUFFLEHOG_EXCLUDED_DETECTORS in recon/helpers/js_recon/trufflehog_bridge.py, reviewed detector by detector against the TruffleHog 3.96.0 source. Review it again on every TruffleHog upgrade: a new or changed verifier can open the same hole, and TruffleHog refuses an unknown detector name (it exits with no results, recorded as failed), so the list must match the installed version. JS Recon's own rules for private keys, database URIs, credentials in URLs, JDBC strings and JWTs still run.

What key validation sends. With key validation on, every key found is sent to its own provider in a single identity-style call (AWS GetCallerIdentity, GitHub /user, Slack auth.test, …): by JS Recon's validators and, with TruffleHog on, by TruffleHog's verifiers. TruffleHog's verification cache stays on, so it checks each distinct key once per run, and a key it verified is not sent again by JS Recon (Firebase and Google Maps aside). Nothing goes to the target, but every key found is used against the third party that issued it; leave key validation off when the engagement does not allow that.

A Rules of Engagement document can only turn key validation off. jsReconValidateKeys is roe_parse: tighten_only with safe value off: a document may turn it off, and a document that proposes turning it on is refused with the reason. One side effect: replacing or removing a document that had turned it off puts it back on, and the review marks that row Widens ("relaxes a safety control"). As with any widening, confirming it pauses every enabled scan schedule, and on a third-party engagement an authorization for the new document must be recorded first (see When a change takes effect).

Image not installed. A normal install or update builds redamon-trufflehog:latest, and the orchestrator's /health reports trufflehog_available. When the image is missing, the TruffleHog toggle cannot be turned on and says TruffleHog image not installed: run ./redamon.sh update; a project that already has it on keeps it on, with a warning. A scan then logs that the image was not found, records skipped with reason image_missing, and the pattern rules run as usual. When the orchestrator does not answer, the toggle stays usable.

trufflehog <status> in a coverage reason. When the TruffleHog run did not complete, the coverage reason (BaseURL.js_recon_reason) of each host whose files it was given gains trufflehog <status>: <reason>:

StatusExample reasonWhat happened
skippedimage_missingThe image is not installed
failedexit 1, broker_refused, broker_busy, verify_network_unavailableTruffleHog exited with an error, the broker refused the container or was at its container cap, or the verification network could not be created
timed_outbudget 600sThe running-time budget ran out and the container was killed
truncatedoutput capIts output passed 64 MB or 20,000 lines; what was read before the cut is kept

The host's coverage status does not change, since JS Recon's own analysis of those files is complete, and the TruffleHog-only findings of an earlier run stay (see Graph Integration). A scan that is being stopped (stopped) adds nothing. Every status, ran included, is recorded in scan_metadata.trufflehog (Output Structure).

The staged copies are temporary. The stage directory holds copies of the target's JavaScript and is removed when the TruffleHog run ends. If the recon container is killed first, the orchestrator removes it when it reaps the run's containers or the run completes, its startup sweep removes the ones whose run has no running recon or partial-recon container (a run whose container outlived an orchestrator restart keeps its copies), and ./redamon.sh purge removes all of them.


API Endpoints

MethodPathDescription
GET/api/js-recon/{projectId}/uploadList uploaded JS files
POST/api/js-recon/{projectId}/uploadUpload a JS file for analysis (max 10 MB; .js, .mjs, .map, .json)
DELETE/api/js-recon/{projectId}/upload?name=filename.jsDelete an uploaded file
GET/api/js-recon/{projectId}/downloadDownload JS Recon scan results
GET/api/js-recon/trufflehog/availableWhether the TruffleHog image is installed: {available, reason}, the reason image_missing or an orchestrator_* code when the orchestrator did not answer

Frontend: JsReconTable

JS Recon results are displayed in the Red Zone via a dedicated table component with six sub-tabs:

TabContent
SecretsSeverity badges, each value as its last four characters with a copy button (the other half of a key pair, such as an AWS secret access key, under it), validation status, confidence, category, line, detection (Regex or TruffleHog), and the other names that matched the same key
EndpointsMethod, path, full URL, type (REST/GraphQL/WS), category, source JS file
DependenciesPackage name, scope, npm registry status, severity, recommendation
Source MapsJS URL, map URL, accessible status, discovery method, file count, embedded secrets
SecurityFrameworks (name, version), DOM sinks (type, pattern, severity), dev comments, IDOR candidates
Attack SurfaceNew subdomains, cloud assets (S3/GCP/Azure), emails, internal IPs, external domains

Features: full-text search across all fields, pagination (50 items/page), and three export formats — CSV (one file, a # Section: <name> block per category), JSON (object keyed by section name), and MD (one ## Section per category, GFM table per section). See Data Export & Import for format details.


Configuration Reference

See Project Settings Reference > JS Reconnaissance for the complete parameter table.

Quick overview:

SettingDefaultPurpose
JS_RECON_ENABLEDfalseMaster toggle
JS_RECON_MAX_FILES10000Max JS files to download
JS_RECON_CONCURRENCY10Download threads
JS_RECON_TIMEOUT900Total timeout (seconds)
JS_RECON_REGEX_PATTERNStrueSecret pattern scanning
JS_RECON_SOURCE_MAPStrueSource map discovery
JS_RECON_DEPENDENCY_CHECKtruenpm dependency confusion
JS_RECON_EXTRACT_ENDPOINTStrueEndpoint extraction
JS_RECON_DOM_SINKStrueDOM sink detection
JS_RECON_FRAMEWORK_DETECTtrueFramework detection
JS_RECON_DEV_COMMENTStrueDev comment extraction
JS_RECON_VALIDATE_KEYStrueLive secret validation, and TruffleHog's verification when TruffleHog is on. Stealth mode forces it off; a Rules of Engagement document may only turn it off
JS_RECON_TRUFFLEHOG_ENABLEDtrue (new projects)Run TruffleHog beside the pattern rules (the TruffleHog engine); a project created before it existed keeps it off
JS_RECON_TRUFFLEHOG_RESULTSverified, unknown, unverifiedWhich TruffleHog-only keys to keep; applies only with key validation on
JS_RECON_MIN_CONFIDENCElowMinimum confidence filter

Output Structure

The full JS Recon output is stored in combined_result['js_recon'] and includes:

js_recon/
  scan_metadata/       -- timestamp, mode, file count, duration, coverage
    trufflehog/        -- only with TruffleHog on: status, reason, network, counts, verification
  secrets[]            -- id, name, severity, matched_text, secret_value, paired_secret,
                          redacted_value, context, raw_context, validation status,
                          detection_method, line_number, alternate_names
  endpoints[]          -- id, method, path, type, category, source_js
  dependencies[]       -- package_name, scope, npm_exists, recommendation, severity, source_urls
  source_maps[]        -- js_url, map_url, accessible, source_files
  dom_sinks[]          -- type, pattern, severity, line
  frameworks[]         -- name, version, confidence
  dev_comments[]       -- content, type, severity, line
  cloud_assets[]       -- provider, type, url
  emails[]             -- email, category, context
  ip_addresses[]       -- ip, type (private), context
  object_references[]  -- type (uuid), value, potential_idor
  discovered_subdomains[]  -- new in-scope subdomains
  external_domains[]   -- out-of-scope domains with frequency
  summary/             -- aggregated counts by severity, type, and category

scan_metadata.trufflehog, in the recon JSON output, is there only when TruffleHog is on: status (ran, skipped, failed, timed_out, stopped, truncated), reason, network (none or bridge), results, merged (keys both engines found), new (TruffleHog-only keys kept), validated, filtered (dropped by the result filter), verify_errors, verification (ok; degraded when at least half of five or more checks errored; off) and duration_s. After a run that did not complete it also lists analyzed_urls, the files it was given. The scan log ends the step with one line: TruffleHog: N results, M merged, K new, V validated, X filtered, network=….


Execution Modes

ModeTriggerFile Source
post_reconPipeline GROUP 5b (automatic)JS URLs from resource_enum + http_probe, merged with any uploaded files
standaloneManual trigger via orchestratorCrawls target domain then analyzes (bypasses pipeline)
manual_uploadUploaded files present during post_reconUploaded files merged with pipeline-discovered URLs

JS Recon runs independently of resource enumeration. When resource_enum is active, pipeline-discovered JS URLs are merged with any uploaded files. When resource_enum is disabled, JS Recon analyzes uploaded files only. If neither source has files, JS Recon exits gracefully with zero findings.


Next Steps