ON THE RADAR

transformers v5.22.2 hardens Jinja sandboxing and fixes NCCL device assignment

Hugging Face has shipped transformers v5.22.2, a patch release that hardens the Jinja2 sandbox used for chat templates and fixes a distributed-training device_id bug under NCCL.

Official source published Nov 6, 2026

Hugging Face has released transformers v5.22.2, a patch release described in the notes as "some in between patch for security and distributed fixes." The release was published on November 6.

What changed

According to the release notes, the patch hardens the Jinja2 sandboxing used when rendering chat templates (pull request #50431, by Rocketknight1) and sets device_id only for NCCL in distributed setups (pull request #50281, by michaelbenayoun and 3outeille). The notes point readers to the full changelog for the remaining fixes in the release.

Why the sandbox change matters

Editorial analysis: chat templates in transformers are Jinja2 templates, and they execute whenever a tokenizer renders a prompt. Because templates ship with model repositories downloaded from the Hub, the template sandbox acts as a security boundary between untrusted template code and the local machine. Hardening that sandbox limits what a malicious or over-permissive template can reach. The release notes do not describe a specific exploit and no CVE is referenced, so this reads as defense-in-depth rather than an emergency fix.

Who should update

  • Anyone on v5.22.0 or v5.22.1 serving models whose chat templates come from external repositories; the sandbox hardening is the relevant change.
  • Teams running distributed training or inference that hit device assignment issues under NCCL; pull request #50281 scopes device_id to NCCL.

Sources and caveat

This article reports exactly what the release notes state. The notes are terse and no independent security analysis of the sandbox change had been published at the time of writing, so the security impact beyond the description above is unverified.

Original sourceRead the official source