Repository navigation
Hugging Face sign-in as a value-free native credential: status rows, guard, deny rules, per-host token policy - #268
Merged
seathatflowsinourveins merged 3 commits intoSep 25, 2026
Conversation
Make the Hugging Face sign-in a first-class native store on every host, so
a GPU host can fetch gated models through hf without any agent seeing the
token.
- Inventory: two native_store rows, huggingface-native (the active token
file) and huggingface-native-stored (the saved tokens). The schema checks
one path per entry and has no companion field, so the second file gets
its own row. The path template is huggingface_hub's own default,
${HF_HOME:-${XDG_CACHE_HOME:-$HOME/.cache}/huggingface}, verified in the
installed 1.32.0 constants.py and at the v2.0.0 tag. The legacy
HUGGING_FACE_HUB_TOKEN joins HF_TOKEN in must_not_be_set. HF_TOKEN_PATH is
listed as the rows' pointer variable.
- Checker: accept the HF_HOME template prefix, expand one nested
${NAME:-default} in a default (single-level templates expand as before),
and report a native store's set path override (HF_TOKEN_PATH) by name
under environment.native_store_path_overrides_present, with a
store_path_overridden warning on the affected rows.
- Guard: block both token files in every spelling of their directory
($HF_HOME, $XDG_CACHE_HOME/huggingface, the default and the
${HF_HOME:-...} forms), the hf and huggingface-cli token-print commands,
reads through $HF_TOKEN_PATH, and a reader or copy of the whole Hugging
Face home. The legacy variable joins SECRET_NAMES. whoami, login,
download, cache verify and cache ls still pass. SHA256SUMS refreshed with
sha256sum from adoption/hooks/claude.
- Deny rules: Read on both default token paths and Bash on the token-print
command, in the project settings and the user settings template.
- Docs: a Hugging Face sign-in section in docs/secret-storage.md covering
the per-host fine-grained token, the paste login, what agents may run,
offline serving units and workers without implicit tokens. Also corrects
the checker's exit-status sentence, and adds a dated addendum with the
alternatives and what would overturn it to the secret-storage decision.
- Tests: rows render as missing before sign-in, lstat-only 0600/0700 ok,
0644 is a finding with exit 1, the template follows HF_HOME and
XDG_CACHE_HOME, overrides and token variables are reported by name only,
every inventory pointer variable is guarded, and the new guard block and
pass cases.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Hot-file protocol (docs/lanes.md): the nine changed files that manifests/evidence.json already lists are re-registered with host_receipts.register_file. The component matrix and the new-host grand list are unchanged (--check passes). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…guard Independent-review repair for docs/secret-storage.md, the secret path guard's test coverage and scripts/credential_status.py: 1. Reword the HF_HUB_DISABLE_IMPLICIT_TOKEN sentence to match installed huggingface_hub 1.32.0 (utils/_headers.py get_token_to_send, verified against the hf tool's own environment): with the variable set, the token is sent only when code passes it explicitly (token=True or a string); implicit use is off for every call, writes included, since write helpers default their own token parameter to None like everything else. 2. Document, rather than silently claim closed, the HF-home rule's gaps: recursive reads/copies of an ancestor directory (~, $HOME, ~/.cache, $XDG_CACHE_HOME with a trailing / or /*), a relative read after `cd` into the Hugging Face home, and $HF_HOME/. all bypass HF_HOME_ROOT. Closing these in the regex would also catch ordinary `ls`/`du`/`cp` of unrelated parent paths, so per the reviewer's preferred option they are recorded as EXPECTED_PASS_THROUGH cases (each verified to still return None from guard.check()) and added to the docs "Does not stop" column. 3. Stop overclaiming guard coverage of $HF_TOKEN_PATH in all three places that described it: it is a pointer variable, so only a reader, copy or input redirect on it is blocked, not every command that names it. Add an inline interpreter that opens $HF_TOKEN_PATH directly (never spelling a literal `$HF_TOKEN_PATH`) to the documented and tested bypasses. 4. Add `stored_tokens` to .gitignore and to credential_status.py's SENSITIVE_BASENAME (with a tracked_sensitive_names test proving both the catch and that a bare `token` basename is deliberately not flagged, since it is too generic to ignore repository-wide); qualify the threat-model row's overclaim about "native-store names" the same way. 5. Record the huggingface_hub v2.0.0 tag's actual commit (97c5f5f2030c2df01b60548f7d357970a106cd7d, dereferenced read-only from the annotated tag object via `gh api .../git/ref/tags/v2.0.0` then `git/tags/<sha>`) next to the source-review citation in the decision record. scripts/hooks/secret_path_guard.py itself is unchanged (pure documentation and test fixes per the reviewer's preferred option), so adoption/hooks/claude/SHA256SUMS needs no refresh. Re-registered all six touched hot files in manifests/evidence.json. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
seathatflowsinourveins
deleted the
claude/hf-native-credential-20260925
branch
September 25, 2026 18:31
seathatflowsinourveins
added a commit
that referenced
this pull request
Sep 25, 2026
…tstrap page (#271) #268 (Hugging Face store rules) changed the secret-path guard and its SHA256SUMS hash after the v2026.09.25.1 re-pin, so tests.test_adoption_docs_consistency's changed-install-input check fails on main (ae30f94). The bootstrap unit that already notes the post-v2026.09.24.1 change now also says it changed after v2026.09.25.1 and to rerun the guard step from a checkout that has it. Co-authored-by: Scout <scout@local> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Sep 25, 2026
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.
Scope
3ff52117(currentorigin/main).lane:foundationadoption/credential-inventory.json: two native rows,huggingface-native(token) andhuggingface-native-stored(stored_tokens), under${HF_HOME:-${XDG_CACHE_HOME:-$HOME/.cache}/huggingface}scripts/credential_status.py: the template prefix,HUGGING_FACE_HUB_TOKENinmust_not_be_set(HF_TOKENwas already there), andHF_TOKEN_PATHreported by namescripts/hooks/secret_path_guard.py: both store paths, the legacy name, a block onhf auth token, and$HF_TOKEN_PATHas a pointer.claude/settings.jsonand the Claude settings template.gitignoreandSENSITIVE_BASENAME:stored_tokensdocs/secret-storage.md: a Hugging Face sectiondocs/decisions/2026-09-24-secret-storage.md: an addendum pinning the huggingface_hub v2.0.0 tag commit97c5f5f2The policy it documents:
hf auth loginin the user's own terminal. The token is fine-grained, with read access to gated repos only, one per host so each can be revoked alone. It goes in at the hidden prompt, never with--tokenand never with--add-to-git-credential. Check it withhf auth whoamiandpython3 scripts/credential_status.py.hf download <repo> --revision <40-hex> --local-dir …andhf cache verify.hfreads the store itself, so the value never enters agent context.hf auth tokenis blocked.HF_HUB_OFFLINE=1.HF_HUB_DISABLE_IMPLICIT_TOKEN=1. That behaviour was verified against the installed huggingface_hub 1.32.0get_token_to_send.Evidence-class table
hf auth tokenprinting, and the 0600 file and 0700 directory that hf writessource_reviewconstants.py,_auth.pyand_headers.py(code only; no token file read)HUGGING_FACE_HUB_TOKENis flagged by name; the guard blocks store paths,hf auth tokenand pointer reads, and allowswhoami,login,downloadandcache verifysynthetictests/test_credential_status.py,tests/test_secret_path_guard.pymissingwithout opening any filelocal_integrationpython3 scripts/credential_status.py→missing huggingface-native,missing huggingface-native-stored,result: ok (lstat and names only; no credential file was opened)~,$HOME,~/.cache,$XDG_CACHE_HOME), a relative read aftercd,$HF_HOME/., an inline interpreter callingget_token()synthetic, recorded as expected pass-throughsEXPECTED_PASS_THROUGHentries, also listed under "Does not stop" in the docsLocal commands run
adoption/hooks/claude/SHA256SUMSis refreshed for the new guard bytes.Decision record
An addendum to
docs/decisions/2026-09-24-secret-storage.mdcovers the Hugging Face row, the environment policy and the rejected alternatives: a per-provider 0600 env file,--token, a git credential, and exportingHF_TOKEN.Review
An independent Opus reviewer returned
readywith 5 low findings. A Sonnet repair round fixed all 5: the implicit-token wording, the guard pass-throughs recorded as known gaps, the$HF_TOKEN_PATHwording,stored_tokensin.gitignoreandSENSITIVE_BASENAME, and the v2.0.0 SHA. A Sonnet re-check returnedreadywith no new defects. Codex cross-family review is unavailable until 2026-09-30.Host evidence
None. No sign-in was performed; the user signs in natively. After merge: refresh the host guard with
install_claude_profile.py --only guard, the user runshf auth loginin their own terminal, thenhf auth whoamiandcredential_status.pyshould reportok.Checklist
🤖 Generated with Claude Code