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

Function test_invalid_yaml_ignored

test_security_integration.py:329–355  ·  view source on GitHub ↗

Test that invalid YAML config is safely ignored.

()

Source from the content-addressed store, hash-verified

327
328
329def test_invalid_yaml_ignored():
330 """Test that invalid YAML config is safely ignored."""
331 print("\n" + "=" * 70)
332 print("TEST 8: Invalid YAML safely ignored")
333 print("=" * 70)
334
335 with tempfile.TemporaryDirectory() as tmpdir:
336 project_dir = Path(tmpdir)
337
338 # Create invalid YAML
339 autoforge_dir = project_dir / ".autoforge"
340 autoforge_dir.mkdir()
341 (autoforge_dir / "allowed_commands.yaml").write_text("invalid: yaml: content:")
342
343 # Try to run ls (should still work - falls back to defaults)
344 input_data = {"tool_name": "Bash", "tool_input": {"command": "ls"}}
345 context = {"project_dir": str(project_dir)}
346
347 result = asyncio.run(bash_security_hook(input_data, context=context))
348
349 if result.get("decision") != "block":
350 print("✅ PASS: Invalid YAML ignored, defaults still work")
351 return True
352 else:
353 print("❌ FAIL: Should fall back to defaults when YAML is invalid")
354 print(f" Reason: {result.get('reason', 'N/A')}")
355 return False
356
357
358def test_100_command_limit():

Callers

nothing calls this directly

Calls 1

bash_security_hookFunction · 0.90

Tested by

no test coverage detected