diff --git a/test/evidence.test.ts b/test/evidence.test.ts index c16258f82..77652806f 100644 --- a/test/evidence.test.ts +++ b/test/evidence.test.ts @@ -160,10 +160,15 @@ describe('gstack-evidence run', () => { }); test('a HIGH credential in the command is stored redacted', () => { - const r = run(['run', '--label', 'sec', '--', 'echo ghp_A8bC2dE4fG6hI8jK0lM2nO4pQ6rS8tU0vW2x deploy']); + // Fabricated, never-issued token. Assembled by concatenation so the SOURCE + // diff carries no live-format literal (the repo's own pre-push credential + // guard would block it) while the runtime string still exercises the + // redact engine with a live-format value. + const fakePat = 'ghp_' + 'A8bC2dE4fG6hI8jK0lM2nO4pQ6rS8tU0vW2x'; + const r = run(['run', '--label', 'sec', '--', `echo ${fakePat} deploy`]); expect(r.status).toBe(0); const rec = records().pop(); - expect(rec.command).not.toContain('ghp_A8bC2dE4fG6hI8jK0lM2nO4pQ6rS8tU0vW2x'); + expect(rec.command).not.toContain(fakePat); expect(rec.redacted).toBe(true); // The hash still binds to the ORIGINAL exact string (freshness key). expect(rec.cmd_sha256).toMatch(/^[0-9a-f]{64}$/);