8000 GitHub - rominirani/hackathon-safe-starter: πŸ›‘οΈ Hackathon security template with pre-configured Gitleaks, pre-commit hooks, GitHub Actions, and secure code patterns for Gemini, Firebase, GCP, and more. Β· GitHub
[go: up one dir, main page]

Skip to content

About

πŸ›‘οΈ Hackathon security template with pre-configured Gitleaks, pre-commit hooks, GitHub Actions, and secure code patterns for Gemini, Firebase, GCP, and more.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

2 Commits

Folders and files

Repository files navigation

πŸ›‘οΈ Hackathon Safe Starter

Stop leaking API keys. This template project has all the automated security guardrails pre-configured so you can vibe-code safely at hackathons.

What's Included

Guardrail What It Does When It Runs
.gitignore Prevents .env, *.pem, serviceAccountKey.json from ever being tracked Always
.gitleaks.toml Custom rules to catch GCP, Firebase, Gemini, AWS, Stripe, and GitHub secrets With gitleaks
Pre-commit hook Blocks commits containing secrets before they hit your local git history Every git commit
GitHub Action Scans every push and PR for leaked secrets in CI/CD Every push/PR
.env.example Template for all your environment variables (safe to commit) Reference

Quick Start

1. Use this template

Click "Use this template" on GitHub, or clone it:

git clone https://github.com/rominirani/hackathon-safe-starter.git my-hackathon-project
cd my-hackathon-project

2. Install the tools

# Install gitleaks (secret scanner)
brew install gitleaks        # macOS
# OR: See https://github.com/gitleaks/gitleaks#installing for other OS

# Install pre-commit (hook manager)
pip install pre-commit

# Install the git hooks
pre-commit install

3. Set up your environment

# Copy the template
cp .env.example .env

# Edit .env and add your real API keys
# ⚠️  .env is in .gitignore β€” it will NEVER be committed

4. Start coding!

The guardrails are active. If you accidentally try to commit a secret, gitleaks will block it:

$ git commit -m "add feature"
gitleaks...................................................................Failed
- hook id: gitleaks
- exit code: 1

Finding:     client = genai.Client(api_key="AIzaSy...")
Secret:      AIzaSy...
RuleID:      google-api-key

Try It Yourself β€” Test the Guardrails

See tests/test_secrets/INSTRUCTIONS.md for hands-on exercises.

Quick test:

# Copy a fake secret out of the safe directory
cp tests/test_secrets/fake_gemini_key.py ./leaked.py

# Try to commit it
git add leaked.py
git commit -m "oops"
# πŸ›‘οΈ BLOCKED by gitleaks!

# Clean up
git rm --cached leaked.py && rm leaked.py

Sample Secure Code

File What It Shows
samples/secure_gemini.py βœ… Gemini API with env vars
samples/secure_firebase.js βœ… Firebase config with Vite env vars
samples/secure_cloud_storage.py βœ… GCS with Application Default Credentials
samples/secure_groq.js βœ… Groq/OpenAI with env vars

Project Structure

hackathon-safe-starter/
β”œβ”€β”€ .github/workflows/
β”‚   └── security-scan.yml      ← GitHub Action: scans every push/PR
β”œβ”€β”€ .gitignore                  ← Blocks .env, *.pem, keys from tracking
β”œβ”€β”€ .gitleaks.toml              ← Custom detection rules
β”œβ”€β”€ .pre-commit-config.yaml     ← Pre-commit hook config
β”œβ”€β”€ .env.example                ← Safe template (commit this!)
β”œβ”€β”€ samples/                    ← Secure code examples
β”‚   β”œβ”€β”€ secure_gemini.py
β”‚   β”œβ”€β”€ secure_firebase.js
β”‚   β”œβ”€β”€ secure_cloud_storage.py
β”‚   └── secure_groq.js
β”œβ”€β”€ tests/test_secrets/         ← Fake secrets for testing guardrails
β”‚   β”œβ”€β”€ INSTRUCTIONS.md
β”‚   β”œβ”€β”€ fake_aws_key.txt
β”‚   β”œβ”€β”€ fake_gcp_key.json
β”‚   β”œβ”€β”€ fake_gemini_key.py
β”‚   β”œβ”€β”€ fake_github_token.txt
β”‚   └── fake_stripe_key.txt
β”œβ”€β”€ README.md                   ← You are here
└── WALKTHROUGH.md              ← Step-by-step participant guide

The Golden Rules

  1. Never hardcode secrets β€” use environment variables
  2. Always have a .gitignore β€” block .env and key files
  3. Install the pre-commit hook β€” it's your last line of defense before a push
  4. Copy .env.example to .env β€” fill in your values there
  5. Rotate immediately if you ever leak a key β€” assume it's compromised

Resources


Built with πŸ”’ for hackathon participants everywhere. Vibe code safely!

About

πŸ›‘οΈ Hackathon security template with pre-configured Gitleaks, pre-commit hooks, GitHub Actions, and secure code patterns for Gemini, Firebase, GCP, and more.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0