Skip to content

[Phase 0.2.1] Create security test suite scaffold#36

Open
richard-devbot wants to merge 5 commits intoCursorTouch:mainfrom
richard-devbot:richardson/phase0-security-tests
Open

[Phase 0.2.1] Create security test suite scaffold#36
richard-devbot wants to merge 5 commits intoCursorTouch:mainfrom
richard-devbot:richardson/phase0-security-tests

Conversation

@richard-devbot
Copy link
Copy Markdown

Closes #7

What was implemented

  • tests/security/__init__.py — package marker with module docstring
  • tests/security/conftest.py — three shared fixtures:
    • tmp_workspace — isolated temp directory with files/ and logs/ subdirs; auto-cleaned by pytest
    • mock_agent_context — minimal {workspace, agent_id, permissions} dict for tool testing without full agent objects
    • capture_logs — wraps caplog at DEBUG level so security log lines at any severity are captured
  • tests/security/helpers.py — utilities for Phase 1 security tests:
    • path_traversal_payloads() — 8 classic ../, URL-encoded, and absolute-path attack strings
    • command_injection_payloads() — 8 shell injection fragments (;, |, &, backtick, $(), etc.)
    • assert_blocked(result, check=None) — asserts result.success is False; optional extra predicate
    • assert_allowed(result, check=None) — asserts result.success is True; optional extra predicate
  • tests/security/test_scaffold.py — 15 passing example tests exercising every fixture and helper

Test run

15 passed in 0.02s

All fixtures are fully documented with docstrings per the acceptance criteria.

Richardson Gunde and others added 5 commits April 13, 2026 12:17
Creates tests/security/ with shared fixtures (tmp_workspace,
mock_agent_context, capture_logs), attack payload generators
(path traversal, command injection), assertion helpers
(assert_blocked, assert_allowed), and an example test that
validates the scaffold itself — all 15 tests passing.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Add TYPE_CHECKING guard for MCPManager import in cli/start.py (F821)
- Split semicolon statements onto separate lines in macos/desktop/service.py (E702 x2)
- Remove unused mock_session variable in test_mcp_manager.py (F841)
- Discard unused tool_names return value with _ in test_mcp_manager.py (F841)
- Add ruff dev dependency and run ruff format across all files
…[ci]

- BrowserPlugin.SYSTEM_PROMPT: add <perception>, <tool_use>, <execution_principles> sections
- BrowserPlugin.register_hooks: actually register _state_hook on BEFORE_LLM_CALL when enabled
- BrowserPlugin.unregister_hooks: unregister _state_hook from BEFORE_LLM_CALL
- BrowserPlugin.unregister_tools: call unset_extension for "browser" and "_browser"
- BrowserPlugin.enable/disable: wire hook register/unregister through lifecycle
- ComputerPlugin.SYSTEM_PROMPT: add <perception>, <tool_use>, <execution_principles> sections
- ComputerPlugin.register_hooks: register _state_hook + _wait_for_ui_hook when enabled
- ComputerPlugin.unregister_hooks: unregister both hooks
- ComputerPlugin.enable/disable: wire hook register/unregister through lifecycle
- control_center: pass kwargs._graceful_restart_fn through to _do_restart(graceful_fn=...)
- ToolRegistry.get: also check _extensions so registry.get("browser") finds the browser instance
- ruff format: reformat entire codebase to resolve style violations

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- Cherry-pick ad62ce4: restore plugin hook registration and SYSTEM_PROMPT XML sections
- Resolve mcp_setup.py conflict: drop unused Path/MCPServerConfig imports
- ruff --fix: remove 10 unused imports across skill.py, mcp/manager.py,
  mcp/tool.py, providers/__init__.py, zai/llm.py, subagent/service.py,
  tracing/service.py, tracing/views.py, web/subagent.py
- All 60 tests pass (test_browser_plugin, test_computer_plugin,
  test_control_center, tests/security/)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase 0.2.1] Create security test suite scaffold

1 participant