Skip to content

Keep transformers sidecar pins out of child argv (macOS XProtect blocks the installer) - #18883

Closed
shimmyshimmer wants to merge 1 commit into
mainfrom
studio-xprotect-sidecar-pins
Closed

shimmyshimmer wants to merge 1 commit into
mainfrom
studio-xprotect-sidecar-pins

Conversation

@shimmyshimmer

Copy link
Copy Markdown
Member

Fix the macOS "script was blocked because it contains malware" prompt during install/update

Fixes #18699.

On macOS 26, running curl -fsSL https://unsloth.ai/install.sh | sh from a command copied out of a browser could end at the transformers sidecar step with "A script was blocked because it contains malware". The Terminal tab was killed, and pasting the command again was refused ("Malware Detected, Paste Blocked").

Cause

When a pasted download-and-run command is executing, XProtect checks the command line of every process it starts against Google Safe Browsing. setup.sh checked and installed the 5.13 sidecar with transformers==5.13.1 as a command-line argument. XProtect reads 5.13.1 as the IPv4 address 5.13.0.1, and http://5.13.0.1/ is on the Safe Browsing malware list. The other sidecar pins (5.3.0, 5.5.4, huggingface_hub==1.8.0, hf_xet==1.4.2) pass.

Reproduced on macOS 26.6.2 (XProtect 5377) with private log data enabled:

  • A command copied from Firefox that runs /usr/bin/true transformers==5.13.1 is blocked. The same command with the other pins passes.
  • syspolicyd records the block as url-3a20768066824ab0..., which is the SHA-256 of http://5.13.0.1/.
  • An eslogger exec trace of a real update shows the three install_manifest.py sidecar ... audits at the point where the earlier runs were killed, with the same gaps between execs. The 5.13 audit is the third one, which is the one that was killed.

Change

  • studio/setup.sh: _sidecar_current pipes the pins to install_manifest.py sidecar <dir> - on stdin. The new _sidecar_install_pin writes each pin to a temporary requirements.txt and installs it with -r, for both uv and pip.
  • studio/install_manifest.py: sidecar <dir> - reads the pins from stdin. Pins passed as arguments still work.
  • studio/backend/utils/transformers_version.py: the runtime sidecar repair (_install_to_dir) also passes the requirement in a file. A Studio launched from a monitored Terminal would otherwise hit the same block.

Nothing changes for users: the same packages are installed into the same directories, and the printed step labels are unchanged.

Verification

  • New tests: tests/studio/install/test_sidecar_pins_off_argv.py (install and audit argv carry no pins, stdin and argv give the same shim answer) and studio/backend/tests/test_sidecar_install_pin_off_argv.py (uv and pip get the pin from a file that is removed afterwards).
  • tests/studio/install/test_install_manifest_pass_evidence.py, test_setup_fast_path_guard.py, tests/python/test_tokenizers_and_torch_constraint.py: 193 passed. The sidecar install count assertion is updated from 4 to 3 direct fast_install_sidecar calls, plus 2 _sidecar_install_pin calls.
  • studio/backend/tests/test_transformers_version_optional_tiktoken.py: passes.
  • The new shim on stdin gives sidecar: current on real 5.3.0 / 5.5.4 / 5.13.1 sidecars, the same answer as the argv form.
  • uv pip install --target ... --no-deps --upgrade -r requirements.txt and the equivalent pip command install into the target.
  • Pre-existing failures that also fail on main on this host: 8 tier tests in test_transformers_version.py (no transformers in the test venv) and 1 case in tests/sh/test_mirror_fallback.sh.

Not covered here

  • setup.ps1 is unchanged: XProtect is macOS-only.
  • Other three-part versions in installer command lines are not known to be listed. They could be in future, and the safest long-term rule is to keep pins out of argv.
  • Docs or snippets showing transformers==5.13.1 will still be paste-blocked when copied from a browser on macOS 26.
  • Not yet re-run end to end as a copied-from-browser install on macOS with this branch.

macOS XProtect checks the argv of a pasted curl | sh install with Safe
Browsing. It reads transformers==5.13.1 as the IPv4 address 5.13.0.1,
http://5.13.0.1/ is listed, and the whole Terminal session is killed with
the scripted-malware prompt, followed by paste blocking (#18699).

setup.sh now sends sidecar pins to install_manifest.py on stdin and to
uv/pip through a requirements file; the runtime sidecar repair in
transformers_version.py does the same.
danielhanchen added a commit that referenced this pull request Nov 22, 2026
…macOS XProtect block) (#18888)

## Move the highest transformers sidecar from 5.13.1 to 5.15.1

Related: #18699, #18883.

### Why

On macOS 26/27, XProtect checks the command line of processes started
from a pasted `curl ... | sh` install against Google Safe Browsing. It
reads a dotted version the way `inet_aton` does, so
`transformers==5.13.1` becomes `http://5.13.0.1/`. Google Safe Browsing
currently lists that URL as phishing (a fresh VirusTotal scan today
returns `Google Safe Browsing: phishing`; its stored 2016 record was
clean). The block id `url-3a20768066824ab0...` in the macOS log is the
SHA-256 of `http://5.13.0.1/`.

#18883 keeps the sidecar pins off argv. This PR also moves the pin
itself, so the version string no longer appears in any process, log line
or doc snippet that a user might paste.

### Why 5.15.1

| Version | tokenizers window | `import transformers` next to tokenizers
0.22.2 | `gemma4_unified`, `gemma4_assistant`,
`gemma4_unified_assistant` |
|---|---|---|---|
| 5.13.1 (current) | `>=0.22.0,<=0.23.0` | OK | yes |
| 5.14.1 | `>=0.22.0,<=0.23.0` | OK | yes |
| **5.15.1** | `>=0.22.0,<=0.23.0` | **OK** | **yes** |
| 5.16.1 | `>=0.23.1,<0.24.0` | fails: `tokenizers>=0.23.1,<0.24.0 is
required ... but found tokenizers==0.22.2` | n/a |

The sidecar is installed `--no-deps` and imports the main env's
tokenizers (pinned `<=0.23.0`), so 5.15.1 is the newest release that is
a drop-in. 5.16 and later would need their own tokenizers in the
sidecar.

The IP forms of all three sidecar pins after this change (`5.15.0.1`,
`5.5.0.4`, `5.3.0.0`) came back clean from a fresh Google Safe Browsing
scan via VirusTotal.

### Change

- `studio/setup.sh`, `studio/setup.ps1`: `.venv_t5_510` audit,
offline-defer loops, install call and step labels use 5.15.1.
- `studio/backend/utils/transformers_version.py`:
`TRANSFORMERS_510_VERSION = "5.15.1"`; the runtime repair reads its
package list from it.
- `studio/backend/requirements/studio.txt`: comment only (5.15.1 also
requires `safetensors>=0.8.0`).
- Tests: tokenizers-window table keyed on 5.15.1; kernels sidecar-scan
fixtures; the custom-code routing tests now pin the tier version where a
case depends on it being below the fake main release.

### Existing installs update automatically

- `unsloth studio update` or rerunning the install command:
`_sidecar_current` / `Test-SidecarCurrent` see 5.13.1 where 5.15.1 is
required, then wipe and rebuild `.venv_t5_510`.
- Without an update: the first load of a 510-tier model (Gemma 4 Unified
/ 12B, custom code saved by 5.11 to 5.15) runs
`_ensure_venv_t5_510_exists`, which compares the installed `Version:`
with `TRANSFORMERS_510_VERSION` and rebuilds on a mismatch.
- Offline (`UV_OFFLINE`): deferred to the next online update, as for
every sidecar.

### Verification

- `studio/backend/tests/test_transformers_latest.py`,
`studio/backend/tests/test_kernels_compat.py`,
`tests/studio/install/test_transformers_tokenizers_pair.py`: 169 passed,
1 skipped.
- Wider set (transformers_version, tiktoken, tokenizers/torch
constraint, fast-path guard, update idempotency, manifest pass evidence,
cap sites) on this change: 752 passed, 13 skipped. The one failure,
`test_main_offered_when_pypi_is_behind`, relied on the old pin being
below its fake 5.14 main release and is fixed here.
- `bash -n studio/setup.sh` clean; pre-commit ruff clean.

### Not covered

- No Gemma 4 Unified model was loaded or trained on 5.15.1; checked by
import and config mapping only, as #17589 did for 5.13.1.
- Not yet re-run as a copied-from-browser install on a Mac.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Saw "A script was blocked" - transformers==5.13.1 trips some scanners

2 participants