Files
ai-safety-console-web/tests/unit/logging/sanitize.test.ts
T
baozaotumao2025 1b90e552a5 first commit
2026-07-18 21:10:39 +08:00

19 lines
552 B
TypeScript

import { describe, expect, it } from 'vitest'
import { sanitize } from '../../../src/logging/sanitize'
describe('sanitize', () => {
it('redacts secrets recursively without changing safe context', () => {
expect(
sanitize({
requestId: 'req-1',
authorization: 'Bearer secret',
nested: { password: 'secret', api_key: 'secret', runId: 42 },
}),
).toEqual({
requestId: 'req-1',
authorization: '[REDACTED]',
nested: { password: '[REDACTED]', api_key: '[REDACTED]', runId: 42 },
})
})
})