Repository navigation
Security audit: re-approve the huggingface-hub backoff loop for 1.30.0 - #10244
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Security auditis red onmainat568b73621, on all three shards this time,pip scan-packages :: studio,:: extrasand:: hf-stack:hf-stackis the tell. That shard is deliberately torch-free, so this is not the torch 2.14.0 reopen #10233 dealt with an hour ago. huggingface-hub 1.30.0 was published at 2026-09-03T10:05:12Z; the failing run started at 11:02. No commit in this repo caused it.It is the same loop, for the fifth time
tests/security/test_scan_packages.py::test_the_hf_backoff_suppression_is_narrowalready documents this file at length, and the baseline already carries four entries for it, one per revision the hub has shipped: L298, L462, L461 and L461 again. This is the fifth.RE_C2_POLLINGiswhile True .* sleep .* requests\.underre.DOTALL, so it cannot tell a bounded retry apart from a real beacon. The L461 loop in 1.30.0 ishttp_backoff, unchanged in shape:A retry that counts
nb_triesagainstmax_retries, sleeps with exponential backoff between attempts, and raises once the budget is spent. That is why the file is allowlisted rather than the check weakened, exactly as that docstring says.I read it out of
huggingface_hub-1.30.0-py3-none-any.whlitself rather than a GitHub tag, so it is the code the scanner actually sees.The patch
One additive, unpinned entry, matching how the other four are maintained. 227 entries to 228.
{ "package": "huggingface-hub", "file": "huggingface_hub/utils/_http.py", "check": "C2 polling/beaconing loop detected", "severity": "CRITICAL", "evidence": "L461: while True: sha256:a8f95a987a45a8eb67ee78dd9d98674c7b88c97e7722f63dd446f77e3dcfe0e7", "evidence_hash": "20a717b5faac68b3a57b11859f90d21959c29302e413bf3cd36e1263ccfbb00b" }evidence_hashcomputed through the scanner's own_evidence_hash, not by hand.Verified by running the scan both ways rather than by reasoning about it:
exit 0is what the shard step propagates, so all three shards go green.This is the fourth one today
Between torch 2.14.0 and huggingface-hub 1.30.0,
Security audithas gone red onmaintwice in one morning for reasons no commit here caused, and this file alone has now needed five entries.The cause is the one I wrote up in #10233 and I will repeat it here because this occurrence is a cleaner example of it. The evidence span for a cross-line DOTALL check runs from the first atom in the file to the last, and
_render's long-span fallback digests everything it bridged. Here that is roughly 650 lines to bind a 30-line retry loop, so any edit anywhere in that region reopens a CRITICAL. The entry is not pinned to the reviewed code; it is pinned to most of the file.The fix I measured is to give each cross-line regex a companion line-level atom pattern, and when
_renderfalls back to a digest, digest only the atom-bearing lines. On this exact file that collapses 1.26.1, 1.27.0 and 1.28.0 to a single stable digest, while a beacon loop spliced into the same file still reopens it, because it addswhile True,requests.andsleepatoms. It also keepstest_the_hf_backoff_suppression_is_narrowpassing.I am still not folding it in here, for the same reason: it rotates all 58 span-digest hashes at once and wants its own PR with each entry's code re-read, not a
--write-baselineregeneration bolted onto an unblock. But this is now the second time in a morning that the cost has been paid, and it is worth doing.