Harden M7.6/7.7: recursive restriction accumulation, MCP server enforcement, fast-fail authorization

This commit is contained in:
rob
2026-07-20 02:33:44 -03:00
parent 93ea80950e
commit 8366ef798b
8 changed files with 435 additions and 67 deletions
+29
View File
@@ -609,6 +609,35 @@ class TestAgentContext:
assert "skills" not in d
assert "profile" not in d
def test_toolstep_tools_roundtrip(self):
step = ToolStep(
tool="my-tool", output_var="out", tools=["safe-*", "official/lint"]
)
assert ToolStep.from_dict(step.to_dict()).tools == [
"safe-*", "official/lint"
]
def test_toolstep_empty_tools_roundtrip(self):
step = ToolStep(tool="my-tool", output_var="out", tools=[])
serialized = step.to_dict()
assert serialized["tools"] == []
assert ToolStep.from_dict(serialized).tools == []
@pytest.mark.parametrize(
"data",
[
{"skills": "python"},
{"skills": ["*", "python"]},
{"skills": ["Python"]},
{"tools": "safe-tool"},
{"tools": [""]},
{"profile": ""},
],
)
def test_toolstep_rejects_invalid_agent_context(self, data):
with pytest.raises(ValueError):
ToolStep(tool="my-tool", output_var="out", **data)
def test_promptstep_skills_roundtrip(self):
step = PromptStep(
prompt="Test", provider="claude", output_var="out",