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 <cursoragent@cursor.com>

* 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 <cursoragent@cursor.com>

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Gergő Magyar 2026-06-04 12:28:59 +01:00 • committed by GitHub
parent ab1d744243
commit d92aba50f0
4 changed files with 30 additions and 3 deletions

View file

@ -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

12
.gitleaks.toml Normal file
View file

@ -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''',
]

View file

@ -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 @@
<a href="https://securityscorecards.dev/viewer/?uri=github.com/abhigyanpatwari/GitNexus">
<img src="https://api.securityscorecards.dev/projects/github.com/abhigyanpatwari/GitNexus/badge" alt="OpenSSF Scorecard"/>
</a>
<a href="https://github.com/abhigyanpatwari/GitNexus/actions/workflows/ci.yml">
<img src="https://github.com/abhigyanpatwari/GitNexus/actions/workflows/ci.yml/badge.svg" alt="CI Workflows"/>
</a>
<p><strong>Enterprise (SaaS & Self-hosted)</strong> - <a href="https://akonlabs.com">akonlabs.com</a></p>

View file

@ -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');
}
});