Skip to content

test: build fake token fixtures at run time and block whole tokens in CI - #464

Merged
siracusa5 merged 2 commits into
mainfrom
fix/test-token-fixtures
Nov 14, 2026
Merged

siracusa5 merged 2 commits into
mainfrom
fix/test-token-fixtures

Conversation

@siracusa5

Copy link
Copy Markdown
Collaborator

Why

GitHub secret scanning opened a public-leak alert (Google API key) on a scrubber test fixture. None of the fixtures are real credentials, but whole token-shaped strings in a public repo look like leaks to scanners and to anyone probing the repo.

What

  • fakeSecret(prefix, body) test helpers (packages/core/__tests__/helpers/fake-secret.ts, apps/desktop/src/test-utils/fake-secret.ts) build each fake token at run time. Tests see the same strings; the source never holds a whole one.
  • Rewrote every token-shaped fixture: profile-share, import-inventory, plugin-inventory, normalize (core) and ShareSheet (desktop).
  • scripts/check-token-literals.mjs runs in the validate job and fails on any whole token in tracked files. It reports file, line and kind, never the value.

Verification

  • Check passes on this branch (1339 files); against main's profile-share fixtures it flags all 13 lines, and it caught one Slack fixture the first pass missed.
  • Affected tests: core 177, desktop ShareSheet 13. Core and desktop typecheck clean.

After merge

The old strings stay in git history, so alert #1 stays open until closed by hand: close it as Used in tests. Rewriting public history is not worth it; forks and caches already have it.

🤖 Generated with Claude Code

siracusa5 and others added 2 commits November 13, 2026 17:19
Scrubber fixtures held whole token-shaped strings (GitHub, Google, Stripe,
npm, GitLab, Slack, Discord). They are fake, but GitHub secret scanning
raised a public-leak alert and they invite a closer look at the repo.

- fakeSecret(prefix, body) helpers in core and desktop tests build each
  value at run time, so the source never holds a whole token.
- scripts/check-token-literals.mjs fails the validate job when a tracked
  file contains one, printing file, line and kind but never the value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@siracusa5
siracusa5 merged commit 620f14d into main Nov 14, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant