Skip to content

fix: Enforce non-zero positive sandbox timeouts to prevent indefinite hangs (#1808)#2050

Open
Rakshak05 wants to merge 2 commits into
utksh1:mainfrom
Rakshak05:issue-#1808
Open

fix: Enforce non-zero positive sandbox timeouts to prevent indefinite hangs (#1808)#2050
Rakshak05 wants to merge 2 commits into
utksh1:mainfrom
Rakshak05:issue-#1808

Conversation

@Rakshak05

Copy link
Copy Markdown
Contributor

Description

This PR addresses a vulnerability/bug where a falsy sandbox timeout_seconds value (0, negative, or None) allowed subprocess execution and reader tasks to run indefinitely without a wall-clock limit. If a scanner hung, the process would run forever.

To resolve this:

  • Added a @field_validator to SandboxConfig in models.py that raises a ValidationError / ValueError and logs a warning if timeout_seconds is <= 0 or None.
  • Added a @field_validator to Settings in config.py that checks both sandbox_timeout and parser_sandbox_timeout_seconds, raising a ValidationError / ValueError and logging a warning if they are <= 0 or None.
  • Added accompanying unit tests to verify validation behaviors for both models and settings.

Related Issues

Closes #1808

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Ran the updated unit test suite targeting config settings and sandbox configurations:

python -m pytest testing/backend/unit/test_sandbox_config_model.py testing/backend/unit/test_config_settings.py testing/backend/test_sandbox_executor.py testing/backend/test_sandbox_blocking_issues.py

Results: All 78 tests passed.

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.

@Rakshak05 Rakshak05 changed the title Resolves issue-#1808 fix: Enforce non-zero positive sandbox timeouts to prevent indefinite hangs (#1808) Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#35] No timeout when sandbox timeout_seconds is 0/None

1 participant