[Phase 0.2.1] Create security test suite scaffold#36
Open
richard-devbot wants to merge 5 commits intoCursorTouch:mainfrom
Open
[Phase 0.2.1] Create security test suite scaffold#36richard-devbot wants to merge 5 commits intoCursorTouch:mainfrom
richard-devbot wants to merge 5 commits intoCursorTouch:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7
What was implemented
tests/security/__init__.py— package marker with module docstringtests/security/conftest.py— three shared fixtures:tmp_workspace— isolated temp directory withfiles/andlogs/subdirs; auto-cleaned by pytestmock_agent_context— minimal{workspace, agent_id, permissions}dict for tool testing without full agent objectscapture_logs— wrapscaplogat DEBUG level so security log lines at any severity are capturedtests/security/helpers.py— utilities for Phase 1 security tests:path_traversal_payloads()— 8 classic../, URL-encoded, and absolute-path attack stringscommand_injection_payloads()— 8 shell injection fragments (;,|,&, backtick,$(), etc.)assert_blocked(result, check=None)— assertsresult.success is False; optional extra predicateassert_allowed(result, check=None)— assertsresult.success is True; optional extra predicatetests/security/test_scaffold.py— 15 passing example tests exercising every fixture and helperTest run
All fixtures are fully documented with docstrings per the acceptance criteria.