Validate navigate URLs and exec timeouts on the Bot computer - #429
Merged
davidmckayv merged 2 commits intoSep 8, 2026
Merged
Conversation
/navigate accepted any string and handed it to page.goto, so an empty string came back as a 502 Navigation failed that reads as a broken computer, and a javascript: or file:// URL was never refused up front. /exec forwarded NaN and Infinity into the shell, where Math.max(NaN) stayed NaN and setTimeout fired at once: the command was reported as timed out before it did anything. Check both shapes before the browser or the shell is reached and answer 400 naming the field, matching the server gateway's validation of the same timeout. The shell itself falls back to its default on a non-finite value, so a direct caller gets a run rather than a lie.
Ayush7614
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 7, 2026 15:41
davidmckayv
approved these changes
Sep 8, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
navigate-URL + exec-timeout validation. Deep-reviewed clean (no SSRF/over-block). CI failure was pre-existing handoff-integration flakiness (baselined 3/5 on clean main); rerun green.
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.
What
Two shape checks on the Bot computer itself (
agent-computer), which holds no policy engine — so a malformed call should be a 400 naming the field, not a 502 that reads as a broken computer:POST /navigateaccepted any string intopage.goto: an empty string came back 502 Navigation failed, andjavascript:/file:///data:/ftp:URLs were never refused up front. NewparseNavigateUrltrims, requires a parseable URL, and allows onlyhttp:/https:.POST /execforwarded NaN/Infinity into the shell, whereMath.max(NaN, 1000)stays NaN andsetTimeout(NaN)fires at once — the command reported timed out before doing anything. NewparseExecTimeoutenforces whole milliseconds in 1000..600000 (matching the server gateway), andshell.runfalls back to its default on a non-finite value so a direct caller gets a run rather than a lie.Why it matters
The computer is the Bot's SSRF surface (/navigate) and its most expensive action (/exec). Both previously failed in ways that pointed at the computer instead of the caller. The shared validation module (
agent-computer/src/request-validation.ts) is pure and unit-tested without a browser.Verification
agent-computer/tests/request-validation.test.ts(new): 11 invalid navigate inputs rejected, 10 invalid timeouts rejected, valid inputs pass — 24 pass.agent-computer/tests/shell.test.ts(+2 NaN/Infinity cases): a non-finite timeout now runs the command with the default instead of reporting an instant timeout — 23 pass.bun run --filter server typecheck— clean (agent-computer's pre-existing missing playwright/spiffe deps in this env are untouched). Biome format + lint — clean.