MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / test_100_command_limit

Function test_100_command_limit

test_security_integration.py:358–389  ·  view source on GitHub ↗

Test that configs with >100 commands are rejected.

()

Source from the content-addressed store, hash-verified

356
357
358def test_100_command_limit():
359 """Test that configs with >100 commands are rejected."""
360 print("\n" + "=" * 70)
361 print("TEST 9: 100 command limit enforced")
362 print("=" * 70)
363
364 with tempfile.TemporaryDirectory() as tmpdir:
365 project_dir = Path(tmpdir)
366
367 # Create config with 101 commands
368 autoforge_dir = project_dir / ".autoforge"
369 autoforge_dir.mkdir()
370
371 commands = [
372 f" - name: cmd{i}\n description: Command {i}" for i in range(101)
373 ]
374 (autoforge_dir / "allowed_commands.yaml").write_text(
375 "version: 1\ncommands:\n" + "\n".join(commands)
376 )
377
378 # Try to run cmd0 (should be blocked - config is invalid)
379 input_data = {"tool_name": "Bash", "tool_input": {"command": "cmd0"}}
380 context = {"project_dir": str(project_dir)}
381
382 result = asyncio.run(bash_security_hook(input_data, context=context))
383
384 if result.get("decision") == "block":
385 print("✅ PASS: Config with >100 commands rejected")
386 return True
387 else:
388 print("❌ FAIL: Config with >100 commands should be rejected")
389 return False
390
391
392def main():

Callers

nothing calls this directly

Calls 1

bash_security_hookFunction · 0.90

Tested by

no test coverage detected