A secret scanner with Shannon-entropy analysis, provider-specific rules and SARIF output. Part of the AI Security Lab collection.
SecretSentinel finds credentials before they reach a remote. It uses two layers:
named rules for known token formats (AWS, GitHub, Slack, Stripe, JWT, private keys,
database URIs) and an entropy heuristic for unknown high-randomness values assigned
to token, secret, password or api_key variables. It has zero npm dependencies —
it runs on Node's built-in TypeScript support and node:test.
A leaked key is one of the cheapest attacks in the book. SecretSentinel is designed to be the check that runs in CI and in a pre-commit hook, so the key never gets committed:
npx github:Sakibpedia/secretsentinel scan . --format sarif > secrets.sarifExit status is 1 when anything is found, 0 when clean — which is what CI expects.
Node 22.6+ is required (for --experimental-strip-types). No npm install needed.
git clone https://github.com/Sakibpedia/secretsentinel.git
cd secretsentinel
npm test
node --experimental-strip-types src/cli.ts scan .# Human-readable
node --experimental-strip-types src/cli.ts scan .
# JSON for another tool
node --experimental-strip-types src/cli.ts scan src config --format json
# SARIF for GitHub code scanning / VS Code
node --experimental-strip-types src/cli.ts scan . --format sarif > secrets.sarif
# Only high-confidence findings, without the entropy heuristic
node --experimental-strip-types src/cli.ts scan . --min-severity high --no-entropy#!/bin/sh
node --experimental-strip-types secretsentinel/src/cli.ts scan "$@" || exit 1import { scanPath } from "./src/scanner.ts";
import { toSarif } from "./src/sarif.ts";
const results = scanPath("src", { minSeverity: "high" });
console.log(JSON.stringify(toSarif(results), null, 2));Raw secrets never leave the scanner. Findings store only redacted (first four
and last four characters). Both --format json and --format sarif serialize redacted
values only — verified by tests. There is a dedicated SECURITY.md.
Directory scanning skips .git, node_modules, dist, build, .venv, vendor and
__pycache__, plus common binary extensions.
| Rule | Severity | Example |
|---|---|---|
AWS_ACCESS_KEY |
high | AKIA... / ASIA... |
GITHUB_TOKEN |
high | ghp_, gho_, ghu_, ghs_, ghr_ |
SLACK_TOKEN |
high | xoxb-, xoxp-, ... |
PRIVATE_KEY |
high | -----BEGIN RSA PRIVATE KEY----- |
GOOGLE_API_KEY |
high | AIza... |
STRIPE_KEY |
high | sk_live_..., rk_test_... |
DATABASE_PASSWORD |
high | postgres://user:pass@host |
JWT |
medium | three-part signed token |
GENERIC_API_KEY |
medium | api_key = "..." |
PASSWORD_ASSIGNMENT |
medium | password = "..." |
HIGH_ENTROPY_VALUE |
medium | long random value in a secret-named variable |
npm test28 tests cover entropy maths, every rule, redaction, sorting, severity filtering, directory walking, SARIF structure and the CLI. Tested on Node 22 (22.6+ required).
secretsentinel/
├── src/entropy.ts Shannon entropy + redaction
├── src/rules.ts provider rules
├── src/scanner.ts rule engine, file/directory walking
├── src/sarif.ts SARIF 2.1.0 writer
├── src/cli.ts CLI
├── fixtures/ synthetic secrets for tests (all fake)
└── test/ 28 tests
MIT © S M Nazmuz Sakib (2026).