Hugging Face has introduced two security controls aimed at a recurring problem in agent infrastructure: an autonomous workload may hold valuable credentials while also being able to communicate with systems its operator did not intend it to reach.
Released on November 26, huggingface_hub v2.5.0 adds a command-line operation and Python helper for revoking exposed Hugging Face tokens. Separately, Hugging Face sandboxes can now run without outbound network access or under an allowlist enforced outside the guest process.
The combination matters because credential response and network isolation address different stages of the same risk. Revocation limits the usefulness of a token after exposure. Egress controls reduce the paths through which a sandboxed agent can transmit data, contact internal services or retrieve unapproved content in the first place.
Leaked tokens can be revoked through automated workflows
The new hf auth revoke command and revoke_tokens() Python helper let teams invalidate token values programmatically. One request can include as many as 1,000 tokens, making the function suitable for incident-response scripts that need to process a larger set of exposed credentials.
Revocation does not require authentication with a separate Hugging Face token. In practice, a security tool that discovers an exposed token can submit that token for invalidation without first retrieving an administrator credential. This removes a potentially awkward dependency from automated containment workflows and avoids placing another privileged secret inside a scanning or remediation service.
The control is particularly relevant to organizations operating coding agents, notebook environments and automated model pipelines. Tokens can appear in source repositories, build logs, environment files or generated output. Detection alone leaves an interval in which the credential remains valid; direct revocation gives secret scanners and security orchestration systems a concrete containment action.
Teams still need to investigate what the token could access, remove the original exposure and replace credentials where required. Revoking a token stops its future use, but it cannot reverse actions already performed with it or determine whether model artifacts and datasets were copied before revocation.
Sandbox network policy moves outside the agent’s control
Hugging Face sandboxes can now be created with network="none" to block all outbound traffic. Operators that need limited connectivity can instead allow specific hostnames, IP addresses, network ranges and ports.
The sandbox server enforces these policies with seccomp and Landlock. A process running inside the sandbox cannot remove the restrictions, even if that process runs as root. That distinction is important for agent workloads because the model, generated code and tools may all be treated as potentially untrusted. A policy implemented only inside the guest environment could be weakened by the same workload it is intended to constrain.
The implementation also fails closed. If a sandbox host cannot enforce the requested network policy, sandbox creation fails instead of launching the workload with unrestricted connectivity. This reduces the chance that an outdated or incorrectly configured host will silently give an agent internet access that its operator believed had been disabled.
Default-deny networking is useful for offline evaluation, local artifact processing and tasks whose inputs are mounted before execution. Allowlisting is better suited to workloads that must reach a small set of approved services, such as a package registry, model endpoint or company API. Operators should keep those lists narrow and review whether approved destinations could themselves be used to relay data elsewhere.
What changes for agent-platform operators
The update gives developers a native route to two controls that otherwise require additional infrastructure: immediate Hugging Face credential invalidation and server-enforced egress restrictions. It does not replace broader secret management, identity scoping, request auditing or network monitoring, but it can reduce the amount of custom containment logic surrounding a sandbox service.
For businesses running agents against untrusted repositories or user-supplied files, the practical priority is to define network access before execution rather than deciding after a task starts. Sandboxes that do not need external services can use no-network mode. Those that do should receive task-specific allowlists instead of a general internet connection.
Security teams can also connect token discovery to the new revocation operation, then record the affected identity, scope and replacement process in their existing incident workflow. Batch support makes this viable for repository-wide incidents or cases where one compromised environment contains many credentials.
The remaining variable is deployment discipline. The protections depend on operators using a compatible sandbox server, requesting restrictive policies and upgrading the client tooling where automated revocation is needed. They also protect only the boundaries they govern: Hugging Face token revocation does not invalidate credentials issued by other providers, and an outbound allowlist is only as safe as the destinations placed on it.