test(codex): fingerprint system auth in validation reports

This commit is contained in:
Brennan Benson
2026-07-17 14:52:36 -07:00
parent fa10f11e09
commit b56cf80d18
2 changed files with 10 additions and 2 deletions
@@ -213,6 +213,7 @@ export async function snapshotValidationState(layout) {
return {
capturedAt: new Date().toISOString(),
throwawayCodex: {
auth: await fingerprintFile(path.join(throwawayCodexHome, 'auth.json')),
config: await fingerprintFile(path.join(throwawayCodexHome, 'config.toml')),
hooks: await fingerprintFile(path.join(throwawayCodexHome, 'hooks.json'))
},
@@ -42,18 +42,25 @@ describe('Codex real-account validation harness', () => {
expect(env.SAFE_VALUE).toBe('preserved')
})
it('records only a fingerprint for managed auth', async () => {
it('records only fingerprints for system-default and managed auth', async () => {
const layout = await createValidationLayout({
primaryHome: path.join(os.tmpdir(), 'orca-primary-home-sentinel')
})
cleanupPaths.push(layout.tempRoot)
const systemHome = path.join(layout.homeDir, '.codex')
const managedHome = path.join(layout.userDataDir, 'codex-accounts', 'account-1', 'home')
await mkdir(managedHome, { recursive: true })
await Promise.all([
mkdir(systemHome, { recursive: true }),
mkdir(managedHome, { recursive: true })
])
await writeFile(path.join(systemHome, 'auth.json'), '{"refresh_token":"system-secret"}\n')
await writeFile(path.join(managedHome, 'auth.json'), '{"refresh_token":"never-report-me"}\n')
const snapshot = await snapshotValidationState(layout)
expect(snapshot.throwawayCodex.auth.sha256).toMatch(/^[a-f0-9]{64}$/)
expect(snapshot.managedHomes[0].auth.sha256).toMatch(/^[a-f0-9]{64}$/)
expect(JSON.stringify(snapshot)).not.toContain('system-secret')
expect(JSON.stringify(snapshot)).not.toContain('never-report-me')
})
})