Context
Post-merge review of #2144 found two trust-boundary gaps in the grading-artifact transport now on main:
_tar_out() checks wc -c in the sandbox, then performs a later unbounded runtime.read(). An agent-controlled process can replace or grow the archive between those operations, bypassing MAX_ARTIFACT_BYTES during the actual host transfer.
restore() extracts the transported tar at / without validating members against the declared artifact root. An agent that races or replaces the archive (or replaces tooling in its sandbox) can introduce absolute/parent-traversal members, escaping the declared path in the grading sandbox.
This is related to the broader artifact archival/transport contract in #2189, but it is the narrower security boundary: the transport must remain bounded and must not restore outside each declared root.
Suggested direction
- Use the runtime's bounded-read primitive during the transfer itself, with the remaining per-rollout budget.
- Validate every member before upload/restore: reject absolute paths,
.. traversal, entries outside the declared root, escaping symlink/hardlink targets, and unsafe special-file types.
- Keep validation and extraction ordering atomic from the host's perspective; reject before clearing/restoring roots.
- Add focused coverage for archive replacement/growth, traversal, escaping links, and valid nested files.
Done when
Found in the Macroscope review thread on #2152 after #2144 had already merged.
Context
Post-merge review of #2144 found two trust-boundary gaps in the grading-artifact transport now on
main:_tar_out()checkswc -cin the sandbox, then performs a later unboundedruntime.read(). An agent-controlled process can replace or grow the archive between those operations, bypassingMAX_ARTIFACT_BYTESduring the actual host transfer.restore()extracts the transported tar at/without validating members against the declared artifact root. An agent that races or replaces the archive (or replaces tooling in its sandbox) can introduce absolute/parent-traversal members, escaping the declared path in the grading sandbox.This is related to the broader artifact archival/transport contract in #2189, but it is the narrower security boundary: the transport must remain bounded and must not restore outside each declared root.
Suggested direction
..traversal, entries outside the declared root, escaping symlink/hardlink targets, and unsafe special-file types.Done when
MAX_ARTIFACT_BYTEScannot be bypassed by replacing or growing the sandbox archive after a size probe.Found in the Macroscope review thread on #2152 after #2144 had already merged.