|
|
@@ -623,14 +623,14 @@ describe('sandbox escalation through ctx.approval', () => {
|
|
|
expect(schema.parameters.properties).not.toHaveProperty('sandbox_permissions')
|
|
|
})
|
|
|
|
|
|
- it('rejects injected escalation without a sandbox and non-widening escalation without prompting', async () => {
|
|
|
+ it('rejects injected escalation without a sandbox and narrower escalation without prompting', async () => {
|
|
|
const plain = await setup()
|
|
|
expect(text(await call(plain.ctx, 'pwsh', escalate))).toContain('not available in this composition')
|
|
|
|
|
|
const { ctx } = await setupSandboxed(true)
|
|
|
const prompted = vi.fn()
|
|
|
ctx.on('approval/request', () => { prompted(); return Promise.resolve<ApprovalOutcome>('allowed-once') })
|
|
|
- const result = await call(ctx, 'pwsh', { ...escalate, sandbox_permissions: 'workspace-write' }, sandboxAgent('workspace-write'))
|
|
|
+ const result = await call(ctx, 'pwsh', { ...escalate, sandbox_permissions: 'workspace-write' }, sandboxAgent('danger-full-access'))
|
|
|
expect(text(result)).toContain('not strictly wider')
|
|
|
expect(prompted).not.toHaveBeenCalled()
|
|
|
|
|
|
@@ -642,6 +642,13 @@ describe('sandbox escalation through ctx.approval', () => {
|
|
|
expect(text(await call(ctx, 'pwsh', escalate, malformed))).toContain('not strictly wider')
|
|
|
})
|
|
|
|
|
|
+ it.each(['workspace-write', 'danger-full-access'] as const)('runs a repeated %s request without approval', async (mode) => {
|
|
|
+ const { ctx, bash } = await setupSandboxed()
|
|
|
+ const result = await call(ctx, 'pwsh', { ...escalate, sandbox_permissions: mode }, sandboxAgent(mode))
|
|
|
+ expect(result.isError).toBe(false)
|
|
|
+ expect(bash.modes).toEqual([mode])
|
|
|
+ })
|
|
|
+
|
|
|
it('fails closed when approval cannot be routed', async () => {
|
|
|
const withoutService = await setupSandboxed()
|
|
|
expect(text(await call(withoutService.ctx, 'pwsh', escalate, sandboxAgent()))).toContain('no approval service')
|