Skip to content

v1.7.0 — Unreadable files are errors, and fewer false CRITICALs

Latest

Choose a tag to compare

@lab700xdev lab700xdev released this 25 Oct 23:18
831b500

Scans now contact PyPI by default. When a scan finds exact requirements.txt pins such as transformers==5.13.1, it requests each pinned package name and version from pypi.org to read that release's declared license. Nothing else is sent. The GitHub Action and aisbom score do the same.

Local scans can now contact Hugging Face. A local model file in the Hugging Face cache layout, or next to a config.json whose _name_or_path names a repo, makes the scan fetch that repo's file list and model card from huggingface.co. What is sent is the repo id and, for a cached file, the commit from its path. The file's hash is compared on your machine. If HF_TOKEN is set, it is sent to huggingface.co, as for hf:// scans. A tree with neither kind of file makes no request. Pass --no-hf-lookup or set AISBOM_NO_HF_LOOKUP=1 to turn this off.

--offline turns off every network request: both of these, the OSV lookup, telemetry and the update check. AISBOM_OFFLINE=1 does the same.

Unreadable model files now exit 1 instead of 0. A file that no parser could read — a git-LFS pointer stub, an empty file, a truncated stream, a file in no recognised format — was reported as Risk: LOW with a confident framework label and passed as a clean scan. It is now reported as an error and exits 1. If your tree contains such files, a pipeline that passes today will start failing. That is the intended signal: those files were never examined, and --fail-on-risk was reading LOW on an artifact nothing had opened. The exit-code table in the README has always documented exit 1 for "a file failed to parse".

New

  • Dependency licenses from PyPI. Library components parsed from requirements.txt now carry the license their package declares on PyPI, in the standard licenses[] field, with an aisbom:license:source property of pypi. Only exact == pins are looked up. Ranges such as torch>=2.0 don't say which release is installed, so they are skipped and counted in the scan summary. The PEP 639 License-Expression is used first, then a valid SPDX identifier or expression in the license field, then a classifier that names exactly one license. A license text pasted into the field, or a classifier such as BSD License that doesn't say which BSD, gives no license rather than a guessed one.

    In SPDX 2.3 output, SPDX-valid values become licenseDeclared, and licenseConcluded stays NOASSERTION. The license never affects the legal-risk status of model files. Results are cached in ~/.aisbom/pypi_license_cache.json: 30 days for a resolved license, 24 hours for a package that declares none. If PyPI can't be reached, those dependencies carry no license, the scan prints a warning, and exit codes are unchanged. The lookup runs only for CycloneDX and SPDX 2.3 output, the two formats with a field for it.

  • Model cards for local files downloaded from Hugging Face. A local model file can now get the same modelCard data an hf:// scan produces. The evidence is either the Hugging Face cache path (models--<org>--<name>/snapshots/<commit>/) or a config.json beside the file whose _name_or_path is a repo id. The card is added only if the file's hash appears in that repo's file list, and an aisbom:hf:match property records which evidence matched. A file whose bytes aren't in the repo, such as a fine-tune that still names its base model, gets no card. Neither does a file that matches more than one repo. The lookup runs for CycloneDX 1.7 and SPDX 3.0 output, and in aisbom score.

  • --offline for air-gapped scans. aisbom scan --offline and aisbom score --offline make no network access: no PyPI, OSV or Hugging Face lookup, no telemetry and no update check. AISBOM_OFFLINE=1 does the same for any command. hf:// and https:// targets and --share are refused with exit 1, because each needs the network. The SBOM is otherwise the same, minus the dependency licenses, CVE statements and model cards those lookups would have added. The air-gapped guide now recommends it.

