Rules

.env file not in .gitignore

SR-SEC-003 · Medium

Env files usually hold the database password, API keys and webhook secrets for your app. If .env is not listed in .gitignore, one git add . commits it, and every push sends those secrets to the remote and to anyone who can see the repo. The fix is to add .env* to .gitignore, keep a .env.example with names but no values, and check with git ls-files that no env file is already tracked. If one was committed, remove it from the index and rotate every secret it contained.

The fix

Before · .gitignore
node_modules
.next
After · .gitignore
node_modules
.next
.env*
!.env.example

How ShipReady finds it

ShipReady finds every .env and .env.* file in the repo and reports it when .gitignore does not mention .env. An env file inside public/ is reported as SR-WEB-007 instead. Findings carry rule ID SR-SEC-003.

Run the check

Terminal
npx @shipmate-agency/shipready check .
GitHub Action
# .github/workflows/shipready.yml
name: ShipReady
on: [push, pull_request]

permissions:
  contents: read
  security-events: write

jobs:
  shipready:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: deeflect/shipready@v0.2.0

Want a person to check every area and send the fixes as pull requests? Launch Lockdown, $950 once.