Skip to content

test(sandbox): comprehensive test suite for exploit_sandbox module (+76 tests) - #144

Open
manus-use wants to merge 1 commit into
mainfrom
test/exploit-sandbox-suite
Open

test(sandbox): comprehensive test suite for exploit_sandbox module (+76 tests)#144
manus-use wants to merge 1 commit into
mainfrom
test/exploit-sandbox-suite

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Comprehensive test suite for the manus_agent.sandbox.exploit_sandbox module — 76 fully-mocked tests covering the entire ExploitSandbox class and all module-level helper functions.

What's tested

ExploitSandbox class

  • __init__ — default params, custom params, unique UIDs across instances
  • _labels — role tagging structure for all resource types
  • build_target — image build via docker_retry, build log collection (stream filtering), error propagation
  • start_target — network creation, container creation, network connect with alias, container start, wait_for_container_running, environment passing
  • wait_for_target — success on first probe, timeout (deadline exceeded), transient Docker error retry loop, non-transient error propagation
  • run_exploit — container creation on isolated network, code copy, interpreter resolution, exec execution, environment merging (TARGET_HOST + custom), None output handling, fallback interpreter reporting, non-zero exit codes
  • run_local_exploit — target-not-running guard, execution inside target container, env passing, None env default
  • get_target_logs — success, exception swallowing, no container, non-UTF-8 bytes
  • get_target_exit_code — success, non-zero exit, reload exception, missing State key, no container
  • get_docker_ps_all — success with tags, without tags (short_id fallback), list exception, per-container reload exception, no client
  • cleanup — full teardown (all resources), partial state, client close error handling, no client

Helper functions

  • _copy_to_container — tar archive creation, put_archive call, binary data, nested paths
  • _file_extension — python/bash/sh/unknown/case-insensitive
  • _execution_command — all languages + unknown default + case-insensitive
  • _interpreter_candidates — python (python3 first), bash, sh, unknown, case-insensitive, empty string
  • _resolve_interpreter — first candidate found, fallback candidate, empty candidates error, exec failure error, exit code 127, unexpected stdout, single candidate

Integration lifecycle tests

  • Build → start → run_exploit → cleanup (full remote exploit flow)
  • Build → start → run_local_exploit → cleanup (local privilege escalation flow)

Test characteristics

  • 100% mocked — no real Docker daemon, no network calls
  • Zero regressions — full suite passes: 1234 tests (1158 baseline + 76 new), 0 failures
  • Lint cleanruff check . passes with no warnings

Overlap check

Confirmed no duplicate by reviewing all open PRs:

No existing open or merged PR provides dedicated tests for sandbox/exploit_sandbox.py.

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.

1 participant