fix: fail gated Hugging Face acquisitions honestly#1646
Conversation
|
@codex review |
Performance BenchmarksCompared
|
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Additional real-model QA case: |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Additional validation for the requested enumerable-but-gated case: env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-llama32-final HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 60 "https://huggingface.co/meta-llama/Llama-3.2-1B"Outcome on head |
|
Additional gated-repository QA: |
# Conflicts: # modelaudit/core.py
Summary
success=falseoperational outcomes instead of claiming a successful scan with zero artifacts.?revision=through Hugging Face listing, sizing, info, and worker paths so pinned acquisitions are evaluated at the requested revision.Root Cause And Security Tradeoff
The CLI previously caught Hugging Face acquisition exceptions and only marked
has_errors; the JSON payload could still reportsuccess=true, no issues, no file metadata, and no scanned assets. That made a gated acquisition look like a completed clean scan. The fix records acquisition failures as inconclusive operational source outcomes, setssuccess=false, preserves exit code 2, and avoids any completed-artifact claim.The security tradeoff is deliberately fail-closed: if acquisition evidence is ambiguous or blocked, ModelAudit reports an operational acquisition error rather than silently treating the model as clean. The acquisition issue is informational, not a security finding, so successful acquisitions still scan normally and malicious findings remain visible.
Validation
uv run ruff check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/uv run ruff format --check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/uv run mypy modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/PROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest tests/test_cli.py -k "huggingface and (acquisition or gated or unauthorized or transient or malicious or benign or blocked or late_failure or encoded_revision)" --maxfail=1->10 passed, 257 deselectedPROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest tests/test_cli.py tests/utils/sources/test_huggingface.py tests/test_streaming_scan.py --maxfail=1->624 passed, 4 skippedPROMPTFOO_DISABLE_TELEMETRY=1 uv run pytest -n auto -m "not slow and not integration" --maxfail=1->17389 passed, 1292 skippedgit diff --checkReal Hugging Face QA
All real-model commands were run with token variables scrubbed and telemetry/caches isolated:
env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-final3-rank6 HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 30 "https://huggingface.co/black-forest-labs/FLUX.1-dev?revision=3de623fc3c33e44ffbe2bad470d0f45bccf2eb21"Outcome: exit 2,
success=false,has_errors=true,files_scanned=0,bytes_scanned=0,assets=0,issue_types=['huggingface_acquisition_error'],blocked=true,scan_outcome=inconclusive,scan_outcome_reason=huggingface_acquisition_blocked,requested_revision=3de623fc3c33e44ffbe2bad470d0f45bccf2eb21.env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-final3-rank13 HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 30 "https://huggingface.co/ideogram-ai/ideogram-4-fp8?revision=ee79a7237b519f1402ceacf952f30c8a31ec5073"Outcome: exit 2,
success=false,has_errors=true,files_scanned=0,bytes_scanned=0,assets=0,issue_types=['huggingface_acquisition_error'],blocked=true,scan_outcome=inconclusive,scan_outcome_reason=huggingface_acquisition_blocked,requested_revision=ee79a7237b519f1402ceacf952f30c8a31ec5073.env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-final3-rank15 HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 30 "https://huggingface.co/meta-llama/Meta-Llama-3-8B?revision=8cde5ca8380496c9a6cc7ef3a8b46a0372a1d920"Outcome: exit 2,
success=false,has_errors=true,files_scanned=0,bytes_scanned=0,assets=0,issue_types=['huggingface_acquisition_error'],blocked=true,scan_outcome=inconclusive,scan_outcome_reason=huggingface_acquisition_blocked,requested_revision=8cde5ca8380496c9a6cc7ef3a8b46a0372a1d920.env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-final3-rank21 HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 30 "https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct?revision=0e9e39f249a16976918f6564b8830bc894c89659"Outcome: exit 2,
success=false,has_errors=true,files_scanned=0,bytes_scanned=0,assets=0,issue_types=['huggingface_acquisition_error'],blocked=true,scan_outcome=inconclusive,scan_outcome_reason=huggingface_acquisition_blocked,requested_revision=0e9e39f249a16976918f6564b8830bc894c89659.Public ungated control:
env -u HF_TOKEN -u HUGGING_FACE_HUB_TOKEN -u HUGGINGFACE_HUB_TOKEN -u HUGGINGFACE_TOKEN -u HF_API_TOKEN HF_HOME=/tmp/modelaudit-task15-hfhome-final3-public_file HF_HUB_DISABLE_IMPLICIT_TOKEN=1 HF_HUB_DISABLE_TELEMETRY=1 PROMPTFOO_DISABLE_TELEMETRY=1 NO_ANALYTICS=1 uv run modelaudit scan --quiet --no-cache --format json --timeout 60 --max-size 1MB "https://huggingface.co/sshleifer/tiny-gpt2/resolve/main/config.json"Outcome: exit 0,
success=true,has_errors=false,files_scanned=1,bytes_scanned=662,assets=1,issue_types=[], no acquisition-error metadata.Malicious And Malformed Controls
test_scan_huggingface_malicious_successful_acquisition_still_reports_security_findings.test_scan_huggingface_blocked_source_does_not_hide_local_malicious_findings.test_scan_huggingface_transient_json_reports_acquisition_failed_not_blocked.test_scan_huggingface_streaming_late_failure_is_not_acquisition_error.No model weights, credentials, Hugging Face caches, or generated scan payloads are committed.