From 60d544bf63235a0e5005690110caa6926f2e133b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Tanr=C4=B1verdi?= <10054568+xgame92@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:33:53 +0000 Subject: [PATCH 1/3] build(security): scan commits for secrets Add the pinned secret scanner to CI and install the staged-changes hook during package installation so leaked credentials are caught before they reach the repository history. --- .githooks/pre-commit | 12 ++++ .github/workflows/secret-scan.yml | 48 ++++++++++++++ .gitleaks.toml | 63 +++++++++++++++++++ package.json | 1 + scripts/secret-scan/install-hook.mjs | 94 ++++++++++++++++++++++++++++ 5 files changed, 218 insertions(+) create mode 100755 .githooks/pre-commit create mode 100644 .github/workflows/secret-scan.yml create mode 100644 .gitleaks.toml create mode 100644 scripts/secret-scan/install-hook.mjs diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..f53ac6e --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,12 @@ +#!/bin/sh +# Pre-commit hook: scan the staged changes with gitleaks. Installed by `pnpm install` +# (the prepare step runs scripts/secret-scan/install-hook.mjs). Without gitleaks on PATH it says +# how to install it and lets the commit through; the Secret scan job in CI still checks the push. +if ! command -v gitleaks >/dev/null 2>&1; then + echo "pre-commit: gitleaks is not on PATH, so the staged changes were NOT scanned." >&2 + echo " Install gitleaks 8.30.1 or newer (winget install Gitleaks.Gitleaks, brew install gitleaks," >&2 + echo " or the release page: https://github.com/gitleaks/gitleaks/releases), then commit again." >&2 + exit 0 +fi +root="$(git rev-parse --show-toplevel)" || exit 1 +exec gitleaks git --staged --redact --no-banner --verbose --config "$root/.gitleaks.toml" diff --git a/.github/workflows/secret-scan.yml b/.github/workflows/secret-scan.yml new file mode 100644 index 0000000..05491f4 --- /dev/null +++ b/.github/workflows/secret-scan.yml @@ -0,0 +1,48 @@ +name: Secret scan + +# One job: the gitleaks CLI at a pinned version, checked against a pinned sha256 before it runs. +# No third-party action and no repository secret. The config is .gitleaks.toml, byte for byte +# the copy in gateweave-ops. The `secret-scan-test/**` trigger lets a throwaway branch prove +# that a generated fixture fails this job. + +on: + pull_request: + push: + branches: + - main + - "secret-scan-test/**" + +permissions: + contents: read + +env: + GITLEAKS_VERSION: 8.30.1 + # sha256 of gitleaks_8.30.1_linux_x64.tar.gz, equal to the line in the release's checksums file. + GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb + +jobs: + gitleaks: + name: Secret scan (gitleaks) + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: false + - name: Install gitleaks (pinned version and checksum) + run: | + set -euo pipefail + file="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" + curl --proto '=https' --tlsv1.2 -fsSL -o "$RUNNER_TEMP/$file" \ + "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/${file}" + echo "${GITLEAKS_SHA256} $RUNNER_TEMP/$file" | sha256sum --check - + mkdir "$RUNNER_TEMP/gitleaks" + tar -xzf "$RUNNER_TEMP/$file" -C "$RUNNER_TEMP/gitleaks" gitleaks + - name: Scan the history + # Only the history reachable from the commit this run checked out, never every branch that + # fetch-depth 0 brought in: a throwaway test branch must not fail other pushes or pull requests. + # Include each merge's diff against its parents so the scan covers changes made in a merge. + run: | + "$RUNNER_TEMP/gitleaks/gitleaks" git --redact --no-banner --verbose \ + --config .gitleaks.toml --exit-code 1 --log-opts="--diff-merges=separate $(git rev-parse HEAD)" diff --git a/.gitleaks.toml b/.gitleaks.toml new file mode 100644 index 0000000..dd16688 --- /dev/null +++ b/.gitleaks.toml @@ -0,0 +1,63 @@ +# The one secret-scanner config for gitleaks, shared by every Gateweave repository. +# gateweave-track keeps a copy with the same bytes: change it here first, then copy it, so that +# `sha256sum` prints the same value in both. Pinned gitleaks version and checksum: see +# .github/workflows/secret-scan.yml. + +title = "Gateweave secret scan" + +[extend] +# All of gitleaks' built-in rules stay on. +useDefault = true + +# Allow list: keep it short, one rule and one path per entry, with the reason written down. +# Each entry uses condition = "AND": the path and the exact synthetic finding must both match. +# Env files that are tracked on purpose (for example apps/web/.env.staging or .env.demo in +# gateweave-track) are NOT allowed here: a finding in them must fail the scan. + +[[allowlists]] +description = "media-put test: a synthetic filename under a temporary directory, not a credential" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^scripts/media-put/media-put\.test\.mjs$'''] +regexTarget = "secret" +regexes = ['''^missing\-ssn\-123\-45\-6789\.png$'''] + +[[allowlists]] +description = "track unit test: a UUID used as a run key, not a credential" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^apps/web/src/lib/runs\.test\.ts$'''] +regexTarget = "secret" +regexes = ['''^aed420a5\-84d8\-4328\-90bd\-aee5d899aef7$'''] + +[[allowlists]] +description = "growth fixture check (history only): a made-up record key, no provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^fixtures/staging-release-receiver/check\.mjs$'''] +regexTarget = "secret" +regexes = ['''^3kqabcdefghij$''', '''^3kqabcdefghik$'''] + +[[allowlists]] +description = "track unit test: the public RFC 8291 web-push example, not a credential" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^apps/web/src/server/push/webpush\.test\.ts$'''] +regexTarget = "secret" +regexes = ['''^BTBZMqHH6r4Tts7J_aSIgg$'''] + +[[allowlists]] +description = "track unit test: a made-up intake-address key in a stand-in gateway" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^apps/web/src/server/intake-email\.test\.ts$'''] +regexTarget = "secret" +regexes = ['''^abcdefgh234567qrstuvwxyz23$'''] + +[[allowlists]] +description = "track unit test: a short made-up intake-address key, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = ['''^apps/web/src/lib/intake-email\.test\.ts$'''] +regexTarget = "secret" +regexes = ['''^abcdefgh234567qr$'''] diff --git a/package.json b/package.json index ddc6c0a..62154d3 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "node": ">=22" }, "scripts": { + "prepare": "node scripts/secret-scan/install-hook.mjs", "build": "pnpm -r build", "check": "biome check", "format": "biome check --write", diff --git a/scripts/secret-scan/install-hook.mjs b/scripts/secret-scan/install-hook.mjs new file mode 100644 index 0000000..38a0572 --- /dev/null +++ b/scripts/secret-scan/install-hook.mjs @@ -0,0 +1,94 @@ +// Runs from the `prepare` step of package.json, so `pnpm install` (or `npm install`) wires the tracked +// .githooks/pre-commit into git. It never fails the install and it never takes over hooks that exist: +// - it does not touch core.hooksPath, so a hooks path set at any level (system, global, local) keeps +// working, and if one is set (even to an empty value) the script stops and says so; +// - it writes one small stub, pre-commit, into the default hooks folder, and only when no +// pre-commit hook is there yet (or the one there is this stub). Other hooks are left alone; +// - the stub runs .githooks/pre-commit of the worktree the commit happens in, and does nothing +// where that file is missing, so linked worktrees on older branches keep working. +import { execFileSync } from "node:child_process"; +import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; +import { isAbsolute, join, relative, resolve } from "node:path"; + +const hooksDir = ".githooks"; +const marker = "# secret-scan stub: installed by scripts/secret-scan/install-hook.mjs"; +const stub = `#!/bin/sh +${marker} +# Runs the tracked pre-commit hook of the worktree this commit happens in, if that worktree has one. +root="$(git rev-parse --show-toplevel)" || exit 0 +[ -f "$root/${hooksDir}/pre-commit" ] || exit 0 +exec sh "$root/${hooksDir}/pre-commit" "$@" +`; + +function git(...args) { + return execFileSync("git", args, { + encoding: "utf8", + stdio: ["ignore", "pipe", "ignore"], + }).trim(); +} + +try { + if ( + git("rev-parse", "--is-inside-work-tree") !== "true" || + !existsSync(`${hooksDir}/pre-commit`) + ) { + process.exit(0); + } + + // The exit status of the lookup tells the cases apart, not the text it prints: `git config --get` + // exits 0 when the key is set (also to an empty value, which Git then treats as "./"), exits 1 + // when the key is absent at every level, and exits with another status when the lookup itself fails. + let configured; + try { + configured = git("config", "--get", "core.hooksPath"); + } catch (error) { + if (error?.status !== 1) { + console.log( + "secret-scan: could not read core.hooksPath; the pre-commit scan was not installed.", + ); + process.exit(0); + } + // Status 1: the key is not set at any level, so the default hooks folder is in use. + } + if (configured !== undefined) { + console.log( + `secret-scan: core.hooksPath is set to "${configured}"; the pre-commit scan was not installed.`, + ); + process.exit(0); + } + + // Only now is the default hooks folder known to be the one Git uses. It lives in the common git + // folder, shared by every worktree of this clone, and must stay inside it: never write a hook into + // the checkout itself. + const commonDir = resolve(git("rev-parse", "--git-common-dir")); + const defaultDir = resolve(git("rev-parse", "--git-path", "hooks")); + const inside = relative(commonDir, defaultDir); + if (inside === "" || inside.startsWith("..") || isAbsolute(inside)) { + console.log( + "secret-scan: the default hooks folder is not inside the git folder; the pre-commit scan was not installed.", + ); + process.exit(0); + } + const target = join(defaultDir, "pre-commit"); + if (existsSync(target)) { + const text = readFileSync(target, "utf8"); + if (!text.includes(marker)) { + console.log( + "secret-scan: a pre-commit hook already exists in the default hooks folder; it was kept and the scan was not installed.", + ); + process.exit(0); + } + if (text === stub) { + console.log("secret-scan: the pre-commit stub is already installed; nothing to do."); + process.exit(0); + } + } + mkdirSync(defaultDir, { recursive: true }); + writeFileSync(target, stub); + chmodSync(target, 0o755); + console.log( + `secret-scan: pre-commit stub installed; it runs ${hooksDir}/pre-commit in each worktree.`, + ); +} catch { + // No git on PATH or not a checkout: nothing to install. +} From 682acc453cb172b8f4f0ec2eb570eb4bc0aabb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Tanr=C4=B1verdi?= <10054568+xgame92@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:57:22 +0000 Subject: [PATCH 2/3] build(security): refresh shared scanner config Pick up the shared fixture exceptions so this copy stays byte-identical with the scanner config rolling out in ops. --- .gitleaks.toml | 360 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) diff --git a/.gitleaks.toml b/.gitleaks.toml index dd16688..490972b 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -61,3 +61,363 @@ targetRules = ["generic-api-key"] paths = ['''^apps/web/src/lib/intake-email\.test\.ts$'''] regexTarget = "secret" regexes = ['''^abcdefgh234567qr$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/runtime/test/wrangler\-files\.jsonc$''' +regexTarget = "secret" +regexes = ['''^dGVzdC1vbmx5LXNlY3JldHMta2V5LXRlc3Qtb25seS0=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/runtime/test/changes\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^abcdef123456$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/environment\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^dGVzdC1vbmx5LXNlY3JldHMta2V5LXRlc3Qtb25seS0=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/providers\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^d1\.gQSsmQ4\-nEJjogZX\.HB\-fS4eGqlqBafJZSeEZM0DbMTOj1XGgy_IF5fE2ETLiZMSjGSJkgl8uCP9HhJuann7jaOD9VkDE$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["curl-auth-user"] +paths = '''^apps/web/src/lib/tool\-calls\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^alice:hunter2$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/web/src/lib/tool\-calls\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^ghp_abcdefghij1234$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["curl-auth-header"] +paths = '''^apps/web/src/lib/tool\-calls\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^sk\-live\-0123456789$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["curl-auth-header"] +paths = '''^apps/web/src/components/chat/trigger\-card\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^abcdefghij$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/providers\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^q0V7mJr4yXc1L9uT2bWnEoZ5aGd8sKfH3iPqRt6vUwY=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/providers\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^9f2c4e7a1b8d0563f4a9c2e1d7b8a0356c9e4f1a2b7d8c0e5f3a6b9d1c4e7f20$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/adapters/test/mcp\-connection\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^acme\-live\-key\-123$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["gitlab-pat"] +paths = '''^packages/registry/test/gitlab\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^glpat\-abcdefghijklmnop1234$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/wrangler\.jsonc$''' +regexTarget = "secret" +regexes = ['''^dGVzdC1vbmx5LXNlY3JldHMta2V5LXRlc3Qtb25seS0=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/runtime/test/wrangler\.jsonc$''' +regexTarget = "secret" +regexes = ['''^dGVzdC1vbmx5LXNlY3JldHMta2V5LXRlc3Qtb25seS0=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/model/test/triggers\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^whsec_YSBzZW5kZXIncyBzZWNyZXQsIDMyIGJ5dGVzIGxvbmc=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/web/test/environment\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^hunter2\-correct\-horse\-battery$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/environment\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^hunter2\-correct\-horse\-battery$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/adapters/test/claude\-code\-plugin\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^ghp_argSecret123$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/providers\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^dGVzdC1vbmx5LXNlY3JldHMta2V5LXRlc3Qtb25seS0=$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/adapters/test/claude\-code\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^ghp_argSecret123$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/adapters/test/claude\-code\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^ghp_envSecret456$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/adapters/test/codex\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^ctx7sk\-tomlSecret$'''] + +[[allowlists]] +description = "id unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/web/test/two\-factor\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ$'''] + +[[allowlists]] +description = "mail unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/mail/test/webhooks\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw$'''] + +[[allowlists]] +description = "mail unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["jwt"] +paths = '''^apps/web/test/mailbox\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^eyJhbGciOiJSUzI1NiJ9\.eyJzdWIiOiJvd25lciJ9\.c2lnbmF0dXJl$'''] + +[[allowlists]] +description = "mail unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/web/src/server/providers/svix\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^whsec_plJ3nmyCDGBKInavdOK15jsl$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/sandbox\-serve\.test\.js$''' +regexTarget = "secret" +regexes = ['''^9f3c1b7ad25e46808fb1c7d3e5a2940b6d18c3f7a5e2b9046c1d8f3a7e5b2c90$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/config\.test\.js$''' +regexTarget = "secret" +regexes = ['''^a1b2c3d4e5f6a7b8c9d0a1b2c3d4e5f6$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/merge\.test\.js$''' +regexTarget = "secret" +regexes = ['''^9f3c1b7ad25e46808fb1c7d3e5a2940b6d18c3f7a5e2b9046c1d8f3a7e5b2c90$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/gateway\.test\.js$''' +regexTarget = "secret" +regexes = ['''^9f3c1b7ad25e46808fb1c7d3e5a2940b6d18c3f7a5e2b9046c1d8f3a7e5b2c90$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/reader\.test\.js$''' +regexTarget = "secret" +regexes = ['''^sk\-approve\-abcd1234$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/sprite\.test\.js$''' +regexTarget = "secret" +regexes = ['''^0123456789abcdef$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/serve\.test\.js$''' +regexTarget = "secret" +regexes = ['''^9f3c1b7ad25e46808fb1c7d3e5a2940b6d18c3f7a5e2b9046c1d8f3a7e5b2c90$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/workspace\.test\.js$''' +regexTarget = "secret" +regexes = ['''^0123456789abcdef$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/coder\.test\.js$''' +regexTarget = "secret" +regexes = ['''^Q7Zk9Xw2Lp4Rt8Vb$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/runner\.test\.js$''' +regexTarget = "secret" +regexes = ['''^a1b2c3d4e5f6a7b8c9d0a1b2c3d4e5f6$'''] + +[[allowlists]] +description = "night-shift unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^test/runner\.test\.js$''' +regexTarget = "secret" +regexes = ['''^Q7Zk9Xw2Lp4Rt8Vb$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/core/test/cdc\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/core/test/repository\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/worker/test/backup\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^whsec_Z2F0ZXdlYXZlIGJhY2t1cCBhbGVydCB0ZXN0cyAwMSE=$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^apps/worker/vitest\.config\.ts$''' +regexTarget = "secret" +regexes = ['''^Z2F0ZXdlYXZlLWJhY2t1cCB3b3JrZXIgdGVzdHMgMDE$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/core/test/fixture\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^Z2F0ZXdlYXZlLWJhY2t1cCB0ZXN0IGZpeHR1cmUgMSE$'''] + +[[allowlists]] +description = "backup unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/cli/test/cli\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^Z2F0ZXdlYXZlLWJhY2t1cCB0ZXN0IGZpeHR1cmUgMSE$'''] + +[[allowlists]] +description = "agents unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["generic-api-key"] +paths = '''^packages/registry/test/gitlab\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^glpat\-abcdefghijklmnop1234$'''] + +[[allowlists]] +description = "growth unit test fixture: a credential-shaped test stand-in, not a provider value" +condition = "AND" +targetRules = ["stripe-access-token"] +paths = '''^test/gtm\.test\.ts$''' +regexTarget = "secret" +regexes = ['''^sk_live_abcdefghijk$'''] From c9a135854ecf1e0d648a84443e1c9cfff89e149a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Tanr=C4=B1verdi?= <10054568+xgame92@users.noreply.github.com> Date: Thu, 3 Dec 2026 21:06:00 +0000 Subject: [PATCH 3/3] chore(security): keep environment file names out of scan config Keep the shared scanner config byte-identical while removing tracked environment file paths from a comment so rollout checks do not read them as exceptions. --- .gitleaks.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitleaks.toml b/.gitleaks.toml index 490972b..a0f0401 100644 --- a/.gitleaks.toml +++ b/.gitleaks.toml @@ -11,8 +11,7 @@ useDefault = true # Allow list: keep it short, one rule and one path per entry, with the reason written down. # Each entry uses condition = "AND": the path and the exact synthetic finding must both match. -# Env files that are tracked on purpose (for example apps/web/.env.staging or .env.demo in -# gateweave-track) are NOT allowed here: a finding in them must fail the scan. +# Tracked environment files are NOT allowed here: a finding in them must fail the scan. [[allowlists]] description = "media-put test: a synthetic filename under a temporary directory, not a credential"