fix(executor): clamp user-supplied timeout to settings.sandbox_timeout#331
Conversation
|
Hi @utksh1, this PR is ready for review whenever you get a chance. All CI checks pass (backend-tests, backend-lint, formatting-hygiene, frontend-checks, benchmark, artifact-check). No merge conflicts with main. The branch is rebased on the current main tip. Could you also please add the relevant labels (bug, security, GSSoC '26) to this PR when reviewing? It would help with tracking. Thank you! |
utksh1
left a comment
There was a problem hiding this comment.
Requesting changes. The timeout clamp is correct in principle, but please add tests for timeout > settings.sandbox_timeout, shorter timeout values, invalid timeout values, and max_scan_time precedence before merge.
|
Hi @utksh1, following up on this PR. All CI checks are passing (backend-lint, backend-tests, frontend-checks, formatting-hygiene, benchmark). Could you take a look when you have a moment? Happy to address any feedback. Thank you! |
|
Thanks for following up. Clarifying the change request so it is actionable: Why this is blocked: What to do next:
|
utksh1
left a comment
There was a problem hiding this comment.
Re-reviewed after your follow-up, but I do not see new commits addressing the previous request. Please add tests for timeout > settings.sandbox_timeout, shorter valid timeouts, invalid timeout values, and max_scan_time precedence before this can merge.
|
Hi @utksh1, the requested tests have been added in the latest commit. Added to
All CI checks are passing. Ready for re-review. |
|
Gentle ping -- this PR has been open for 2 days. Could you please take a look when you get a chance? |
utksh1
left a comment
There was a problem hiding this comment.
Re-reviewed the latest update. The timeout clamp now enforces settings.sandbox_timeout as the hard ceiling while preserving shorter caller values, and the new tests cover over-cap, under-cap, invalid values, and max_scan_time precedence. Good to merge once the branch is fresh.
utksh1
left a comment
There was a problem hiding this comment.
Update after the latest main changes: the timeout clamp implementation looked good and was approved, but the branch is now conflicting after #414 landed in the same executor test area. Please rebase/resolve conflicts against current main, keep the timeout clamp tests intact alongside the stream listener queue tests, rerun CI, and request re-review.
_resolve_execution_timeout() accepted any positive integer from task inputs as the subprocess timeout, allowing a caller to override the operator-configured sandbox_timeout cap (default 600s) with an arbitrarily large value. A single request with max_scan_time set to INT_MAX could pin a worker for years and exhaust the concurrent task pool indefinitely. Change: apply min(timeout, settings.sandbox_timeout) so the resolved value never exceeds the operator cap. Callers may still request a shorter timeout than the default; they cannot request a longer one. Fixes utksh1#311
8fc11ca to
1a3df17
Compare
|
Hi @utksh1, rebased onto the current main and the conflict is resolved. The rebase replayed the single timeout-clamp commit on top of the latest main, so the stream listener queue tests from #414 ( The branch is now conflict-free. Could you please re-review when you get a chance? Thank you. |
utksh1
left a comment
There was a problem hiding this comment.
Re-reviewed the latest update. The implementation still only changes executor.py and does not add the requested regression coverage for timeout > settings.sandbox_timeout, shorter timeout values, invalid timeout values, and max_scan_time precedence. The clamp itself is the right direction, but this security/resource-control path needs those focused tests before merge.
utksh1
left a comment
There was a problem hiding this comment.
The timeout clamp now has focused regression coverage for oversized, shorter, invalid, and max_scan_time-precedence inputs. CI is passing after updating the branch.
Description
Fixes #311
_resolve_execution_timeout()inbackend/secuscan/executor.pyaccepted any positive integer from task inputs as the subprocess timeout. This allowed a caller to silently override the operator-configuredsettings.sandbox_timeout(default 600 s) with an arbitrarily large value. A single request withmax_scan_time=2147483647could hold a worker thread for years and starve every subsequent scan of a concurrency slot.Root cause
Fix
Callers may still request a shorter timeout than the configured default; they cannot exceed it. The operator retains full control via
settings.sandbox_timeout.Related Issues
Closes #311
Type of Change
How Has This Been Tested?
max_scan_time=9999999in task inputs now returns600(the defaultsandbox_timeout) rather than9999999.max_scan_time=30correctly returns30(shorter than cap, honoured).settings.sandbox_timeoutunchanged.Checklist
GSSoC '26