Unignored Local SQLite Database or SQL Dump
Flags unignored local database files (.sqlite, .sqlite3, .db) and SQL dumps (.sql) that frequently contain real user records, session tokens, or production snapshots.
- Rule Slug
- unignored-sqlite-database-dump
- Affected Files
- *.sqlite, *.sqlite3, *.db, *.sql
- Detection Method
- .gitignore Cross-Check
Vulnerable Pattern vs. Hardened Fix
# Project root with unignored local database & export
├── prisma/
│ └── dev.db # Unignored SQLite database
├── prod_backup_2026.sql # Unignored SQL dump!
└── .gitignore# .gitignore
*.sqlite
*.sqlite3
*.db
*.sql
!migrations/**/*.sql
!prisma/migrations/**/*.sql*.sqlite
*.sqlite3
*.db
*.sqlWhy This Fails in Production
During local development and production debugging, developers routinely export database snapshots (backup.sql, prod_dump.sql) or run embedded SQLite databases (dev.db, db.sqlite3, database.sqlite) right inside the project directory. Because these files live alongside application code, forgetting to add them to .gitignore leads to entire database dumps being committed straight into Git.
Database files and SQL dumps carry dual security and operational risks. First, snapshots pulled from staging or production to reproduce a bug almost always contain sensitive customer PII: emails, phone numbers, billing addresses, password hashes, OAuth refresh tokens, and internal API keys stored in settings tables. Committing a single SQL dump turns a code repository into a full-blown data breach with GDPR, HIPAA, or SOC 2 notification consequences.
Second, binary SQLite files bloat Git repository history permanently because Git cannot compute compact text diffs across binary database pages. Every schema migration or local test run committed to Git duplicates the entire binary file inside .git/objects, slowing down clones and CI pipelines indefinitely.
PushCheck inspects all discovered .sqlite, .sqlite3, .db, and .sql files against your .gitignore configuration (excluding intentional migration directories like migrations/*.sql if you explicitly organize schema files there) and blocks unignored database dumps before they leave your machine.
Remediation Steps
- 1Add *.sqlite, *.sqlite3, *.db, and dump patterns (such as *.sql or dumps/*.sql) to your root .gitignore.
- 2If you intentionally track SQL schema migrations (e.g., prisma/migrations/ or supabase/migrations/), ignore root dumps specifically (/*.sql, *dump*.sql, *backup*.sql) and never store real user data in migration files.
- 3If a production SQL dump was accidentally pushed, purge it from Git history immediately with git-filter-repo, rotate any tokens or API keys stored in database tables, and initiate your incident response procedure.
- 4Use anonymized synthetic seed scripts (seed.ts / seed.py) instead of committing raw database files.
Frequently Asked Questions
- My project legitimately tracks SQL schema migrations. How should I handle .gitignore?
- You can ignore all .sql files globally and add a negation rule for your migration directory (e.g., *.sql followed by !migrations/**/*.sql), which PushCheck’s .gitignore parser understands natively.
- Can PushCheck scan large 50MB SQLite files without crashing my browser?
- Yes! PushCheck skips reading binary contents of .sqlite/.db files and detects them purely through fast filename and .gitignore matching inside the Web Worker.
- Why is committing dev.db risky even if it only has test data?
- Local dev databases often accumulate real developer emails, OAuth tokens from manual testing, or copied production rows over time. Committing binary files also causes permanent Git repository bloat and merge conflicts.