[security] test(gateway): cover bridge spawn repro path#209
Open
Hinotoi-agent wants to merge 1 commit intoHKUDS:mainfrom
Open
[security] test(gateway): cover bridge spawn repro path#209Hinotoi-agent wants to merge 1 commit intoHKUDS:mainfrom
Hinotoi-agent wants to merge 1 commit intoHKUDS:mainfrom
Conversation
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.
Summary
This follow-up strengthens the regression coverage for the remote
/bridge spawnshell-execution boundary fixed in #208.#208 already marks
/bridgelocal-only by default. This PR adds a more reproducible gateway-level test that uses the real default command registry and a concrete marker-file payload, instead of only a syntheticSlashCommandstub.Security issues covered
/bridge spawnshell executionBefore this PR
SlashCommandobject./bridge spawn ... > markerpayload.After this PR
/bridgefromcreate_default_command_registry()./bridge spawn printf REMOTE_BRIDGE_EXEC > <marker>.Why this matters
The vulnerable behavior in #208 depended on the interaction between default command registration and the remote gateway slash-command gate. A regression test that exercises the real registry path is harder to accidentally satisfy with test-only metadata and better documents the original exploit shape.
How this differs from #208
#208 changed the command metadata and added the initial blocking tests. This PR is intentionally test-only: it improves reproducibility and regression precision after #208 was merged.
Attack flow
Affected code
tests/test_ohmo/test_gateway.pyRoot cause
/bridgelocal-only by default.CVSS assessment
/bridge spawnshell execution regressionAV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HRationale: this is the same bounded accepted-remote-sender command-execution issue fixed in #208. This PR only adds stronger regression coverage for that boundary.
Safe reproduction steps
I used the same gateway-level harness against the vulnerable base and patched branch:
Expected vulnerable behavior
On vulnerable code, the default registry treats
/bridgeas remote-invocable and the gateway reaches the bridge handler, spawning a shell process that writes the marker file.Changes in this PR
create_default_command_registry()andget_bridge_manager()into the gateway tests.test_runtime_pool_blocks_registered_bridge_spawn_without_shelling_out./bridgeresolves from the real default command registry./bridge spawnpayload throughOhmoSessionRuntimePool.stream_message().Files changed
tests/test_ohmo/test_gateway.py/bridge spawnregression coverageMaintainer impact
Fix rationale
The original vulnerability was reproducible through the real default command registry, so the regression suite should exercise that same route. Checking both bridge-session creation and marker-file side effects proves the command did not merely fail after partially spawning work.
Type of change
Test plan
Executed locally:
PYTHONPATH=src:. uv run pytest -o addopts='' tests/test_ohmo/test_gateway.py::test_runtime_pool_blocks_registered_bridge_spawn_without_shelling_out tests/test_ohmo/test_gateway.py::test_runtime_pool_blocks_bridge_spawn_from_remote_messages tests/test_commands/test_registry.py::test_bridge_command_is_marked_local_only tests/test_commands/test_registry.py::test_bridge_command_supports_explicit_remote_admin_opt_in -qPYTHONPATH=src:. uv run pytest -o addopts='' tests/test_commands/test_registry.py tests/test_ohmo/test_gateway.py -qPYTHONPATH=src:. uv run python -m compileall -q src/openharness/commands/registry.py tests/test_commands/test_registry.py tests/test_ohmo/test_gateway.pygit diff --checkuv run ruff check src/openharness/commands/registry.py tests/test_commands/test_registry.py tests/test_ohmo/test_gateway.pyDisclosure notes