test(tdd): add failing security tests for SEC-01 through SEC-07 hardening#3290
test(tdd): add failing security tests for SEC-01 through SEC-07 hardening#3290
Conversation
…ning Adds three TDD test files specifying the contract for unimplemented security features from the #3266/#3282 design specification. Tests are intentionally failing against current code: tests/test_memory_auto_install_security.py - SEC-02: regression guard — sys.executable used in pip command (3 pass) - SEC-04: --require-hashes + hashes file + version pin (3 fail, 1 skip) - SEC-07: _sanitize_error() strips absolute paths from error output (6 fail) tests/recipes/test_run_recipe_by_name_working_dir.py - SEC-03: _validate_working_dir() helper — metachar/nonexistent/file rejection (11 fail) - SEC-05: DeprecationWarning emitted for unknown **kwargs (5 fail) tests/recipes/test_step_02b_output_validation.py - SEC-01: validate_codebase_analysis() — whitelist keys, 64KB limit, depth ≤ 3, type validation, empty dict rejection (39 fail) Total: 86 collected | 81 fail | 4 pass | 1 skip Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🤖 Auto-fixed version bump The version in If you need a minor or major version bump instead, please update |
Repo Guardian - PassedAll 4 changed files were reviewed and no violations were found.
No ephemeral content, meeting notes, one-off scripts, or temporal snapshots detected. All additions are durable security specifications appropriate for the repository.
|
PR Triage ReportRisk: 🟡 Medium | Priority: High | Type: Test / Security (TDD foundation) SummaryTDD test files specifying the security hardening contract for SEC-01 through SEC-07. 81 of 86 tests intentionally fail against current code — this is by design, establishing the implementation target for follow-up security PRs. Coverage:
CI Status
Risk Factors
Recommendation
|
Summary
TDD test files specifying the security hardening contract from the #3266/#3282 design specification. All tests intentionally fail against current code — they define the implementation target for the follow-up security PRs.
Test files added
tests/test_memory_auto_install_security.pytests/recipes/test_run_recipe_by_name_working_dir.pytests/recipes/test_step_02b_output_validation.pyWhat each set tests
SEC-01 (
test_step_02b_output_validation.py) —validate_codebase_analysis()in new modulesrc/amplihack/recipes/_validation.py:{files, patterns, dependencies, entry_points, build_system, language, test_framework}__system__,IMPORTANT)SEC-03 (
test_run_recipe_by_name_working_dir.py) —_validate_working_dir(path)helper:;,&,|,$, backtick,(,),{,},[,],<,>,\\,",'pathlib.Pathfor valid directoriesrun_recipe_by_namecalls validator before Rust runnerSEC-04 (
test_memory_auto_install_security.py) — Hash verification:--require-hashesflag in pip install commandsrc/amplihack/memory_auto_install_hashes.txtfile existence and non-emptinessSEC-05 (
test_run_recipe_by_name_working_dir.py) — DeprecationWarning for unknown kwargs:adapter="old"emitsDeprecationWarningnaming the kwarguser_context,dry_run,progress, etc.)SEC-07 (
test_memory_auto_install_security.py) — Error sanitization:_sanitize_error()strips Unix and Windows absolute paths_do_installcalls_sanitize_error()on pip failure outputTest plan
main(proving they are real TDD tests)_sanitize_error) → 6 SEC-07 tests pass--require-hashes) → 4 SEC-04 tests pass_validate_working_dir+ integration intorun_recipe_by_name) → 15 SEC-03 tests passrun_recipe_by_name) → 5 SEC-05 tests passvalidate_codebase_analysisin_validation.py) → 39 SEC-01 tests pass🤖 Generated with Claude Code