Skip to content

test: improve test coverage for archive scanners (tar, zip, 7z) #537

@mldangelo

Description

@mldangelo

Description

Improve test coverage for the archive scanner family: tar_scanner, zip_scanner, and sevenzip_scanner. These scanners handle nested model files inside archives and need thorough edge case testing.

Suggested test cases

  • Archives containing multiple model files of different formats
  • Deeply nested archives (archive within archive)
  • Archives with symbolic links (security-relevant)
  • Archives with path traversal attempts (e.g., ../../etc/passwd)
  • Empty archives
  • Corrupted/truncated archives
  • Archives with very long filenames

References

  • modelaudit/scanners/tar_scanner.py
  • modelaudit/scanners/zip_scanner.py
  • modelaudit/scanners/sevenzip_scanner.py
  • tests/scanners/test_tar_scanner.py — existing tests to extend
  • tests/scanners/test_zip_scanner.py — existing tests to extend
  • docs/agents/testing.md — test patterns guide

Getting started

uv sync --extra all-ci
uv run pytest tests/scanners/test_tar_scanner.py tests/scanners/test_zip_scanner.py -v

Acceptance criteria

  • At least 3 new test cases per scanner
  • Tests cover at least one security-relevant edge case
  • 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