Skip to content

meklasdev/sentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Sentinel

The Rust-powered Secret Scanner | Pre-commit Hook | Zero Leaks

Typing SVG

โšก Quick Insights

Crates.io License Downloads


๐Ÿ› ๏ธ The Engine

Core
Features
CI/CD

๐Ÿš€ Installation

cargo install sentinel_cli

sentinel init

๐ŸŽฏ The Problem

Every day, developers accidentally push secrets to GitHub:

  • ๐Ÿ”‘ AWS keys โ†’ $10,000 bill overnight
  • ๐Ÿ—๏ธ Database passwords โ†’ Production breach
  • ๐ŸŽซ API tokens โ†’ Unauthorized access

Traditional solutions are slow, bloated, or cloud-dependent.


โœจ The Solution

Sentinel is a blazing-fast, privacy-first secret scanner written in Rust. It runs locally as a pre-commit hook and blocks commits containing:

โœ… AWS Access Keys
โœ… OpenAI API Keys
โœ… Stripe Secrets
โœ… GitHub Tokens
โœ… Private Keys
โœ… Database Credentials
โœ… High-entropy strings (custom secrets)


๐Ÿš€ Quick Start

1๏ธโƒฃ Install Sentinel

# Via Cargo (Rust package manager)
cargo install sentinel_cli

# Or build from source
git clone https://github.com/meklasdev/sentinel.git
cd sentinel
cargo build --release

2๏ธโƒฃ Initialize Git Hook

cd your-project
sentinel init

This creates a .git/hooks/pre-commit hook that automatically scans staged files.

3๏ธโƒฃ Commit with Confidence

git add .
git commit -m "feat: add new feature"

If secrets are detected, the commit is blocked โŒ


๐Ÿ“– Usage

Manual Scan

# Scan specific files
sentinel scan file1.py file2.js

# Scan with custom entropy threshold
sentinel scan --entropy 5.0 config.yaml

# Fail with exit code 1 if secrets found (for CI/CD)
sentinel scan --fail src/**/*.rs

Pre-commit Hook

# Install hook
sentinel init

# Force overwrite existing hook
sentinel init --force

Scan Staged Files (Manual Pre-commit)

sentinel pre-commit

๐Ÿ” Detection Methods

1. 100+ Regex Pattern Matching ๐ŸŽฏ

Sentinel includes 100+ battle-tested regex patterns organized by category:

โ˜๏ธ Cloud Providers (11 patterns)

  • AWS (Access Keys, Secret Keys, Session Tokens)
  • Azure (Storage Keys, Client Secrets)
  • Google Cloud (API Keys, OAuth Tokens, Service Accounts)
  • DigitalOcean, Heroku, Cloudflare

๐Ÿค– AI/ML Providers (6 patterns)

  • OpenAI (API Keys, Organization Keys)
  • Anthropic (Claude API Keys)
  • Hugging Face, Cohere, Replicate

๐Ÿ”ง Version Control & CI/CD (9 patterns)

  • GitHub (PAT, OAuth, App Tokens, Refresh Tokens)
  • GitLab, Bitbucket
  • CircleCI, Travis CI, Jenkins

๐Ÿ’ณ Payment Processors (5 patterns)

  • Stripe (API Keys, Webhook Secrets)
  • PayPal, Square, Braintree

๐Ÿ’ฌ Messaging & Communication (8 patterns)

  • Slack (Tokens, Webhooks)
  • Discord (Bot Tokens, Webhooks)
  • Telegram, Twilio, SendGrid, Mailgun

๐Ÿ—„๏ธ Databases (6 patterns)

  • MongoDB, PostgreSQL, MySQL, Redis
  • Firebase, Supabase (JWT Keys)

๐Ÿ“Š Analytics & Monitoring (4 patterns)

  • Datadog, New Relic, Sentry, Segment

๐Ÿ“ฑ Social Media & OAuth (3 patterns)

  • Facebook, Twitter, LinkedIn

๐Ÿ” Crypto & Keys (3 patterns)

  • Private Keys (RSA, EC, OpenSSH, DSA, PGP)
  • SSH Keys, PGP Keys

๐ŸŒ Generic Patterns (6 patterns)

  • Generic API Keys, Secrets, Passwords
  • JWT Tokens, NPM Tokens, PyPI Tokens, Docker Hub

2. Entropy Analysis ๐Ÿงฎ

Detects high-entropy strings (randomness) that likely indicate secrets:

// Example: This would be flagged
let api_key = "aB3$xK9#mP2@qL7!nR5%wT8&yU4*zV1^";

Default threshold: 4.5 bits (configurable via --entropy)


๐ŸŽจ Example Output

โš  2 secret(s) detected:

โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿ” AWS Access Key ID in src/config.rs
   ๐Ÿ“ Line 42
   ๐Ÿ’ก AWS Access Key ID detected
   ๐Ÿ”‘ AKIAIOSFODNN7EXAMPLE
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
๐Ÿ” OpenAI API Key in .env
   ๐Ÿ“ Line 5
   ๐Ÿ’ก OpenAI API Key detected
   ๐Ÿ”‘ sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

โœ— Commit blocked due to detected secrets!
๐Ÿ’ก Remove the secrets and try again.

๐Ÿ›ก๏ธ Why Sentinel?

Feature Sentinel Gitleaks TruffleHog
Language ๐Ÿฆ€ Rust Go Python
Speed โšก Blazing Fast Slow
Privacy ๐Ÿ”’ 100% Local Local Cloud Option
Entropy Analysis โœ… Built-in โœ… โœ…
Pre-commit Hook โœ… Auto-install Manual Manual
Colored Output ๐ŸŽจ Beautiful Basic Basic

๐Ÿงช Testing

# Run unit tests
cargo test

# Run with coverage
cargo tarpaulin --out Html

๐Ÿค Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push and open a PR

๐Ÿ“œ License

MIT ยฉ meklasdev


๐Ÿ”— Connect With Me

โญ Star this repo if you find it useful!

Made with ๐Ÿฆ€ Rust by meklasdev

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages