Fix Python runner; add gitleaks secret scanning
- All Python jobs now install python3-pip via apt first (runner image has no pip by default) - Added secret-scan job: gitleaks v8.21.2 scans full git history on every push/PR with --redact to avoid leaking found secrets in logs - Added .gitleaks.toml allowlisting deploy/hooks-lxc*.json files (webhook HMAC secrets are intentional config, not leaks) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,8 +37,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install ruff
|
- name: Install pip and ruff
|
||||||
run: python3 -m pip install ruff
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq python3-pip
|
||||||
|
python3 -m pip install ruff
|
||||||
|
|
||||||
- name: Check syntax errors
|
- name: Check syntax errors
|
||||||
run: python3 -m ruff check matrixbot/ --select E9,F63,F7,F82 --output-format=github
|
run: python3 -m ruff check matrixbot/ --select E9,F63,F7,F82 --output-format=github
|
||||||
@@ -52,8 +54,27 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install pip-audit
|
- name: Install pip and pip-audit
|
||||||
run: python3 -m pip install pip-audit
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq python3-pip
|
||||||
|
python3 -m pip install pip-audit
|
||||||
|
|
||||||
- name: Audit matrixbot dependencies
|
- name: Audit matrixbot dependencies
|
||||||
run: python3 -m pip_audit -r matrixbot/requirements.txt
|
run: python3 -m pip_audit -r matrixbot/requirements.txt
|
||||||
|
|
||||||
|
secret-scan:
|
||||||
|
name: Secret scan (gitleaks)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install gitleaks
|
||||||
|
run: |
|
||||||
|
curl -sSL https://github.com/gitleaks/gitleaks/releases/download/v8.21.2/gitleaks_8.21.2_linux_x64.tar.gz \
|
||||||
|
| tar -xz gitleaks
|
||||||
|
mv gitleaks /usr/local/bin/gitleaks
|
||||||
|
|
||||||
|
- name: Scan for secrets
|
||||||
|
run: gitleaks detect --source . --config .gitleaks.toml --redact --exit-code 1
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
[extend]
|
||||||
|
useDefault = true
|
||||||
|
|
||||||
|
[[allowlists]]
|
||||||
|
description = "Webhook HMAC secrets in hook config files are intentional"
|
||||||
|
paths = ['''deploy/hooks-lxc\d+\.json''']
|
||||||
Reference in New Issue
Block a user