Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions .github/workflows/safety-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ jobs:
with:
fetch-depth: 0

- name: Install gitleaks
run: |
GITLEAKS_VERSION="8.21.2"
curl -sSfL "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
| tar xz -C /usr/local/bin gitleaks

- name: Run gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gitleaks detect --source . --verbose

forbidden-patterns:
name: Check forbidden patterns
Expand All @@ -47,7 +51,8 @@ jobs:
if grep -rEn "$pattern" --include='*.rs' --include='*.py' \
--include='*.toml' --include='*.yml' --include='*.yaml' \
--include='*.md' --include='*.json' --include='*.sh' \
. 2>/dev/null | grep -v '.git/' | grep -v 'safety-gate.yml'; then
. 2>/dev/null | grep -v '.git/' | grep -v 'safety-gate.yml' \
| grep -v 'CLAUDE.md' | grep -v '.pre-commit-config.yaml'; then
echo "::error::Forbidden pattern found: $pattern"
FAILED=1
fi
Expand All @@ -74,5 +79,5 @@ jobs:
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Tests
run: cargo test --workspace
- name: Tests (excluding unsolved exercises)
run: cargo test --workspace --exclude ch01-exercises
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ repos:
hooks:
- id: forbidden-patterns
name: Check for forbidden patterns
entry: bash -c 'grep -rEn "192\.168\.[0-9]+\.[0-9]+|/home/[a-z][a-z0-9_-]+/|geforcenuc|gnuc[^a-z]|server1[^a-z]|BEGIN (RSA|DSA|EC|OPENSSH) PRIVATE KEY" --include="*.rs" --include="*.py" --include="*.toml" --include="*.yml" --include="*.yaml" --include="*.md" --include="*.json" --include="*.sh" "$@" && echo "::error::Forbidden pattern found" && exit 1 || exit 0'
entry: bash -c 'grep -rEn "192\.168\.[0-9]+\.[0-9]+|/home/[a-z][a-z0-9_-]+/|geforcenuc|gnuc[^a-z]|server1[^a-z]|BEGIN (RSA|DSA|EC|OPENSSH) PRIVATE KEY" --include="*.rs" --include="*.py" --include="*.toml" --include="*.yml" --include="*.yaml" --include="*.md" --include="*.json" --include="*.sh" "$@" | grep -v "CLAUDE.md" | grep -v ".pre-commit-config.yaml" && echo "::error::Forbidden pattern found" && exit 1 || exit 0'
language: system
types: [text]
Loading