Fixed

  • Common non-pickle weights files no longer score CRITICAL (Legacy Binary). A .pt/.pth/.bin that was not a zip, a pickle, or a path config fell into a catch-all that rated it CRITICAL and exited 2. In a scan of the 500 most-downloaded Hugging Face models, every HIGH or CRITICAL result came from that catch-all and none was a payload. Three weights formats are now recognised by their content and rated LOW, like SafeTensors and GGUF, because none is a pickle or runs code on load:

    • CTranslate2 model.bin, which covers every faster-whisper model: recognised by its version header and spec name (WhisperSpec, …).
    • OpenVINO IR .bin: recognised only when its same-name .xml graph sits beside it. On hf:// scans, the repo listing is checked first, so a .bin with no graph costs no extra request.
    • Core ML weight.bin inside an .mlpackage or compiled .mlmodelc: recognised by its weight-blob header.

    Their components carry aisbom:format values ctranslate2, openvino and coreml. The pickle scan still runs first, so a payload under any of these names is still CRITICAL. A .bin matching none of them is still CRITICAL (Legacy Binary). With recursive hf:// scans (below), this is what keeps hf://sentence-transformers/all-MiniLM-L6-v2 and hf://google-bert/bert-base-uncased from failing on their openvino/ and coreml/ folders.

  • ONNX, SafeTensors and GGUF files with a PyTorch extension are inspected as what they are. Dispatch used to be by extension alone, so an ONNX model saved as .pt went through the pickle path and came out CRITICAL (Legacy Binary). Such a file now goes to its own format's inspector. The component is marked identified_by_content in its details.

  • A failed read of a torch checkpoint is an error, not CRITICAL. Python's zip check swallows network errors, so one failed Range request on a remote checkpoint made an ordinary torch zip look like an unknown binary. A file that starts with a zip header now gets a second check. If it still won't open, it is reported as unreadable (TruncatedStream, exit 1) with the underlying error, never as a verdict. A local truncated zip gets the same treatment, so its unreadable_type changes from UnrecognizedFormat to TruncatedStream.

  • scan hf:// now scans model files in subfolders. The Hugging Face file listing was read without recursive=true and only its first page was used, so every supported file under a folder (onnx/, unet/, text_encoder/, …) was skipped without a word. A repo whose weights all live in subfolders scanned as "No AI models found" and exited 0. The listing now reaches every depth and follows every page. A failure on any page fails the scan the way a first-page failure always has, and a next-page link that leaves huggingface.co is refused, since the token is sent with each page. Expect more components, and possibly new findings, from repos you already scan.

  • "Could not read it" is no longer reported as "read it, it's clean". LOW asserts that AIsbom opened an artifact and found nothing dangerous; for a file no parser could read, the honest answer is different. Five inspectors already recorded their own parse failure internally and nothing ever consulted it, so a truncated zip, a two-byte pickle, 200 bytes of random data named .safetensors, and a plain-text .pt all graded LOW at exit 0.

    Such files now land in the scan's error list, print in their own Could not read section, and exit 1. They still appear in the SBOM — an auditor needs to see the file was present — but carry no framework label and no risk verdict, marked with aisbom:unreadable and aisbom:unreadable_type properties. A format label is applied only when that format's parser actually succeeded, so random bytes are no longer described as SafeTensors. aisbom score consequently refuses to grade a scan containing one.

    A git-LFS pointer gets its own message naming the remedy (git lfs pull), since that is a configuration problem rather than a corrupt artifact and is the most common unreadable .safetensors in practice.

  • UNKNOWN verdicts have a consequence. An unparseable GGUF, Keras or ONNX file was already labelled honestly, but UNKNOWN scores below LOW in the risk ranking, so those scans exited 0 and the file rated safer than a clean model. They now exit 1 like every other unreadable file.

  • A text .pt or .bin is no longer classified as a Python path config. .pth is legitimately also a Python path-configuration format, and any text file in those three extensions inherited that classification — so an HTML error page saved over a checkpoint scored LOW. The classification is now .pth-only and validates against that format's actual spec (import statements and bare paths), verified against every .pth file in a real virtualenv.

  • A SafeTensors header longer than the file is rejected before it is read. Random bytes decode to an astronomical declared header length; that is now bounded by the bytes actually present, which replaces an internal OverflowError with a message saying what is wrong with the file.

Changed

  • hf:// components in subfolders are named by their path in the repo. onnx/model.onnx and openvino/model.onnx are now two distinguishable components rather than two named model.onnx. Files at the repo root keep the bare filename they had before, so existing aisbom diff baselines still match them.

  • A file listing that has to stop early is an error. The listing is capped at 100 pages (about 100,000 entries) so a pathological repo cannot hold a scan forever. If the cap is reached, everything listed is still scanned, and the scan reports ListingTruncated and exits 1 instead of passing on a partial view. cli_error telemetry carries ListingTruncated as its error_type.

  • Telemetry reports unreadable files. cli_scan gains unreadable_count and unreadable_types (a closed set: LfsPointer, EmptyFile, TruncatedStream, UnrecognizedFormat), so a wave of failed downloads is distinguishable from a wave of clones missing git lfs pull. Paths are never sent. AISBOM_NO_TELEMETRY=1 still turns telemetry off.

What's not changing

Pickle payload detection works as in 1.6.0. Each format newly recognised in this release is matched only after the pickle scan has found nothing. Output formats and the meaning of each exit code are the same as in 1.6.0. Unreadable files now carry no framework label or risk verdict, as described above. Every other SBOM change is an addition: dependency licenses, model cards for matched local files, more components from subfolders, and new aisbom:format values.