Enforce bounded operation guardrails
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 21s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a028de-e2c8-7732-8521-46a7fc5db82f
This commit is contained in:
tegwick 2026-08-23 12:31:13 +02:00
parent c384f60530
commit 26934e25b9
51 changed files with 1843 additions and 472 deletions

View file

@ -158,3 +158,37 @@ async def test_event_payload_context_fails_when_required_envelope_missing() -> N
}
],
)
@pytest.mark.asyncio
async def test_resolve_context_does_not_execute_bounded_shell_operation() -> None:
snapshot = await resolve_context(
[
{
"type": "shell",
"query": "forgejo_package_prune",
"operation": "forgejo_package_prune",
"params": {},
"bind_to": "context.prune",
}
]
)
assert snapshot == {
"prune": {"operation": "forgejo_package_prune", "status": "pending"}
}
@pytest.mark.asyncio
async def test_resolve_context_refuses_unknown_shell_query() -> None:
with pytest.raises(ApplicationError, match="not registered as read-only"):
await resolve_context(
[
{
"type": "shell",
"query": "arbitrary_command",
"params": {},
"bind_to": "context.bad",
}
]
)