Urgent.News

What's breaking now, across thousands of outlets.

Tech

Running untrusted pull request code from agents and contributors

Originally published on sandscale.dev . A pull request is a request to run someone else's code on your machine. CI has always worked this way: check out the branch, install dependencies, run the tests. The code that runs includes the test files, the build scripts, the install hooks of every new dependency, and anything the PR changed in your CI config. That was already a risk with human…

Pull requests allow developers to run someone else's code on their machine during the testing phase. This introduces risks such as code escaping or damaging the system, exfiltrating sensitive information, establishing persistence, or consuming excessive resources. To mitigate these risks, using a sandbox environment can isolate the untrusted code.

Sandscale provides a sandboxing service that creates a Firecracker microVM for each PR, ensuring a separate kernel and network environment for each test run. By starting a fresh sandbox for each PR, you can limit the potential damage that malicious code can cause. The sandbox is stopped automatically after a certain time limit to prevent runaway processes, and the use of a template with a short TTL_seconds value further ensures efficient resource management.

To run the untrusted code, you start by creating a sandbox with a short life using the API and specifying a unique name for the PR. The sandbox is then populated with the PR's files using a POST request, without exposing it to the internet. The tests are run within the sandbox using the POST /exec endpoint, which returns useful information such as exit codes, stdout, and stderr.

After the tests complete, the sandbox should be stopped and discarded, leaving no trace of the potentially malicious code. While the sandbox provides a strong boundary against unauthorized access and data exfiltration, it's essential to remember that no protection is foolproof. The exit codes and logs should still be treated as untrusted input, and a thorough review of the PR's output is necessary before considering it safe to merge.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How do you tune speculative decoding in a production serving stack?

Tune speculative decoding against your own traffic, not a benchmark. Choose a method that fits your workload, set draft length from measured acceptance rate, and re-test at production concurrency…

  • Base speculative decoding method on your own traffic data, not benchmarks.
  • Choose n-gram or suffix decoding for modest speedup; use EAGLE or MTP for best latency reduction.
  • Adjust draft length based on acceptance rate; test multiple values and monitor per-request metrics.

5 Security Mistakes I See in Flask + React Apps (and How to Fix Them)

Flask and React are a great pairing: fast to build, flexible, and easy to deploy. But that same speed means security often gets pushed to "later," and later usually means after something breaks.

  • Validate user input against schema using Pydantic
  • Store JWTs in HttpOnly, Secure, SameSite cookies
  • Include token in Authorization header on React frontend

More from Friday 20 November →