package-analysis icon indicating copy to clipboard operation
package-analysis copied to clipboard

[feature] Add security analysis support for Hugging Face model artifacts

Open nikhilred2619 opened this issue 1 month ago • 0 comments

Problem

OpenSSF Package Analysis provides static and dynamic analysis of artifacts from open-source package ecosystems to identify suspicious or malicious behavior.

Machine-learning model repositories introduce an additional supply-chain surface. Model repositories may contain serialized model artifacts, executable Python code, custom loaders, configuration files, and other dependencies that can affect a system when a model is downloaded or loaded.

I do not see Hugging Face/model repositories represented as a currently supported Package Analysis ecosystem.

Proposed direction

I would like to explore adding security analysis support for Hugging Face model artifacts.

A first implementation could focus on a deliberately small scope:

  • identify model serialization formats
  • detect potentially unsafe pickle/PyTorch serialization
  • distinguish model artifacts using safer formats such as SafeTensors
  • identify executable/custom model-loading code
  • execute selected model-loading operations inside the existing sandbox
  • capture filesystem access during loading
  • capture network activity during loading
  • capture child processes/commands launched during loading
  • produce normalized analysis results using the existing Package Analysis pipeline

I would also be happy to develop synthetic safe and malicious model fixtures so the behavior can be tested deterministically without relying on arbitrary public models.

Security goal

The goal would not be to determine whether a model's learned behavior is malicious. The scope would be the software-supply-chain and load-time security properties of the model artifact and repository.

For example, a model artifact that executes a shell command when deserialized should produce observable evidence even if the model itself otherwise behaves normally.

Implementation

If maintainers consider this direction useful, I would be happy to start with a minimal design and proof of concept covering:

  1. Hugging Face artifact identification/download
  2. serialization-format inspection
  3. sandboxed load-time behavioral analysis
  4. positive and negative test fixtures
  5. unit/integration tests
  6. documentation

I would appreciate guidance on whether Hugging Face should be modeled as a new Package Analysis ecosystem or whether model artifacts should enter through a more generic artifact-analysis path.

Thanks, Nikhil Donapati

nikhilred2619 avatar Oct 04 '26 17:10 nikhilred2619