Skip to content

feat: add PaddlePaddle scanner test coverage #539

@mldangelo

Description

@mldangelo

Description

The PaddlePaddle scanner (`paddle_scanner.py`) handles `.pdmodel` and `.pdiparams` files but has limited test coverage. Add comprehensive tests including both benign and malicious model samples.

Background

PaddlePaddle (PaddlePaddle.org) is a popular ML framework, especially in China. Model files can contain serialized Python objects similar to pickle, making them a potential attack vector.

Suggested approach

  1. Create minimal test fixtures (benign and malicious `.pdmodel` files)
  2. Test detection of suspicious operations in PaddlePaddle models
  3. Test graceful handling of corrupted/invalid files
  4. Test scanner registration and priority in the registry

References

  • `modelaudit/scanners/paddle_scanner.py` — scanner implementation
  • `tests/scanners/` — existing scanner test patterns
  • `docs/agents/new-scanner-quickstart.md` — scanner development guide

Getting started

```bash
uv sync --extra all-ci
uv run pytest tests/scanners/ -v -k "paddle"
```

Acceptance criteria

  • At least 5 test cases covering benign, malicious, and edge cases
  • Tests create minimal fixtures (no large binary files committed)
  • All tests pass: `uv run pytest -n auto -m "not slow"`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions