feat: prepare GoodBuddy 0.8.0
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { safeToolArgumentSummary } from './approval-summary'
|
||||
import {
|
||||
safeToolArgumentSummary,
|
||||
safeToolErrorDetail
|
||||
} from './approval-summary'
|
||||
|
||||
describe('safeToolArgumentSummary', () => {
|
||||
it('redacts nested sensitive fields', () => {
|
||||
@@ -26,3 +29,41 @@ describe('safeToolArgumentSummary', () => {
|
||||
).not.toContain('secret-token')
|
||||
})
|
||||
})
|
||||
|
||||
describe('safeToolErrorDetail', () => {
|
||||
it('extracts nested runtime errors while redacting secrets', () => {
|
||||
expect(
|
||||
safeToolErrorDetail([
|
||||
{
|
||||
content:
|
||||
'exit code 1\nAuthorization: Bearer secret-token'
|
||||
}
|
||||
])
|
||||
).toBe('exit code 1\nAuthorization: [REDACTED]')
|
||||
expect(
|
||||
safeToolErrorDetail({
|
||||
message:
|
||||
'{"token":"json-secret","authorization":"Basic abc123"}'
|
||||
})
|
||||
).toBe(
|
||||
'{"token":"[REDACTED]","authorization":"[REDACTED]"}'
|
||||
)
|
||||
})
|
||||
|
||||
it('bounds output and ignores unrelated provider payload fields', () => {
|
||||
expect(
|
||||
safeToolErrorDetail(
|
||||
{
|
||||
content: 'parser failure '.repeat(20),
|
||||
privateDocument: 'must not be returned'
|
||||
},
|
||||
40
|
||||
)
|
||||
).toHaveLength(40)
|
||||
expect(
|
||||
safeToolErrorDetail({
|
||||
privateDocument: 'must not be returned'
|
||||
})
|
||||
).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user