New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details β†’
Socket
Book a DemoSign in
Socket

secretshield

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secretshield

πŸ›‘οΈ SecretShield is a CLI tool that detects API keys and sensitive credentials before you commit code.

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

πŸ”’ SecretShield

Secure your commits before they go public!

SecretShield is a powerful, blazing-fast CLI tool to scan your codebase for hardcoded secrets like API keys, tokens, database passwords, and more. Avoid accidental leaks and secure your development workflow in seconds.

npm license issues downloads

πŸš€ Features

  • πŸ” Comprehensive scanning of staged files for sensitive data
  • 🧠 Detects over 127+ secret patterns
  • ⚑ Fast and efficient CLI execution
  • 🎨 Colorful logs using Chalk
  • πŸ”„ Easy integration with Git hooks and CI/CD
  • πŸ” Prevents accidental commits of secrets

πŸ“¦ Installation

You can install SecretShield globally or use it with npx.

Option 1 – Run directly without install:

npx secret-shield

Option 2 – Install globally:

npm install -g secret-shield

Option 3 – Install locally (for projects):

npm install --save-dev secret-shield

πŸ› οΈ How to Use

Once installed, simply run:

npx secret-shield

Or, if installed globally:

secretshield

This will scan your staged files (those added via git add) for any potential secrets.

Example Output

βœ… SecretShield CLI is working!
πŸ” SecretShield scanning staged files...
πŸ“‚ Files to scan: [ './.env', './app.js' ]
🚨 Possible secret found in ./app.js at line 12
πŸ”Ž Matched Line: API_KEY="sk_live_1234567890abcdef"
❌ Commit blocked. Secrets detected!

🧠 Supported Secret Patterns

SecretShield currently detects over 127 patterns across multiple categories:

πŸ”‘ Authentication & Security

  • βœ… API Keys (Google, Twitter, Facebook, etc.)
  • βœ… JWT and OAuth Tokens
  • βœ… 2FA/MFA Secrets
  • βœ… PGP/GPG Keys
  • βœ… SSH Private Keys
  • βœ… SSL Certificates

☁️ Cloud Services

  • βœ… AWS (Access Keys, Secret Keys, Session Tokens)
  • βœ… Azure (Keys, Secrets, Tokens)
  • βœ… Google Cloud Platform
  • βœ… Firebase & Supabase
  • βœ… Vercel & Netlify
  • βœ… Digital Ocean, Heroku, Vultr, Linode
  • βœ… Alibaba Cloud, Oracle Cloud, IBM Cloud

πŸ’Ύ Database & Storage

  • βœ… MongoDB, MySQL, PostgreSQL
  • βœ… Redis, RabbitMQ, Cassandra
  • βœ… Elasticsearch, Neo4j
  • βœ… S3, CloudFront, Rackspace
  • βœ… Backblaze Storage

πŸ’³ Payment Processing

  • βœ… Stripe (Secret & Publishable Keys)
  • βœ… PayPal (Client ID & Secret)
  • βœ… Square, Braintree, Adyen
  • βœ… Klarna, Wise

πŸ“± Social Media & Communication

  • βœ… Twitter, Facebook, Instagram
  • βœ… LinkedIn, Discord, Telegram
  • βœ… Slack, TikTok, Pinterest
  • βœ… Twitch, Reddit, Snapchat

πŸ“§ Email Services

  • βœ… SendGrid, Mailchimp
  • βœ… Mailgun, Postmark
  • βœ… Amazon SES, SparkPost
  • βœ… SMTP Credentials

πŸ› οΈ DevOps & Infrastructure

  • βœ… Docker, Kubernetes
  • βœ… GitHub, GitLab, Bitbucket
  • βœ… Jenkins, Travis CI, CircleCI
  • βœ… Ansible Vault, Terraform
  • βœ… Cloudflare

πŸ“Š Analytics & Monitoring

  • βœ… Mixpanel, Segment
  • βœ… Amplitude, Datadog
  • βœ… New Relic

πŸ” Search & Cache

  • βœ… Algolia, Elastic
  • βœ… Memcached

πŸ—ΊοΈ Maps & Location

  • βœ… Google Maps
  • βœ… Mapbox, TomTom

πŸ“ž SMS & Voice

  • βœ… Twilio (Auth Token, Account SID)
  • βœ… Nexmo (Vonage)
  • βœ… Plivo, Sinch

πŸ”„ Generic Patterns

  • βœ… Connection Strings
  • βœ… Credential URLs
  • βœ… Generic Secrets & Keys
  • βœ… Private Key Files

πŸ”§ You can also customize the regex for your org in future versions!

πŸ”„ Git Hook Setup (Optional)

Add this to your pre-commit hook:

#!/bin/sh
npx secret-shield
if [ $? -ne 0 ]; then
  echo "❌ SecretShield blocked your commit!"
  exit 1
fi

Or use tools like husky to integrate it smoothly into your dev workflow.

πŸ›‘οΈ Security

If you discover a vulnerability or a false negative, please do not report it publicly. Instead, reach out securely: πŸ“§ support@decodedev.in

🚫 Ignoring Specific Lines

If you need to ignore a specific line that contains a secret (for example, if it's a test value or a public key), you can add a special comment to that line. SecretShield will skip any line that contains this comment.

Supported Comment Formats:

const API_KEY = "test-key-123"; // secretshield: safe to push
const DB_PASSWORD = "test-pass-456"; /* secretshield: safe to push */
const SECRET_TOKEN = "test-token-789"; /*secretshield: safe to push */
const AUTH_KEY = "test-auth-012"; //secretshield: safe to push

⚠️ Important: Use this feature carefully and only for legitimate cases where the secret is safe to commit (like test values, public keys, or intentionally public tokens).

πŸ§‘β€πŸ’» Author

Arunq Singh Pundir GitHub – @Arunsinghpundir

πŸ“ƒ License

Licensed under the MIT License

🌟 Support the Project

If you find SecretShield useful:

  • ⭐ Star the repo on GitHub
  • πŸ“’ Share it with your developer friends
  • πŸ’¬ Suggest improvements or contribute!

β€œThe best time to protect secrets was yesterday. The second best time is now.” πŸ”

Keywords

cli

FAQs

Package last updated on 14 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts