Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gatiella/GitGuard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” GitGuard - Secrets & API Key Scanner

Prevent credential leaks before they happen. Scan your code for exposed secrets in seconds.

GitHub Stars License: MIT PRs Welcome Security

A lightweight, privacy-first secrets scanner that runs entirely in your browser. Detect API keys, passwords, tokens, and other sensitive credentials before they leak into your repository.

GitGuard Demo

🎯 Why GitGuard?

79% of developers have accidentally committed secrets to repositories - and it only takes minutes for automated bots to discover and exploit them.

GitGuard helps you:

  • βœ… Catch secrets before they're committed
  • βœ… Scan code locally with zero data transmission
  • βœ… Support 50+ credential types and platforms
  • βœ… Export findings for compliance reports
  • βœ… No installation or setup required

πŸš€ Quick Start

Option 1: Use Online (Fastest)

Visit: https://yourusername.github.io/gitguard

Option 2: Clone & Run Locally

git clone https://github.com/yourusername/gitguard.git
cd gitguard
open index.html

Option 3: Use in CI/CD

# GitHub Actions example
- name: Scan for secrets
  run: |
    curl -o scanner.html https://raw.githubusercontent.com/yourusername/gitguard/main/index.html
    # Add headless browser scanning

πŸ“– How to Use

1. Paste Code

Copy and paste code from any file, commit, or configuration

2. Upload Files

Drag and drop multiple files (.env, .js, .py, .yml, etc.)

3. Review Results

See detected secrets organized by severity with exact line numbers

4. Export Reports

Download findings as JSON or CSV for documentation

πŸ” What We Detect

Cloud Providers

Platform Patterns Detected
AWS Access Keys, Secret Keys, Session Tokens
Google Cloud API Keys, OAuth Tokens, Service Account Keys
Azure Client Secrets, Storage Keys, Connection Strings
DigitalOcean Personal Access Tokens, Spaces Keys
Heroku API Keys, Auth Tokens

API Keys & Tokens

Service Detection
OpenAI API Keys (sk-...)
Anthropic Claude API Keys (sk-ant-...)
Stripe Secret Keys, Restricted Keys, Publishable Keys
GitHub Personal Access Tokens, OAuth Tokens
GitLab Personal Access Tokens, CI/CD Tokens
Slack Bot Tokens, User Tokens, Webhooks
Twilio Account SIDs, Auth Tokens, API Keys
SendGrid API Keys
Mailgun API Keys, Webhooks

Database Credentials

  • MySQL connection strings
  • PostgreSQL URLs
  • MongoDB connection strings
  • Redis passwords
  • Database passwords

Authentication

  • JWT tokens
  • OAuth tokens
  • Session tokens
  • API authentication headers
  • Bearer tokens

Cryptographic Keys

  • RSA private keys
  • EC private keys
  • OpenSSH private keys
  • PGP private keys
  • Certificate files

Package Managers

  • NPM tokens
  • PyPI tokens
  • Docker Hub tokens
  • Maven credentials
  • Composer auth tokens

Social Media

  • Facebook access tokens
  • Twitter API keys
  • LinkedIn tokens
  • Instagram tokens

Total: 50+ Detection Patterns

🎨 Features

Privacy First

  • βœ… 100% Client-Side - Your code never leaves your browser
  • βœ… No Server - Nothing is uploaded or stored
  • βœ… No Analytics - We don't track anything
  • βœ… No Accounts - Use immediately, no sign-up

Advanced Detection

  • πŸ” Regex Patterns - Industry-standard detection rules
  • 🎯 Context-Aware - Reduces false positives
  • πŸ“Š Severity Ratings - Critical, High, Medium, Low
  • πŸ”’ Line Numbers - Exact location of each finding

Developer Friendly

  • πŸ’» Multiple Input Methods - Paste, upload, or drag-and-drop
  • πŸ“ Multi-File Support - Scan entire directories
  • πŸ“€ Export Options - JSON and CSV formats
  • 🎨 Clean Interface - Intuitive and professional

Security Features

  • πŸ‘οΈ Blur by Default - Secrets are hidden until revealed
  • 🚨 Instant Alerts - Critical findings highlighted
  • πŸ“‹ Copy Protection - Easy to copy for rotation
  • πŸ”’ No History - Scans are not logged

πŸ“Š Example Scan Results

// ❌ CRITICAL - AWS Credentials Detected
const AWS_ACCESS_KEY = "AKIAIOSFODNN7EXAMPLE";
const AWS_SECRET_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY";

// ❌ CRITICAL - Stripe Secret Key
const stripe = require('stripe')('sk_live_4eC39HqLyjWDarjtT1zdp7dc');

// ❌ HIGH - Database Connection String
const DB_URL = "postgres://admin:password123@localhost:5432/mydb";

// ❌ HIGH - OpenAI API Key
const openai = new OpenAI({ apiKey: 'sk-proj-abc123xyz789' });

// βœ… SAFE - Environment Variable Reference
const apiKey = process.env.API_KEY;

πŸ›‘οΈ Best Practices

Prevention

  1. Never commit secrets to version control
  2. Use environment variables for all credentials
  3. Scan before committing with pre-commit hooks
  4. Rotate immediately if a secret is exposed
  5. Use secret managers (AWS Secrets Manager, HashiCorp Vault)

Detection

  • Run GitGuard before every commit
  • Scan dependencies and third-party code
  • Check configuration files regularly
  • Review .env files before sharing
  • Audit old commits for historical leaks

Response

If you find exposed secrets:

  1. ⚠️ Revoke immediately - Don't wait
  2. πŸ”„ Rotate credentials - Generate new keys
  3. πŸ” Check logs - See if they were accessed
  4. πŸ“ Document incident - Track for compliance
  5. πŸ› οΈ Fix process - Prevent recurrence

πŸ”§ Advanced Usage

Pre-Commit Hook

#!/bin/bash
# .git/hooks/pre-commit

# Scan staged files for secrets
STAGED_FILES=$(git diff --cached --name-only)

for file in $STAGED_FILES; do
    if grep -qE 'AKIA[0-9A-Z]{16}|sk-[a-zA-Z0-9]{20,}' "$file"; then
        echo "❌ Potential secret detected in $file"
        echo "Run GitGuard to review before committing"
        exit 1
    fi
done

VS Code Integration

Create a task in .vscode/tasks.json:

{
  "label": "Scan for Secrets",
  "type": "shell",
  "command": "open https://yourusername.github.io/gitguard",
  "problemMatcher": []
}

GitHub Actions Workflow

name: Secret Scan
on: [push, pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Scan for secrets
        run: |
          # Add your scanning logic here
          echo "Scanning for secrets..."

πŸ†š Comparison

Feature GitGuard TruffleHog GitLeaks Gitleaks
Browser-based βœ… ❌ ❌ ❌
No installation βœ… ❌ ❌ ❌
Privacy-first βœ… ⚠️ ⚠️ ⚠️
Real-time scan βœ… ❌ ❌ ❌
50+ patterns βœ… βœ… βœ… βœ…
Export reports βœ… βœ… βœ… βœ…
Free & open source βœ… βœ… βœ… βœ…

πŸ“ˆ Statistics

According to recent studies:

  • 73% of Fortune 500 companies have leaked secrets
  • 3 minutes average time for exposed AWS keys to be exploited
  • $4.24M average cost of a data breach in 2023
  • 2,500+ GitHub commits with secrets every hour

Don't be a statistic. Scan with GitGuard.

🀝 Contributing

We welcome contributions! Here's how:

Add New Patterns

{
    name: 'Service Name',
    category: 'Category',
    regex: /your-pattern-here/g,
    severity: 'critical|high|medium|low',
    example: 'example-key-format'
}

Submit Issues

  • πŸ› Bug reports
  • ✨ Feature requests
  • πŸ“š Documentation improvements
  • 🎨 UI/UX suggestions

Pull Request Process

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/new-pattern)
  3. Test your changes thoroughly
  4. Commit with clear messages
  5. Push and create PR

πŸ—ΊοΈ Roadmap

Version 2.0

  • Custom pattern builder
  • Historical git commit scanning
  • Chrome/Firefox extension
  • CLI version for terminal use
  • Integration with popular IDEs

Version 2.5

  • AI-powered false positive reduction
  • Automatic secret rotation suggestions
  • Team collaboration features
  • Compliance reporting (SOC2, ISO 27001)

Version 3.0

  • Real-time scanning as you type
  • Integration with secret managers
  • Automated remediation workflows
  • Enterprise features

πŸ“„ License

MIT License - Free for commercial and personal use

Copyright (c) 2024 Your Name

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software.

πŸ™ Acknowledgments

Built with inspiration from:

  • TruffleHog - Git secret scanner
  • GitLeaks - Secret detection tool
  • OWASP - Security best practices
  • The open-source security community

πŸ“ž Support

⚠️ Disclaimer

GitGuard is a detection tool, not a prevention system. While it detects many common secret patterns, it cannot guarantee 100% accuracy. Always:

  • Review findings manually
  • Use in combination with other security tools
  • Follow security best practices
  • Never commit real secrets to test the scanner

🌟 Star History

Star History Chart


⬆ back to top

Made with πŸ” by developers who've learned the hard way

🚨 Scan Early | πŸ”’ Scan Often | πŸ›‘οΈ Stay Safe

πŸ’‘ Pro Tips

  1. Scan daily - Make it part of your workflow
  2. Educate your team - Share this tool with colleagues
  3. Automate scanning - Add to CI/CD pipeline
  4. Keep patterns updated - New services emerge constantly
  5. Report false positives - Help us improve

πŸ“š Additional Resources

Learning

Tools


Remember: The best time to scan for secrets was before your first commit. The second best time is now.

⭐ Star this repo if it saved you from a security incident!

About

Advanced Secrets & API Key Scanner - Protect Your Code, Protect Your Business

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages