From d92aba50f0eb09d974b29bcbd7a5c39ca55fc175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Magyar?= Date: Thu, 4 Jun 2026 12:28:59 +0100 Subject: [PATCH] fix(ci): stabilize gitleaks after #2024 (#2027) * fix(ci): stabilize gitleaks after #2024 and clear history false positive Fetch PR base/head SHAs before gitleaks-action so fork PRs do not fail with ambiguous revision ranges. Add .gitleaks.toml allowlist for fake keys in http-embedder tests, rename the redaction probe key, and point the README CI badge at abhigyanpatwari/GitNexus. Co-authored-by: Cursor * fix(ci): restore gitleaks default rules and narrow allowlist Add [extend] useDefault = true so default secret rules run again. Replace file-level allowlist with regexes for known fake embedding API keys. Route PR SHAs through env vars in the gitleaks fetch step. Co-authored-by: Cursor * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Cursor --- .github/workflows/gitleaks.yml | 12 ++++++++++++ .gitleaks.toml | 12 ++++++++++++ README.md | 4 +++- gitnexus/test/unit/http-embedder.test.ts | 5 +++-- 4 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 .gitleaks.toml diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index 7cfc3bc52..f5e9af170 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -38,6 +38,18 @@ jobs: # steps (and Gitleaks itself) don't need it for repo operations. persist-credentials: false + # gitleaks-action builds `base^..head` for pull_request events; both SHAs + # must exist locally (fork PRs and shallow checkouts otherwise fail with + # "unknown revision" — see gitleaks/gitleaks-action#199). + - name: Fetch PR refs for gitleaks range + if: github.event_name == 'pull_request' + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + git fetch --no-tags origin "$BASE_SHA" + git fetch --no-tags origin "$HEAD_SHA" + # No GITLEAKS_LICENSE secret is required for OSS / public-repo usage. # If this repo becomes private, the action will require a license key. - name: Gitleaks diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 000000000..769b7eee9 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,12 @@ +title = "GitNexus" + +[extend] +useDefault = true + +# Fake embedding API keys in unit tests (current probe + historical placeholder). +[allowlist] +description = "fake embedding API keys in http-embedder unit tests" +regexes = [ + '''secret-key-12345''', + '''test-api-key-redaction-check''', +] diff --git a/README.md b/README.md index d8d1e7c92..28229c98c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![CI](https://github.com/Arvuno/gitnexus/actions/workflows/ci.yml/badge.svg)](https://github.com/Arvuno/gitnexus/actions) # GitNexus **⚠️ Important Notice:** GitNexus has NO official cryptocurrency, token, or coin. Any token/coin using the GitNexus name on Pump.fun or any other platform is **not affiliated with, endorsed by, or created by** this project or its maintainers. Do not purchase any cryptocurrency claiming association with GitNexus. @@ -23,6 +22,9 @@ OpenSSF Scorecard + + CI Workflows +

Enterprise (SaaS & Self-hosted) - akonlabs.com

diff --git a/gitnexus/test/unit/http-embedder.test.ts b/gitnexus/test/unit/http-embedder.test.ts index 4ac683095..c19bb4825 100644 --- a/gitnexus/test/unit/http-embedder.test.ts +++ b/gitnexus/test/unit/http-embedder.test.ts @@ -206,7 +206,8 @@ describe('HTTP embedding backend', () => { it('excludes API key from error messages', async () => { process.env.GITNEXUS_EMBEDDING_URL = 'http://test:8080/v1'; process.env.GITNEXUS_EMBEDDING_MODEL = 'test-model'; - process.env.GITNEXUS_EMBEDDING_API_KEY = 'secret-key-12345'; + const redactionProbeKey = 'test-api-key-redaction-check'; + process.env.GITNEXUS_EMBEDDING_API_KEY = redactionProbeKey; vi.stubGlobal('fetch', vi.fn().mockResolvedValue({ ok: false, status: 500 })); @@ -214,7 +215,7 @@ describe('HTTP embedding backend', () => { try { await embedText('test'); } catch (e: any) { - expect(e.message).not.toContain('secret-key-12345'); + expect(e.message).not.toContain(redactionProbeKey); expect(e.message).not.toContain('Authorization'); } });