molecule-ai-workspace-runtime/tests
Molecule AI Infra-Runtime-BE ac8108a1a7
Some checks failed
ci / mirror-guard (pull_request) Failing after 9s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
fix(executor): sanitize peer delegation content in read_delegation_results (OFFSEC-003)
peer-supplied `summary` and `response_preview` fields written to
DELEGATION_RESULTS_FILE by the heartbeat loop were injected into the
agent prompt without sanitization — a direct OFFSEC-003 injection path.

New `_detect_injection_safe()` helper wraps
`builtin_tools.compliance.detect_prompt_injection()` with lazy import
and fail-open behaviour. When injection patterns are detected in either
`summary` or `response_preview`, the field is replaced with "" before
formatting. The delegation metadata (status, task line) is preserved so
the agent still knows a delegation completed; only the malicious content
is stripped.

Fail-open: if builtin_tools.compliance is unavailable (e.g. minimal
test environment), the function logs a warning and passes text through.
This is acceptable because builtin_tools is always present in production
containers; the fail-open only affects degenerate test environments.

6 new tests covering: clean pass-through, injection in summary,
injection in preview, truncation of clean preview, no-file path,
fail-open when compliance unavailable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 03:38:14 +00:00
..
conftest.py feat: migrate a2a-sdk 1.x (KI-009) (#39) 2026-04-24 01:54:33 +00:00
test_a2a_error_observability.py fix(tests): remove pytest-asyncio dependency from #51 regression tests 2026-04-24 11:34:30 -07:00
test_a2a_mcp_server.py fix(builtin_tools/audit): fail-secure RBAC — read-only default when config unavailable 2026-04-20 22:47:38 +00:00
test_adapter_loader.py fix(adapter-loader): fall back to any BaseAdapter subclass 2026-04-20 16:59:12 -07:00
test_audit.py fix(builtin_tools/audit): fail-secure RBAC — read-only default when config unavailable 2026-04-20 22:47:38 +00:00
test_executor_helpers.py fix(executor): sanitize peer delegation content in read_delegation_results (OFFSEC-003) 2026-05-11 03:38:14 +00:00
test_imports.py fix: switch top-level from adapters import to absolute imports (#1) 2026-04-16 07:53:03 -07:00
test_llm_auth.py fix(llm_auth): tighten base-URL hostname match + strip whitespace + no token in logs 2026-04-23 10:46:07 -07:00
test_plugins_builtins_env_scrub.py fix(plugins_registry/builtins): strip API keys from plugin setup.sh env 2026-04-20 22:52:13 +00:00
test_precommit_hook.py chore(precommit): add sk-cp- MiniMax pattern (F1088 retroactive fix); bump 0.1.16 → 0.1.17 2026-04-26 21:43:24 -07:00
test_session_resume_gate.py test: move sdk stubs to conftest.py (consistent across all test modules) 2026-04-16 11:15:45 -07:00
test_shared_runtime.py fix(shared_runtime): push heartbeat on CLEAR in set_current_task() (#37) 2026-04-22 17:33:42 +00:00
test_token_refresh_1877.py test(1877): convert async tests to sync httpx.Client to unblock CI 2026-04-23 13:35:45 -07:00
test_validation.py test+fix(builtin_tools/validation): add test coverage + fix ".." bypass in regex 2026-04-21 00:55:08 +00:00
test_workspace_id_validation.py fix(a2a_cli): validate WORKSPACE_ID in discover() before X-Workspace-ID header 2026-04-21 01:35:37 +00:00