Skip to content

[Phase 0.2.1] Create security test suite scaffold#36

Open
richard-devbot wants to merge 3 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 3 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.

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>
@richard-devbot richard-devbot force-pushed the richardson/phase0-security-tests branch from 1bb1f38 to 2154940 Compare April 19, 2026 16:13
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