Repository navigation
fix(collect): read only regular files, and keep manifest names out of paths - #607
Merged
earakely-scale merged 14 commits intoNov 12, 2026
Merged
Conversation
… and time A manifest entry is read only under base_path, and its name is stored as a key with no separators or dot segments. On a local sandbox's host, which is this machine, a file is read only where it resolves inside the sandbox's work dir or base_path; sandboxes declare that folder as app_dir_on_this_machine. Only regular files are read, links followed, up to the step's max_bytes (16 GiB by default). The sandbox sends at most the size it reported, the decoder refuses more, and a read past its deadline is abandoned. Modal exec output streams instead of being read whole, and the CUA path applies the same checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each collected key becomes a clean relative member name: backslashes separate, drive prefixes, leading separators and '.' segments are dropped, and '..' climbs no higher than the archive root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n, time the whole read Under /app only the sandbox's work dir counts as a root: an agent could swap a folder there for a link out. A base_path outside /app still counts, resolved. Two manifest names that clean to one key get "key (2)" and on. The deadline covers exec too, which some providers run to completion. Manifest paths are matched against base_path normalized. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ranslates stat's %F names the file type in the system's language, so on a host with a non-English locale every file would have been refused. %f prints the raw mode, checked with stat.S_ISREG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collect reads a regular file of any size again, as before this branch. Reads stay bounded to the size stat reports and to the deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An entry outside base_path is read and named by its file, as before this branch. On a local sandbox's host the work-dir check still refuses an entry that resolves outside it, so a manifest can't reach this machine's files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… host check for manifests only Drops what could change an existing run's outcome: the read deadline, Modal exec output streaming, and following links (stat without -L now refuses a link, as main's integrity check effectively did). The local-host work-dir check applies to manifest entries only, so a path the task names is read wherever it is, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ll path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ot a new attribute The manifest check applies where the sandbox declares ON_THIS_MACHINE, and the allowed folder is /app as the sandbox itself resolves it: a local sandbox maps /app to its work dir. Sandbox and LocalSandbox are back as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not every VM on this machine ON_THIS_MACHINE also covers smol and Lume VMs, whose host commands run inside the VM; their manifests read anywhere in the VM again, as before. The check applies where the sandbox has a work dir standing for /app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A manifest entry on a local sandbox's host is read wherever it points, as before; that risk is accepted. Links stay refused in every mode, so a link the agent leaves still reaches nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…reported size The read is `base64 < path` again, decoded as before. Only the regular-file check stays in front of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… shows it The app repaints a clicked cell some time after the click, so the click's own screenshot can still show it unclicked on a busy runner, and the recording test failed by a few tenths of a second. The drive now records the cell's pixel in each screenshot, and the test bounds the video's change by the first screenshot showing it, still to one frame on the computer's clock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale
deleted the
edgararakelyan/collect-artifacts-hardening
branch
November 12, 2026 21:54
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.
Why
collect_artifactscopies what an agent leaves behind onto the operator's side. Two flaws let the agent reach past its own deliverables:manifest_step_id), the names in the agent's structured output were stored verbatim as the collected keys, and the explorer's "Download All" zip used each key as a member name. So a name like../../.bashrcbecame an archive entry that climbs out of the folder it's extracted into, holding bytes the agent wrote.base64 < pathuntil the sandbox closed the stream, whatever sat at the path, and its size was checked only afterwards./dev/zerostreamed onto the operator's disk without end, and a FIFO hung the step.What changes
Manifest names: an entry's name becomes a key with no separators and no
.or..segments, or the file's name if nothing is left.../../.bashrcis stored as.bashrc, and names that clean to the same key getkey (2),key (3)and so on. An entry underbase_path, normalized, is named by its path below it, and any other by its file name, as before.Regular files only: the size probe is
stat -c %f:%s, links not followed, and the raw mode bits are checked withstat.S_ISREG;%F's type names are translated by locale. A link, a device, a FIFO, a directory or a socket is refused before it's read.CUA path: the size probe refuses anything but a regular file (
[ -f ], which follows links as the oldwc -cdid).Explorer zip: every "Download All" member name is a clean relative path: backslashes count as separators, drive prefixes, leading separators and
.segments are dropped,..climbs at most to the archive root, and a name with nothing left becomesartifact.A flaky recording test:
test_a_scripted_drive_is_recorded_on_the_clock_its_screenshots_carrybounded the video's change to a clicked cell by the click's own screenshot. The app repaints the cell some time after the click, so on a busy runner that screenshot can still show it unclicked, and the test failed by a few tenths of a second, on main too. The drive now records the cell's pixel in each screenshot, and the test bounds the change by the first screenshot that shows it, still to one frame on the computer's clock.Compatibility
/:logs/run.jsonis now keyedlogs_run.json.//or./get a different member name.Tests
base_pathis collected and named by its file;base_pathis taken withbase_pathnormalized;/dev/zero, a FIFO or a directory;../../x,/abs/../../y, backslashes and drive prefixes.report.pdfis a link to/dev/zerostatsized the link itself../../.bashrc,..\..\evil.sh.bashrc,evil.sh../../x,/abs/../../y../../.bashrc,..\..\evil.sh,../../x,abs/../../y.bashrc,evil.sh,x,yNot covered here
base64it replaced in its container, can stream past the file's size, as before; the integrity check then fails the read.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge within its stated scope.Summary
The PR limits collection to regular files, cleans manifest keys, and keeps archive names relative. It also adjusts the recording test to wait for a screenshot that shows the repaint.
Reviews (17) · Last reviewed commit: "test(computer): name the repaint thresho..." · Reviewed by Greptile