Updated Jul 14, 2026

Static Code Analysis

Scan client-side JS for leaked API keys and JWTs

secretfinder is an open-source Python tool, built on LinkFinder, that discovers sensitive data in JavaScript files such as API keys, access tokens, authorization headers, and JWTs, using jsbeautifier together with targeted regular expressions.

installgit clone https://github.com/m4ll0k/SecretFinder.gitcd SecretFinderpip3 install -r requirements.txt

Python · GPL-3.0 license

Agent

overview

What secretfinder does

SecretFinder scans JavaScript for sensitive data left in client-side code: API keys, access tokens, authorization values, JWTs, and similar credentials. It beautifies scripts with jsbeautifier, then matches a large regular expression set.

Pass -i a URL, file, or folder. -e extracts every JavaScript link on a page and processes each one. -c and -H reach authenticated scripts, -r filters endpoints, and -b reads Burp-exported captures offline.

Run it after a crawler harvests JS when the secrets you care about live in browser-served scripts. For Git history leaks use gitleaks; for vulnerable library versions use Retire.js.

source github.com/m4ll0k/SecretFinder

use cases

Where secretfinder fits

Pull secrets out of client-side JS

Scan an app's JavaScript for API keys, tokens, JWTs, and authorization values that were shipped to the browser by mistake.

Extract and process every JS link

Point -e at a page so SecretFinder finds each JavaScript link and runs the secret scan on every one, instead of a single script at a time.

Reach authenticated scripts

Pass cookies with -c and headers with -H so scripts that only load for a logged-in session are fetched and scanned for secrets.

Review Burp-captured traffic

Feed a Burp-exported file with -b so JavaScript captured during a proxied session is scanned offline for leaked credentials.

reference

secretfinder inputs and flags

11 inputs
NameTypeFlagDescription
input-stringSTRING-iInput a URL to scan.
input-fileFILE-iInput a file to scan.
input-folderFOLDER-iInput a folder of JavaScript to scan.
extract-all-js-linksBOOLEAN-eExtract all JavaScript links on a page and process them.
cookieSTRING-cAdd cookies for authenticated JS files.
headersSTRING-HSet headers ("Name:Value\nName:Value").
filtering-regexSTRING-rRegEx to filter found endpoints (e.g. ^/api/).
support-burp-exported-fileBOOLEAN-bSupport a Burp-exported file as input.

Showing key inputs. secretfinder exposes 11 inputs in total.

Full flag reference (11 inputs)
NameTypeFlagDescription
proxySTRING-pSet proxy (host:port).
cookieSTRING-cAdd cookies for authenticated JS files.
headersSTRING-HSet headers ("Name:Value\nName:Value").
input-fileFILE-iInput a file to scan.
input-folderFOLDER-iInput a folder to scan.
input-stringSTRING-iInput a URL to scan.
filtering-regexSTRING-rRegEx for filtering purposes against found endpoints (e.g. ^/api/).
only-process-thisSTRING-nProcess a JS URL only if it contains the provided string (string;string2..).
ignore-if-containsSTRING-gIgnore a JS URL if it contains the provided string (string;string2..).
extract-all-js-linksBOOLEAN-eExtract all JavaScript links located in a page and process them.
support-burp-exported-fileBOOLEAN-bSupport a Burp-exported file as input.

example

Run secretfinder

secretfinder · command
# scan every JS link on a page, print findings to the terminal
python3 SecretFinder.py -i https://example.com/ -e -o cli
sample output
[ + ] URL: https://example.com/static/app.min.js
google_api	->	['AIzaSyD-EXAMPLE0000000000000000000000000']
aws_access_key	->	['AKIAEXAMPLE0000000000']
authorization_bearer	->	['Bearer eyJhbGciOiJIUzI1NiEXAMPLE.payload.sig']
[ + ] URL: https://example.com/static/vendor.js
heroku_api_key	->	['00000000-0000-0000-0000-000000000000']
slack_token	->	['xoxb-000000000000-EXAMPLE00000000000000']
possible_creds	->	['password = "changeme-example"']

guidance

Choosing secretfinder

Reach for SecretFinder when the secrets you care about live in JavaScript served to the browser. For secrets across Git history use gitleaks; for vulnerable JS library versions rather than leaked keys, Retire.js fits better.

linkfinder

Base project SecretFinder extends; focused on extracting endpoints from JS.

rex

Runs custom regex rules across a directory or repository rather than JS specifically.

retire-js

Finds vulnerable JavaScript library versions instead of leaked secrets in JS.

faq

secretfinder questions

Sensitive data left in client-side code: API keys, access tokens, authorization headers, JWTs, and similar credentials, each matched by a named regular expression after jsbeautifier runs.

Point -i at the page URL and add -e so SecretFinder extracts each JavaScript link and scans every one. Narrow with -n to process only URLs containing a string, or -g to ignore URLs that contain one.

No. It reads JavaScript via a URL, file, or folder, not commit history. Use gitleaks or similar for repository history; use SecretFinder for the live JS surface.

Supply cookies with -c and headers with -H so scripts that load only for a logged-in session are fetched. Combine with -e to walk every JavaScript link behind that session.

Yes. Pass -b with a Burp-exported file so JavaScript captured during a proxied session is scanned offline.

SecretFinder hunts leaked credentials inside JS source. Retire.js flags known-vulnerable library versions. Use both when you need secrets and dependency risk.

Run secretfinder yourself

A set of JavaScript URLs feeds SecretFinder, which beautifies and regex-scans each one and writes any leaked secrets as a queryable output.

Facts on this page come from the live Trickest tool library.