Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

CI: add gitleaks secret-scan step

AkitaOnRails0baf6e125d89
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5a87e38d..02a07563 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,3 +59,20 @@ jobs:
- uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
+
+ gitleaks:
+ name: gitleaks (secret scan)
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ # Full history so the scan covers every commit reachable
+ # from the pushed ref, not just the last one.
+ fetch-depth: 0
+ - uses: gitleaks/gitleaks-action@v2
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # Exit nonzero if any secret is found; config lives at the
+ # repo root so the same rules apply locally if you also
+ # install gitleaks.
+ GITLEAKS_CONFIG: .gitleaks.toml
diff --git a/.gitleaks.toml b/.gitleaks.toml
new file mode 100644
index 00000000..770975a5
--- /dev/null
+++ b/.gitleaks.toml
@@ -0,0 +1,60 @@
+# gitleaks configuration for ai-memory.
+#
+# Wired into CI via `.github/workflows/ci.yml`'s `gitleaks` job. Runs
+# on every push and PR; fails the build if a credential-shaped value
+# lands in any tracked file.
+#
+# The default ruleset (Google API keys, Anthropic, OpenAI, Slack, AWS,
+# GitHub PATs, …) covers what ai-memory's own sanitiser covers. We
+# inherit it and only ADD an allowlist for the specific test fixtures
+# we deliberately ship.
+#
+# Lesson from M18: a previous iteration of sanitize.rs used a live
+# Gemini key as a test fixture and Google's automated scanner caught
+# it within hours of push. This config exists so the next time a fake
+# fixture is added, it follows the same shape the allowlist accepts —
+# and any DRIFT from those shapes (i.e. a real key showing up) fails
+# CI loudly before push.
+
+title = "ai-memory secret-scan config"
+
+[extend]
+useDefault = true
+
+# Fail-closed: do NOT add any path-based allowlist that would exempt
+# whole directories. Every exemption below is a specific string with a
+# rationale.
+
+[allowlist]
+description = "Deliberate test fixtures + documented placeholders"
+regexes = [
+ # ---- Test fixtures inside `sanitize.rs` ----
+ # Every sanitize-test uses an obvious "0123456789…" / "abcdef…" /
+ # "deadbeefcafebabe" pattern so a reader can tell at a glance
+ # that the value is fake.
+ '''AIzaSy0123456789[A-Za-z0-9_\-]+''',
+ '''sk-or-v1-deadbeefcafebabe[0-9a-f]+''',
+ '''sk-ant-leak-[0-9a-f]+''',
+ '''sk-leak-[0-9a-f]+''',
+ '''ghp_FAKE[A-Z0-9]+''',
+ '''github_pat_FAKE[A-Z0-9_]+''',
+ '''AKIAFAKE[A-Z0-9]+''',
+ '''Bearer abcdef0123456789ABCDEF0123456789''',
+ '''xoxb-1234567890-abcdefghij''',
+
+ # ---- Canary string used by the e2e test in tests/e2e/ ----
+ '''sk-canary-LEAK_ME_PLEASE_[a-z0-9_]+''',
+
+ # ---- Documented placeholders in README/docs/.env.production.example ----
+ '''sk-(ant-|or-v1-|)\.\.\.''',
+ '''sk-or-v1-REPLACE_ME''',
+ '''sk-REPLACE_ME''',
+ '''REPLACE_WITH_OUTPUT_OF_GENERATE_AUTH_TOKEN''',
+]
+
+# Path-based exemptions — kept minimal. tests/e2e/ uses a few canary
+# strings we want to ship intentionally; the regexes above already
+# cover them but excluding the path is cheap defence-in-depth.
+paths = [
+ '''tests/e2e/.*\.sh''',
+]