Repository navigation
runtime: validate sandbox grant transport (#3433's later revision, by @adilalperenciftci) - #3466
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@nicolas-maman For an empty grant list, should I will keep the implementation, regression test, and changelog aligned with that contract. If the child should start, I will add an end-to-end assertion that a forbidden operation is denied. I will also separate grant-validation diagnostics from shared-memory creation failures. |
An invalid grant list (EINVAL) and an oversized one (E2BIG) were both reported as a shared-memory failure. The caller now reports 'invalid grant list', 'grant list too large' or the shm failure. Return value stays -1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The child tries a file read, a TCP connect and an exec and reports which were not refused; an empty list must refuse all three, matching grants must allow all three. With an inert preload the same test fails (child status 67). sandbox_grant_transport also checks the two new diagnostics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@adilalperenciftci thanks for the offer and the question. To land this we've coded an empty grant list as "start the child, with an active sandbox and zero permissions". That matches docs/containment-sandbox.md, where This push adds:
Tested: macOS 🤖 Generated with Claude Code |
The previous head (f49c475) carried [skip actions], which skipped CI for the code commits under it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Credit: this is @adilalperenciftci's work, the later revision of #3433 (ac2a506). It arrived after #3456 was built, so it missed that batch. Rebased onto main with his authorship kept; one test commit of ours on top. Thank you, Adil.
What it does
A single grant serialiser for both spawners,
runtime/sandbox/aether_sandbox_grants.h(aether_sandbox_serialize_grants):category:patternlines. A pattern containing a newline could add a line of its own, e.g.*:*(allow everything). CR or LF in either field, or a:in the category, now fails the spawn withEINVAL. A:in a pattern stays allowed (host:port).E2BIG. This supersedes the bound check Batch: seven sandbox, compiler and CI hardening PRs from @adilalperenciftci, with follow-ups #3456 added (e18798f); that guard is removed here.Rebase notes
aether_sandbox_grants.h.aether_sandbox_shm.hends up byte-identical to main's.sandbox_grant_overflowtest is kept; it passes, since E2BIG makes the spawn return -1.Our commit
557e848 adds the injection cases the harness lacked: a newline in the category, CR in either field, and a trailing newline in the pattern.
Verification
make test633 passed.make ciwith gcc-Werrorexited 0 (runtime suite 634 passed). sandbox_grant_transport, sandbox_grant_overflow, sandbox_unique_shm, sandbox_source_fail_closed and sandbox_exec_env_inherit all pass under gcc 11 and clang 14.For Nic: one contract change
An empty grant list used to make
spawn_sandboxedreturn -1. Now the child runs with an empty grant source. The preload treats that as an active sandbox with zero grants (#3436's fail-closed logic), so nothing is allowed. That is safe, but "no grants = refuse" becomes "no grants = run with nothing allowed". Keep it, or restore the -1?Also cosmetic: a validation failure still reports "cannot create shared memory for grants".
🤖 Generated with Claude Code