unsloth/studio
danielhanchen 997c7247f2 Harden sandbox: builtins-qualified exec sinks and dotted network imports in workdir modules; keyword-only compile payload; sponge child writer
Close four bypasses Codex found on the round-42 branch:

- builtins-qualified exec sinks in an imported workdir module: the import
  vetter only rejected the BARE eval/exec/compile/__import__ names, so a
  workdir helper doing `import builtins; builtins.eval("...")` ran arbitrary
  code at import unscanned. Recognize the execution builtins reached as an
  attribute of the builtins module (or an alias), for both the direct call
  and the assign-only reference (e = builtins.eval; e(...)). Requiring a
  builtins root keeps a benign .compile()/.eval() on another object
  (model.compile, df.eval) from being misread as a sink.

- keyword-only compile() payload: compile() accepts its source as the
  source= keyword, and a standalone compile() with no positional arg
  reached the payload-recovery early return (no node.args -> NO_PAYLOAD),
  so its code object was executed via the fn.__code__ = c; fn() gadget
  entirely unscanned. Recover the source= keyword before returning
  NO_PAYLOAD (eval / exec take no keyword arguments in CPython, so an empty
  node.args there is genuinely payload-less). A benign keyword-only compile
  is analyzed, not blanket-blocked.

- dotted stdlib network imports in a workdir module: the vetter left the
  urllib / http tops out so urllib.parse stays benign, but that also let a
  helper `import urllib.request` (or http.client) open outbound connections
  the static network policy never saw. Refuse the network submodules by
  their full dotted name (urllib.request, urllib.robotparser, http.client,
  xmlrpc.client), covering the import, `import ... as`, `from urllib.request
  import ...`, and `from urllib import request` forms, while urllib.parse and
  the bare tops remain importable.

- sponge child writer: sponge (moreutils) soaks up stdin and writes it to a
  file argument (printf x | sponge /tmp/probe), an unguarded-child write
  outside the workdir. Add it to the child-writer denylist next to tee /
  patch / mktemp.

Regression coverage: TestRound43Bypasses in tests/test_sandbox_tools.py
(keyword-only compile via the __code__ / FunctionType / exec(compile())
gadgets, sponge child writer, plus a benign keyword-only compile that stays
allowed) and three workdir-module vetter cases in
tests/test_sandbox_runtime_backstop.py (builtins.eval sink denied,
urllib.request denied, urllib.parse still allowed).
2026-07-10 16:41:10 +00:00
..
backend Harden sandbox: builtins-qualified exec sinks and dotted network imports in workdir modules; keyword-only compile payload; sponge child writer 2026-07-10 16:41:10 +00:00
frontend Stabilize floating monitor drag (#6984) 2026-07-09 00:16:05 -07:00
src-tauri Speed up Studio startup path (#6899) 2026-07-07 18:08:07 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
install_llama_prebuilt.py Studio: add Vulkan llama.cpp support (#5819) 2026-07-09 03:39:48 -07:00
install_node_prebuilt.py Pin isolated Node.js installer to committed sha256 digests (#6625) 2026-06-24 05:47:58 -07:00
install_python_stack.py Studio: fix flash-attn and torchao install on Blackwell (sm_100+) GPUs (Closes #6961) (#6970) 2026-07-08 06:38:10 -07:00
LICENSE.AGPL-3.0 Add AGPL-3.0 license to studio folder 2026-03-09 19:36:25 +00:00
node_prebuilt_pins.json Pin isolated Node.js installer to committed sha256 digests (#6625) 2026-06-24 05:47:58 -07:00
package-lock.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
package.json ci: advisory lockfile supply-chain audit (no install-script changes) (#5604) 2026-05-19 05:56:56 -07:00
setup.bat Final cleanup 2026-03-12 18:28:04 +00:00
setup.ps1 Fix Windows installer torch index override (#6972) 2026-07-09 03:46:47 -07:00
setup.sh Studio: source CPU llama.cpp prebuilts from unslothai/llama.cpp (#6311) 2026-07-08 05:34:59 -07:00
Unsloth_Studio_Colab.ipynb Studio Colab: opt-in shareable Cloudflare tunnel link (#6684) 2026-06-26 00:56:23 -07:00