mirror of
https://github.com/simstudioai/sim.git
synced 2026-10-31 03:47:12 +08:00
* feat(code): cli sandboxes, enterprise timeouts, secrets projections, resolver lift * fix(execution): harden compatibility and secret diagnostics * fix(execution): harden generated JavaScript literals * fix(execution): align timeout cleanup semantics * fix(tables): decouple stale job cleanup * fix(execution): drain stale workflow backlog * test(sandbox): make deadline assertions timing-safe * fix(execution): lock cleanup candidate batches * fix(execution): preserve cleanup failure metrics * cancel route fixes * separate out mship template and func template * fix * fix(execution): harden secret projection and block runs * fix(workflow): validate draft execution state * run from block ui disabling * feat(copilot): expose Sim sandboxes to mothership * feat(copilot): expose sandbox capability catalog in VFS * Updates * fix legacy logs showing up * fix(copilot): keep sandbox config visible * fix model provenance issues * fix lint' * more lint * more * test(files): align provenance copy query order * consolidate migrations, rollout compat * integration projections * update skills * fix * add provenance linters * fix: address review and compatibility regressions * fix: make tool boundary audit Bun 1.3 compatible --------- Co-authored-by: Siddharth Ganesan <siddharthganesan@gmail.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
import { findToolRequestBoundaryViolations } from './check-tool-request-boundary'
|
|
|
|
describe('tool request boundary audit', () => {
|
|
test('rejects direct and aliased ToolConfig request execution', () => {
|
|
const violations = findToolRequestBoundaryViolations(`
|
|
const direct = mistralParserTool.request.body(params)
|
|
const computed = tool.request['headers'](params)
|
|
const typedRequest = (customTool as ToolConfig).request
|
|
const typed = typedRequest[\`method\`](params)
|
|
const optional = tool.request?.url
|
|
const requestConfig = customTool.request
|
|
const url = requestConfig.url
|
|
const { body } = requestConfig
|
|
`)
|
|
|
|
expect(violations.map((violation) => violation.expression)).toEqual([
|
|
'mistralParserTool.request.body',
|
|
"tool.request['headers']",
|
|
'typedRequest[\`method\`]',
|
|
'tool.request?.url',
|
|
'requestConfig.url',
|
|
'body',
|
|
])
|
|
})
|
|
|
|
test('allows declarations and ordinary request objects', () => {
|
|
expect(
|
|
findToolRequestBoundaryViolations(`
|
|
const tool = { request: { url: '/api/tool', headers: () => ({}) } }
|
|
const request = options.request
|
|
request.headers.get('authorization')
|
|
incomingRequest.headers.get('authorization')
|
|
`)
|
|
).toEqual([])
|
|
})
|
|
})
|