Skip to content

[BUG] cyclonedx-py pipenv leaves a leading = in component version and PURL for === pins in Pipfile.lock #1153

Done

Description

@trackoor

Describe the bug

When Pipfile.lock contains a PEP 440 arbitrary-equality pin ("version": "===0.4.6"), cyclonedx-py pipenv strips only the first two characters and emits "version": "=0.4.6" and "purl": "pkg:pypi/colorama@%3D0.4.6". By contrast, cyclonedx-py requirements parses colorama===0.4.6 as version "0.4.6" and PURL "pkg:pypi/[email protected]".

pipenv lock writes "version": "===..." into Pipfile.lock when a Pipfile entry pinned with === has an environment marker that does not match the locking host (for example locking a cross-platform Pipfile on Linux with a sys_platform == 'win32' dependency).

To Reproduce

On a non-Windows machine with pipenv and cyclonedx-bom installed:

mkdir repro && cd repro
cat > Pipfile <<'EOF'
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
colorama = {version = "===0.4.6", markers = "sys_platform == 'win32'"}
EOF

pipenv lock
cyclonedx-py pipenv .

pipenv lock generates a Pipfile.lock entry with "version": "===0.4.6".

Expected behavior

cyclonedx-py pipenv should emit "version": "0.4.6" and "purl": "pkg:pypi/[email protected]", matching cyclonedx-py requirements.

Screenshots or output-paste

    {
      "bom-ref": "colorama===0.4.6",
      "externalReferences": [
        {
          "comment": "from implicit index: pypi",
          "hashes": [
            {
              "alg": "SHA-256",
              "content": "08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"
            },
            {
              "alg": "SHA-256",
              "content": "4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"
            }
          ],
          "type": "distribution",
          "url": "https://pypi.org/simple/colorama/"
        }
      ],
      "name": "colorama",
      "properties": [
        {
          "name": "cdx:pipenv:category",
          "value": "default"
        }
      ],
      "purl": "pkg:pypi/colorama@%3D0.4.6",
      "type": "library",
      "version": "=0.4.6"
    }

Environment

  • cyclonedx-py version: 9.0.0 (also reproduced on main commit 087a93338905b6c3b4169cb8c35721b442c23ae4, with pipenv 2026.11.0)
  • Python version: Python 3.11.2
  • OS: Debian GNU/Linux 12

Additional context

In cyclonedx_py/_internal/pipenv.py, _make_bom computes version=package_data['version'][2:], which assumes every locked version prefix is two characters (==) rather than three (===).

Contribution

  • I am willing to provide a fix
  • I will wait until somebody else fixes it

Credit: https://ucsbplse.github.io/

Activity

  1. pinsara23 commented on Nov 26, 2026

    @pinsara23
    Contributor

    Hi, I'd like to work on this. My plan: replace the [2:] slice in _make_bom (cyclonedx_py/_internal/pipenv.py) so it strips the full ==/=== prefix, and add a pipenv test fixture with an arbitrary equality pin plus updated snapshots. I'll open a PR within the next few days. Could this be assigned to me?

  2. added
    bug
    good first issue
    on Nov 26, 2026
  3. jkowalleck commented on Nov 26, 2026

    @jkowalleck
    Member

    Hi, I'd like to work on this. My plan: replace the [2:] slice in _make_bom (cyclonedx_py/_internal/pipenv.py) so it strips the full ==/=== prefix, and add a pipenv test fixture with an arbitrary equality pin plus updated snapshots. I'll open a PR within the next few days. Could this be assigned to me?

    there is a PR already

    feal free to collaborate with the respective PR author.

  4. pinsara23 commented on Nov 26, 2026

    @pinsara23
    Contributor

    Thanks! I'll leave this to #1156 and look at #1152 instead.

  5. jkowalleck commented on Nov 30, 2026

    @jkowalleck
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuesource: pipenv

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions