Skip to content

PRP: Extractor for Pipfile dependencies #2205

Description

@Abhinav-143x

Gap confirmation

SCALIBR currently supports Pipfile.lock through python/pipfilelock, but does not appear to register an inventory extractor for plain Pipfile.

This leaves a source-manifest gap for Python projects where a Pipfile is present but a Pipfile.lock is absent, unavailable, stale, or intentionally omitted from the scanned artifact.

This proposal is for source inventory extraction only. It does not replace python/pipfilelock, which remains the better source for resolved dependency inventory when available.

Rationale

Pipenv already uses Pipfile as the source manifest for declaring project dependencies. SCALIBR already supports several Python inventory sources, including requirements.txt, setup.py, Pipfile.lock, pdm.lock, poetry.lock, uv.lock, Conda metadata, and installed wheel/egg metadata.

A Pipfile extractor would cover the source manifest case where dependency names and constraints are present in a structured TOML file, but no resolved lockfile is available to scan.

There is also prior project precedent for this being a distinct inventory artifact: PR #189 renamed the existing lockfile extractor to python/pipfilelock because a future plain python/Pipfile extractor may be useful. Later PRs #1407 and #1478 added Pipfile support to guided remediation, but not filesystem inventory extraction.

Proposed scope

  • Match only files whose basename is exactly Pipfile.
  • Parse only TOML dependency sections:
    • [packages]
    • [dev-packages]
  • Emit PyPI package inventory for entries where a package name is explicit.
  • Support simple string specs, for example:
    • requests = "*"
    • flask = "==2.0.1"
    • numpy = ">=1.20.0,<2.0.0"
  • Support table entries when a version field is present, for example:
    • django = { version = ">=3.2" }
    • sentry-sdk = { version = ">=1.0.0", extras = ["flask"] }
  • Preserve version/comparator metadata only for exact pins and simple single-comparator constraints.
  • For wildcard or compound constraints such as numpy = ">=1.20.0,<2.0.0", emit package identity only without a concrete version, because the source manifest does not identify an installed version.
  • Record file and line locations for emitted packages.
  • Skip invalid, empty, or unsupported entries.

Out of scope

  • Pipfile.lock
  • Dependency resolution
  • Lockfile generation
  • Installing packages
  • Reading package indexes
  • Evaluating environment markers
  • Resolving extras into dependency graphs
  • Custom Pipenv package categories beyond [packages] and [dev-packages]
  • Local path dependencies
  • VCS dependencies
  • Remote file dependencies
  • Editable installs
  • Private index/source resolution

Suggested plugin name

python/pipfile

PURL output format

pkg:pypi/{package}@{version}

Examples:

pkg:pypi/flask@2.0.1
pkg:pypi/requests
pkg:pypi/numpy

Metadata

Metadata

Assignees

Labels

PRPPatch Reward Program: This label is added to all PRP related issues for easy filteringPRP:AcceptedPatch Reward Program: This issue has been accepted as a PRP entry.PRP:RequestPatch Reward Program: This issue is a PRP contribution request and is being reviewed by the panel.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions