Skip to content

Commit

Permalink
Merge pull request #702 from GSA-TTS/pre-commit-no-env
Browse files Browse the repository at this point in the history
Add a basic check to look for .env files
  • Loading branch information
debjudy authored Dec 18, 2024
2 parents f776ad8 + c73fb93 commit fb27f4e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,20 @@ repos:
description: Detect hardcoded secrets using Gitleaks
language: docker_image
entry: zricethezav/gitleaks:v8.15.0 protect --verbose --redact --staged

# fail if a commit includes a file named '.env'
# BAD:
# .env
# foo/.env
#
# Good:
# sample.env
# env.sample
# share/examples/sample.env
- repo: local
hooks:
- id: no-dotenv-files
name: "Files named .env are not allowed."
entry: "Files may not be named .env"
language: fail
files: "^(.*[/])?[.]env$"

0 comments on commit fb27f4e

Please sign in to comment.