Skip to content

Commit 6b05d68

Browse files
CardealCardeal
authored andcommitted
🔐 Add Gitleaks secret scanning workflow and config
1 parent 5198f14 commit 6b05d68

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/gitleaks.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Gitleaks Secret Scanner - GitHub Actions Workflow
2+
# Add this file to: .github/workflows/gitleaks.yml in each repository
3+
4+
name: Gitleaks Secret Scan
5+
6+
on:
7+
push:
8+
branches: ["main", "master", "develop"]
9+
pull_request:
10+
branches: ["main", "master", "develop"]
11+
schedule:
12+
# Scan daily at 2am UTC (substitute for GitGuardian 24/7 monitoring)
13+
- cron: "0 2 * * *"
14+
15+
jobs:
16+
gitleaks:
17+
name: 🔐 Secret Scan
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # Full history for complete scan
24+
25+
- name: Run Gitleaks
26+
uses: gitleaks/gitleaks-action@v2
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
# Optional: Report to SARIF for GitHub Security tab
30+
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: true
31+
GITLEAKS_ENABLE_SUMMARY: true
32+
33+
# Optional: Notify on Slack when secrets are found
34+
# - name: Notify Slack on Failure
35+
# if: failure()
36+
# uses: 8398a7/action-slack@v3
37+
# with:
38+
# status: ${{ job.status }}
39+
# fields: repo,message,commit,author
40+
# env:
41+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.gitleaks.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Gitleaks Configuration
2+
# Add this file to the root of each repository as: .gitleaks.toml
3+
4+
title = "Lunes Platform Gitleaks Config"
5+
6+
[extend]
7+
# Use default rules
8+
useDefault = true
9+
10+
# Allowlist - paths/patterns to ignore
11+
[allowlist]
12+
description = "Allowlisted files and patterns"
13+
paths = [
14+
'''node_modules''',
15+
'''vendor''',
16+
'''\.git''',
17+
'''package-lock\.json''',
18+
'''yarn\.lock''',
19+
'''pnpm-lock\.yaml''',
20+
'''Cargo\.lock''',
21+
'''\.env\.example''',
22+
'''\.env\.sample''',
23+
'''test/''',
24+
'''tests/''',
25+
'''__tests__/''',
26+
'''\.test\.''',
27+
'''\.spec\.''',
28+
'''mock''',
29+
'''fixture'''
30+
]
31+
32+
# Custom rules for Lunes-specific patterns
33+
[[rules]]
34+
id = "lunes-wallet-key"
35+
description = "Lunes Wallet Private Key"
36+
regex = '''lunes[_-]?(?:private[_-]?key|secret)['":\s]*[=:]\s*['"]?[A-Za-z0-9+/=]{32,}['"]?'''
37+
tags = ["key", "lunes", "wallet"]
38+
39+
[[rules]]
40+
id = "substrate-seed-phrase"
41+
description = "Substrate/Polkadot Seed Phrase"
42+
regex = '''(?i)(seed|mnemonic)['":\s]*[=:]\s*['"]?(\w+\s+){11,23}\w+['"]?'''
43+
tags = ["seed", "substrate", "polkadot"]

0 commit comments

Comments
 (0)