Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(#7073): build the synthetic OAuth token values at runtime; ignore the history-only gitleaks fingerprints
garrytan660ecb06d0f3
diff --git a/.gitleaksignore b/.gitleaksignoreindex 55bf95032e..742f664b2f 100644--- a/.gitleaksignore+++ b/.gitleaksignore@@ -45,3 +45,7 @@ a3140831d22a944947ef9cbd72ff7129a3541951:test/large-pages/credential-reseal-segm# Large-pages hardening (h): the synthetic marker constant 'quillfeather7731' in test/pathological/lp-h-purge-orphan-segment-text.test.ts# (commit 3bf9794) was named TOKEN and reads as generic-api-key; the tree now names it MARKER. History-only fingerprint, not a secret.3bf97940832d3c7d9dbc4815cedb30dcc83cb550:test/pathological/lp-h-purge-orphan-segment-text.test.ts:generic-api-key:37+# #7073 (GBRA-147): synthetic OAuth token literals in test/google-api-access-cmd-7073.serial.test.ts (commit fb1cee45) read as+# generic-api-key; the tree now builds them at runtime. These history-only fingerprints are not secrets.+fb1cee45c18357eb43d537715b2a8dc43fafc70f:test/google-api-access-cmd-7073.serial.test.ts:generic-api-key:37+fb1cee45c18357eb43d537715b2a8dc43fafc70f:test/google-api-access-cmd-7073.serial.test.ts:generic-api-key:55diff --git a/test/google-api-access-cmd-7073.serial.test.ts b/test/google-api-access-cmd-7073.serial.test.tsindex 3b3588fd58..75e8887425 100644--- a/test/google-api-access-cmd-7073.serial.test.ts+++ b/test/google-api-access-cmd-7073.serial.test.ts@@ -22,6 +22,9 @@ const ACCOUNT = '[email protected]';const PROJECT = '987654321';const CLIENT_ID = `${PROJECT}-abcdef.apps.googleusercontent.com`;const SCOPES = ['openid', 'email', 'https://www.googleapis.com/auth/gmail.readonly', 'https://www.googleapis.com/auth/calendar.readonly', 'https://www.googleapis.com/auth/contacts.readonly'];+/** Synthetic token values, built so no literal reads as a credential. */+const FIXTURE_ACCESS = ['fixture', 'access'].join('-');+const FIXTURE_REFRESH = ['fixture', 'refresh'].join('-');const enableUrl = (api: string) => `https://console.developers.google.com/apis/api/${api}/overview?project=${PROJECT}`;const json = (body: unknown, status = 200) => new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } });@@ -34,7 +37,7 @@ let disabledApis = new Set<string>();const realFetch = globalThis.fetch;const mockFetch = (async (input: string | URL | Request) => {const url = new URL(typeof input === 'string' ? input : input instanceof URL ? input.toString() : input.url);- if (url.hostname === 'oauth2.googleapis.com') return json({ access_token: 'ya29.fixture', expires_in: 3600 });+ if (url.hostname === 'oauth2.googleapis.com') return json({ access_token: FIXTURE_ACCESS, expires_in: 3600 });if (url.hostname === 'openidconnect.googleapis.com') return json({ email: ACCOUNT });if (url.pathname.endsWith('/users/me/profile')) return disabledApis.has('gmail') ? disabled('gmail.googleapis.com', 'Gmail API') : json({ emailAddress: ACCOUNT, historyId: '1' });if (url.pathname.endsWith('/calendars/primary')) return disabledApis.has('calendar') ? disabled('calendar-json.googleapis.com', 'Google Calendar API') : json({ id: ACCOUNT });@@ -52,7 +55,7 @@ function home(scopes = SCOPES): string {writeFileSync(join(dir, '.gbrain', 'credentials.json'), JSON.stringify({ version: 1,clients: [{ provider: 'google', client_id: CLIENT_ID, client_secret: 'GOCSPX-test-secret-0000', created_at: now }],credentials: { [`google:${ACCOUNT}`]: { id: `google:${ACCOUNT}`, provider: 'google', kind: 'oauth2', client_ref: 'byo',- secret: { access_token: 'ya29.fixture', refresh_token: '1//fixture', expiry: new Date(Date.now() + 3_600_000).toISOString() },+ secret: { access_token: FIXTURE_ACCESS, refresh_token: FIXTURE_REFRESH, expiry: new Date(Date.now() + 3_600_000).toISOString() },meta: { account: ACCOUNT, scopes, client_id: CLIENT_ID, connected_at: now, last_refresh_ok_at: now, consent_publish_state: 'production' } } } }), { mode: 0o600 });return dir;}