Feat/docker sandbox 2280 - #2285
Conversation
|
Thank you for submitting your pull request, @Vachhani-Tapan! 🙌 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
||
| return new Promise((resolve, reject) => { | ||
| // Strict 5-second timeout on the child process to prevent infinite loops | ||
| exec(dockerCmd, { timeout: 5000 }, async (error, stdout, stderr) => { |
📝 Pull Request Description
Related Issue
Closes #2280
Summary
This PR introduces a robust backend infrastructure for securely executing user-submitted code in isolated sandbox environments. By leveraging ephemeral Docker containers with strict resource bounds (no internet, 128MB memory limit, 5-second timeout killswitch), users can safely compile and run Python and JavaScript code natively on the platform during technical interview prep without risking host system compromise.
Type of Change
How Has This Been Tested?
POST /api/executeendpoint, verifying accurate stdout/stderr captures.while (true)loop snippet to guarantee thechild_process.exectimeout safely kills the runaway container and returns an execution timeout error./tmp/are immediately unlinked post-execution, preventing disk bloat.Screenshots (if applicable)
N/A - Backend infrastructure addition.
Checklist