19 lines
552 B
TypeScript
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 },
|
|
})
|
|
})
|
|
})
|