Repository navigation
pull: gated and private repos come down with a Hugging Face token, sent only to the hub's own host - #3524
Merged
Conversation
ashhart
added a commit
that referenced
this pull request
Nov 16, 2026
4 tasks done
ashhart
added a commit
that referenced
this pull request
Nov 17, 2026
ashhart
force-pushed
the
lead/pull-hf-token
branch
3 times, most recently
from
November 20, 2026 09:03
b42bb53 to
a088f56
Compare
…nt only to the hub's own host The token is HF_TOKEN, then HUGGING_FACE_HUB_TOKEN, then the one token file the hf tools read: HF_TOKEN_PATH, else $HF_HOME/token, else ~/.cache/huggingface/token. Pull follows redirects itself, so a hop to another scheme, host or port, such as the storage a download is redirected to, goes without it; std.http.Client keeps the header on such hops. A 401 or 403 from the hub names the repo and whether a token is missing or lacks access, and is not retried.
ashhart
force-pushed
the
lead/pull-hf-token
branch
from
November 20, 2026 11:23
a088f56 to
6b20b43
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tensorfold pullcan't download gated or private Hugging Face repos today. No request carries a token, so Llama and Gemma repos fail atconfig.jsonwith a bareHubStatus, and a private repo exits 1 with no message. This sends the user's token, only to the hub's own origin.What this changes
Token:
HF_TOKEN, thenHUGGING_FACE_HUB_TOKEN, then the one token file thehftools read: the fileHF_TOKEN_PATHnames, else$HF_HOME/token, else~/.cache/huggingface/token(wherehf auth loginsaves it). Surrounding whitespace is trimmed. An empty variable counts as unset, so no file namedtokenin the working directory is ever read.Where it goes: only to the hub endpoint's own scheme, host and port (
huggingface.co, orHF_ENDPOINT's). Zig 0.17'sstd.http.Clientkeeps an Authorization header on redirects to any host, so pull now follows redirects itself (Auth.send) and decides the header on each hop. Downloads redirected to the storage hosts go without it. Each caller keeps its redirect limit.Refusals: a 401 or 403 from the hub's own origin is refused by name and not retried.
HF_TOKENor runhf auth login.HF_TOKEN(or whichever source) lacks access.Unusable tokens: a token with a space or control character inside, one over 4096 bytes, or an unreadable token file is refused by its source before any request. The token itself never appears in output, errors or files.
No token set: every request is unchanged.
The EXLR8 node pull behaves the same way.
Issue: n/a. This came from the 16 Nov check of competitor gap docs against main: three engines' docs list gated pulls, and main had no Authorization header anywhere in
zig/src/cli.Stacked on: main.
atc overlap --json: to run after review; no open PR toucheszig/src/cli/pull*.zigorhub.zig(checked withgh pr listfile lists on 16 Nov).Checks on this head
tools/pr_check.py --base origin/main: 0 errors, 1 advisory warning, "pass --pr NUMBER").zig build test-pull-host: 41/41. Before the change the two gated tests failed infetchOnewithHubStatus(33/35).zig build test-pull-security: 67/67 steps, 17/17 tests. The new "security:" tests reach the Linux and Windows CI runs.zig build test-cli: 48/63 (15 existing info and plan tests skip as before).zig build test-cli-memory-host test-info-config: 18/18.zig build test-cuda-host: 6777/6817 (40 skipped).zig build check-native-cuda-host: 7/7 steps.zig build test-golden: 55/55 equal.zig fmt --check build.zig zigandgit diff --check: clean.pull_auth.zigwas compiled for x86_64 and aarch64 Windows and Linux), and no real Hugging Face request.Receipt
n/a: a CLI download path that can't reach inference. Host checks are above.
Checklist
The title and description match the head commit.
New tests fail before the change, pass after it, and skip cleanly without their dependency.
Comments and docstrings are one line. No measurements or history in the source.
No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines. The test tokens are fictional (
hf_Example...).Synthena (Ash's Agent)