Skip to content

Commit 2fdf44a

Browse files
committed
ci: add gitleaks secret scan
1 parent 4d080d2 commit 2fdf44a

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ jobs:
6262
- name: Format check
6363
run: cargo fmt --all --check
6464

65+
secrets:
66+
name: gitleaks
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
with:
72+
fetch-depth: 0
73+
74+
- name: Scan for secrets
75+
uses: gitleaks/gitleaks-action@v2
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
GITLEAKS_ENABLE_COMMENTS: "false"
79+
6580
test:
6681
name: cargo test (${{ matrix.os }})
6782
runs-on: ${{ matrix.os }}

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ Docs deps are pinned in `requirements-docs.txt`. Recommended local setup:
4545
- `make docs-venv` (creates `.venv-docs/` and installs deps)
4646
- `make docs`
4747

48+
## Secrets scanning (CI)
49+
50+
CI runs `gitleaks` on PRs/pushes to catch accidentally committed secrets.
51+
52+
- Optional local check: `make secrets-check` (requires `gitleaks` installed)
53+
4854
## Release preflight (maintainers)
4955

5056
- `loopforge release check --tag vX.Y.Z`

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help fmt fmt-check test docs docs-venv check
1+
.PHONY: help fmt fmt-check test docs docs-venv secrets-check check
22

33
help:
44
@echo "LoopForge (meos) common targets:"
@@ -7,6 +7,7 @@ help:
77
@echo " make test - cargo test (workspace, locked)"
88
@echo " make docs - mkdocs build --strict (uses .venv-docs if present)"
99
@echo " make docs-venv - create .venv-docs and install docs deps"
10+
@echo " make secrets-check - run gitleaks (if installed)"
1011
@echo " make check - fmt-check + test + docs"
1112

1213
fmt:
@@ -29,4 +30,11 @@ docs-venv:
2930
python3 -m venv .venv-docs
3031
.venv-docs/bin/pip install -r requirements-docs.txt
3132

33+
secrets-check:
34+
@command -v gitleaks >/dev/null 2>&1 || { \
35+
echo "gitleaks is not installed (CI runs it automatically). Install gitleaks, then re-run: make secrets-check"; \
36+
exit 1; \
37+
}
38+
gitleaks detect --source . --no-git
39+
3240
check: fmt-check test docs

0 commit comments

Comments
 (0)