Repository navigation
fix: add seatbelt network_access test coverage and sandbox policy tracing - #10392
fede-kamel wants to merge 8 commits into
Conversation
- Add unit tests verifying network policy inclusion/exclusion in seatbelt args based on network_access true/false - Add integration test that proves seatbelt actually allows/blocks socket creation based on the network_access flag (localhost only, no external network dependency) - Add tracing to derive_sandbox_policy() logging the resolved sandbox mode, its source (cli-flag/config-toml/default), and network_access value — helps users debug when network is unexpectedly blocked Ref: #10390
|
All contributors have signed the CLA ✍️ ✅ |
|
We've updated our contribution guidelines to indicate that we're no longer accepting unsolicited code contributions. All code contributions are by invitation only. To read more about why we've taken this step, please refer to this announcement. |
|
@etraut-openai Same as noted on #10391 — we understand the policy and respect it. Just want to highlight that this PR includes integration tests that actually uncovered pre-existing test failures in the seatbelt suite ( The code, tests, and tracing are all here if the team ever wants to reference or cherry-pick from them. Best of luck. |
|
@fede-kamel, I appreciate the time you took to understand the problem here. Most code contributions we've received historically haven't had this level of analysis or understanding behind them. After taking a closer look at this PR, I think this is something we'd be interested in. I'm going to reopen and put it in our review queue. I'll also take a look at your other associated PR. Thanks again! |
|
@fede-kamel, you'll need to sign the CLA. |
|
I have read the CLA Document and I hereby sign the CLA |
|
Over the next few weeks, we're doing some overhaul work on the sandbox mechanism and the config controls. Since a bunch of this is likely to change, I'm going to close this PR. Thanks again for taking the time to submit this. |
|
sounds good @etraut-openai - Please keep us updated on this change as it is impacting the codex community. Thanks! |
|
@etraut-openai — circling back on this ~7 weeks later. The sandbox overhaul has been impressive (proxy-aware networking, split filesystem policies, new However, the core issue this PR was motivated by — #10390 ( Two items from this PR that still appear unaddressed:
Happy to rebase and adapt this work to the new architecture if it would be useful. The code and approach are all still available on the branch. |
|
@etraut-openai — the sandbox overhaul is complete and the issue this PR was meant to address (#10390) is still open with active reports as of this week. I've gone beyond the original diagnostic scope and implemented a root cause fix against the current Detailed root cause analysis and the fix summary are in my comment on #10390: #10390 (comment) Happy to open a PR directly if you can grant collaborator access, or the team can cherry-pick commit |
Summary
network_accessflagtrueandfalsein a single test, using localhost socket bind (no external network dependency, CI-safe)derive_sandbox_policy()logging the resolved sandbox mode, its source (cli-flag/config-profile/config-toml/default), and thenetwork_accessvalueContext
All existing seatbelt tests use
network_access: false. There was zero coverage for thetruepath — the seatbelt network policy was never verified in tests, either at the arg-generation level or at the OS-enforcement level.The tracing helps users debug why network is blocked. Today, when
[sandbox_workspace_write] network_access = truedoesn't take effect (e.g., because nosandbox_modeis set and the fallback isReadOnly), there is no log output explaining what happened. The newtracing::info!lines make the resolution chain visible.Ref: #10390
Test plan
cargo test -p codex-core seatbeltpasses on macOScreate_seatbelt_args_includes_network_policy_when_network_access_true— verifies(allow network-outbound)present in policy stringcreate_seatbelt_args_excludes_network_policy_when_network_access_false— verifies(allow network-outbound)absentseatbelt_network_access_true_allows_socket_creation— runssandbox-execwith both policies, proves socket bind succeeds/fails accordinglyRUST_LOG=infowhen running the CLI