Skip to content

bug: test.db SQLite binary committed to repository — remove & gitignore #282

@d-oit

Description

@d-oit

Problem

test.db (a SQLite binary file) is committed to the repository root. This causes several issues:

  1. Security risk: Leaks database schema, table structure, and potentially sensitive test data publicly
  2. Repository pollution: Binary diffs are unreadable and pollute git log
  3. CI conflicts: Multiple CI jobs may race to read/write the same committed file
  4. Misleading: Suggests the database file should be tracked, confusing contributors

Steps to Reproduce

git ls-files | grep \.db
# outputs: test.db

file test.db
# SQLite 3.x database

Fix

1. Remove from git tracking

git rm --cached test.db
git rm --cached "**/*.db" 2>/dev/null || true

2. Update .gitignore

# Databases
*.db
*.db-shm
*.db-wal
*.sqlite
*.sqlite3
test.db

3. Update CI to use temp directories

# In CI workflow, set DB path to temp dir:
env:
  DATABASE_URL: /tmp/test-${{ github.run_id }}.db
  TEST_DB_PATH: /tmp/test-${{ github.run_id }}.db

4. Add note in CONTRIBUTING.md

Add a section clarifying:

  • Database files are generated at runtime and should never be committed
  • Use npm run db:reset or equivalent to recreate local test DB
  • The schema is maintained in migration files, not the binary DB file

5. Add pre-commit hook via Husky

# .husky/pre-commit (add check)
if git diff --cached --name-only | grep -E '\.db$|\.sqlite$'; then
  echo "ERROR: Attempting to commit database file. Add *.db to .gitignore."
  exit 1
fi

Acceptance Criteria

  • test.db removed from git index via git rm --cached
  • .gitignore updated with *.db, *.sqlite, *.db-shm, *.db-wal
  • CI workflow uses temp directory for test DB
  • CONTRIBUTING.md updated with DB handling notes
  • Husky pre-commit hook prevents accidental DB commits

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: securitySecurity-relatedbugSomething is not workingsecuritySecurity vulnerability

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions