File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Security Enforcement
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches : [ feature/pre-commit-test ]
7+
8+ jobs :
9+ security :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+ with :
16+ fetch-depth : 0
17+
18+ # Block .log files anywhere in repo
19+ - name : Block .log files
20+ run : |
21+ if git ls-files | grep -E "\.log$"; then
22+ echo "❌ .log files detected. Remove them before merge."
23+ exit 1
24+ fi
25+
26+ # Run Gitleaks (NO LICENSE REQUIRED)
27+ - name : Run Gitleaks
28+ uses : gitleaks/gitleaks-action@v2
29+ with :
30+ config-path : .gitleaks.toml
Original file line number Diff line number Diff line change @@ -22,4 +22,8 @@ Gemfile.lock
2222# IDE files
2323.idea /
2424* .iml
25- zscaler-root-ca.crt *
25+ zscaler-root-ca.crt *
26+
27+ # Log files
28+ * .log
29+ logs /
Original file line number Diff line number Diff line change 1+ title = " Gitleaks Config"
2+
3+ [[rules ]]
4+ id = " generic-api-key"
5+ description = " Generic API Key"
6+ regex = ''' (?i)(api[_-]?key|apikey|secret|token)\s*[:=]\s*['"]?[A-Za-z0-9_-]{20,}['"]?'''
7+
8+ [[rules ]]
9+ id = " hardcoded-password"
10+ description = " Hardcoded password"
11+ regex = ''' (?i)(password|passwd|pwd)\s*[:=]\s*['"][^'"\n]{4,}['"]'''
Original file line number Diff line number Diff line change 1+ repos :
2+ # Basic hygiene
3+ - repo : https://github.com/pre-commit/pre-commit-hooks
4+ rev : v4.6.0
5+ hooks :
6+ - id : check-added-large-files
7+ - id : end-of-file-fixer
8+
9+ # Block .log files
10+ - repo : local
11+ hooks :
12+ - id : block-log-files
13+ name : Block .log files
14+ entry : bash -c 'if git diff --cached --name-only | grep -E "\.log$"; then echo "❌ .log files are not allowed"; exit 1; fi'
15+ language : system
16+ stages : [pre-commit]
17+
18+ # Secret detection
19+ - repo : https://github.com/gitleaks/gitleaks
20+ rev : v8.18.4
21+ hooks :
22+ - id : gitleaks
You can’t perform that action at this time.
0 commit comments