unsloth/studio
danielhanchen 93a1786898 Harden sandbox: Path.open reads, shell -c argv reads, ANSI-C quoting, from-import subprocess sinks, escaping globs
Round 16 review follow-ups on the Studio code-exec sandbox classifier and runtime guard:

- Apply the runtime sensitive-read backstop to Path.open reads (not just write
  modes), so a dynamically assembled pathlib receiver (Path(globals()['P']).read_text())
  cannot exfiltrate a host secret. On Python <= 3.11 pathlib holds the original io.open,
  so confining at the public Path.open level is the version-robust fix. read_text /
  read_bytes route through the same self.open() and are covered.
- Scan the -c payload of a subprocess shell argv for sensitive reads. subprocess.run(
  ['sh', '-c', 'head -1 /etc/passwd']) has no blocked command, but the unguarded child
  prints the secret, so the payload is now tokenized and read-scanned like a string sink.
- Normalize bash ANSI-C ($'...') and locale ($"...") quoting before command matching.
  shlex leaves $'touch' as the literal $touch, so a writer / interpreter hidden behind
  ANSI-C quoting ($'touch' x, $'\x74ouch' x) previously evaded the command blocklist;
  the escapes bash resolves (\n, \xHH, octal, \uHHHH) are decoded first.
- Recognize from-imported subprocess exec names as read sinks: from subprocess import
  run as r; r(['cat', '../../etc/shadow']) now hits the traversal / sensitive-read check.
- Treat a shell glob that can expand outside the workdir (absolute / ~ rooted, e.g.
  head /etc/shad*) as an escaping read expansion and fail closed, for reader arguments
  and input redirects. A relative in-workdir glob (grep foo *.txt) stays allowed.

Adds TestRound16Bypasses and pathlib runtime backstop tests; full sandbox suite green.
2026-07-09 23:01:47 +00:00
..
backend Harden sandbox: Path.open reads, shell -c argv reads, ANSI-C quoting, from-import subprocess sinks, escaping globs 2026-07-09 23:01:47 +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