[security] fix(sandbox): fail closed for unsupported Docker domain policies#152
Merged
tjb-tech merged 1 commit intoHKUDS:mainfrom Apr 17, 2026
Merged
Conversation
The Docker backend currently turns any non-empty allowed_domains list into unrestricted bridge networking even though no per-domain enforcement exists. Keep Docker networking disabled and emit a warning until the backend can actually honor domain policies. Constraint: Preserve a small, reviewable fix instead of designing a full Docker egress filter Rejected: Keep bridge networking with docs-only clarification | leaves silently overbroad behavior in place Confidence: high Scope-risk: narrow Reversibility: clean Directive: If Docker domain policies are re-enabled later, add true enforcement before widening network access Tested: PYTHONPATH=src pytest -q tests/test_sandbox/test_docker_backend.py tests/test_sandbox/test_adapter.py Tested: PYTHONPATH=src ruff check src tests Not-tested: Full pytest suite in this environment (collection fails because optional pyperclip dependency is missing) Related: HKUDS#150
2c45dd1 to
5b66648
Compare
arik08
pushed a commit
to arik08/MyHarness
that referenced
this pull request
Apr 26, 2026
…DS#152) The Docker backend currently turns any non-empty allowed_domains list into unrestricted bridge networking even though no per-domain enforcement exists. Keep Docker networking disabled and emit a warning until the backend can actually honor domain policies. Constraint: Preserve a small, reviewable fix instead of designing a full Docker egress filter Rejected: Keep bridge networking with docs-only clarification | leaves silently overbroad behavior in place Confidence: high Scope-risk: narrow Reversibility: clean Directive: If Docker domain policies are re-enabled later, add true enforcement before widening network access Tested: PYTHONPATH=src pytest -q tests/test_sandbox/test_docker_backend.py tests/test_sandbox/test_adapter.py Tested: PYTHONPATH=src ruff check src tests Not-tested: Full pytest suite in this environment (collection fails because optional pyperclip dependency is missing) Related: HKUDS#150
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.
Closes #150.
Summary
This PR makes the Docker sandbox backend fail closed when
allowed_domains/denied_domainsare configured but not actually enforceable.Concretely:
--network noneWhy
Issue #120 / PR #121 introduced Docker sandboxing as part of the project’s safety-boundary story and exposed domain-policy settings through sandbox config.
The current Docker path, however, does not enforce those policy contents. Any non-empty
allowed_domainslist switches Docker networking fromnoneto plainbridge.That means two different policies such as:
github.com, denyexample.cominternal.example, denygoogle.comproduce the same unrestricted bridge configuration.
Root cause
src/openharness/sandbox/docker_backend.pychecks only whetherallowed_domainsis non-empty, but it does not propagate the policy contents into any enforcement layer.So the current behavior is effectively:
which is broader than the config semantics imply.
Change
Before / After
Before
allowed_domainsenabled--network bridgeAfter
allowed_domains/denied_domainskeeps--network noneCompatibility
srtbackend is unchangedValidation
PYTHONPATH=src pytest -q tests/test_sandbox/test_docker_backend.py tests/test_sandbox/test_adapter.pyPYTHONPATH=src ruff check src testsNotes
pytest -qon this local environment is currently blocked by unrelated collection errors caused by a missing optionalpyperclipdependency; I did not change the command/UI modules involved in those collection failures.