Skip to main content

Secret Detection

cyscan detects hardcoded credentials with 296 provider-specific patterns, entropy-based analysis, and optional liveness verification.

Quick Start

cyscan scan . # includes secret detection
cyscan scan . --verify # also verify if secrets are live
cyscan scan /path/to/.env # scan .env files

Three Detection Layers

1. Pattern-Based (296 rules)

Provider-specific regex patterns from the GitLeaks rule set plus Cybrium additions:

CategoryProvidersCount
CloudAWS (4), Azure (4), GCP (3), DigitalOcean (2), Alibaba (2)15
Source ControlGitHub (5), GitLab (12), Bitbucket (2)19
CommunicationSlack (8), Discord (3), Teams, Telegram13
PaymentStripe (3), PayPal, Square (2), Flutterwave (3)9
Email/SMSSendGrid, Mailgun, Mailchimp, Postmark, Twilio (2)7
DatabasePostgreSQL, MySQL, MongoDB, Redis URIs4
CI/CDNPM (2), PyPI, RubyGems, NuGet, Docker Hub, CircleCI8
MonitoringDatadog (2), New Relic (4), Sentry (3), PagerDuty, Grafana (3), Splunk15
SaaSShopify (4), Heroku (2), Cloudflare (3), Netlify, Vercel, etc.30+
AIOpenAI (2), Anthropic (2), HuggingFace (2), Cohere, Replicate8
CryptoRSA, OpenSSH, EC, PGP, PKCS8 private keys6
GenericPassword/secret/token/API key assignments, Bearer auth, connection strings8

2. Entropy-Based Detection

Catches secrets that don't match any known pattern by measuring Shannon entropy:

CharsetThresholdMin Length
Hex strings>= 3.0 bits/char20 chars
Base64 strings>= 4.0 bits/char20 chars
Generic strings>= 4.5 bits/char16 chars

False positive suppression: UUIDs, git SHAs, URLs, file paths, semver, repeated characters, CSS colors, and known safe key names are automatically excluded.

3. Liveness Verification (--verify)

Tests if detected credentials are actually valid via safe, read-only API calls:

ProviderWhat it checksIdentity returned
GitHubGET /usergithub.com/username
GitLabGET /api/v4/usergitlab.com/username
SlackGET /api/auth.testworkspace/user
StripeGET /v1/charges?limit=1Account access
OpenAIGET /v1/modelsAPI access
AnthropicGET /v1/modelsAPI access
HuggingFaceGET /api/whoami-v2Username
DatadogGET /api/v1/validateAPI access
NPMGET /-/whoaminpm/username
Docker HubGET /v2/userdocker.io/username
DigitalOceanGET /v2/accountAccount email
CloudflareGET /client/v4/user/tokens/verifyToken valid
+ 8 more...

Live secrets are escalated to CRITICAL severity with the message prefixed VERIFIED LIVE SECRET.

File Coverage

cyscan scans these file types for secrets:

  • All source code files (Python, JavaScript, Go, Java, Ruby, etc.)
  • .env, .env.local, .env.production, .env.staging
  • .npmrc, .pypirc, .netrc, .pgpass, .git-credentials
  • .pem, .key, .crt, .cert files
  • JSON, YAML, TOML, INI configuration files
  • Dockerfile, Kubernetes manifests, Terraform files