Skip to content
GitLab
Next
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 44,761
    • Issues 44,761
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,332
    • Merge requests 1,332
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLabGitLab
  • Issues
  • #299294
Closed
Open
Issue created Jan 20, 2021 by Fabien Catteau@fcatteau🔴Developer1 of 5 checklist items completed1/5 checklist items

Dependency Scanning of Pipfile.lock without installing project dependencies

Problem to solve

Dependency Scanning for Python (gemnasium-python) can scan pipenv projects and report vulnerabilities for the exact versions listed in Pipfile.lock. However, it requires to install the project dependencies, and this consumes resources (time and bandwidth), and might fail if the environment of the scanning job doesn't meet all the requirements of the installed packages (version of python and system libraries).

Proposal

Parse Pipfile.lock directly, without running pipenv graph to export the dependency graph.

As a side effect, it becomes possible to scan a Pipenv project that doesn't have a Pipfile.

Warning! Pipfile.lock only contains normalized package names, like django, and not canonical names, like Django. Parsing the lock file might result in inaccurate package names. That said, vulnerabilities are accurately reported, thanks to PEP 426 support implemented in #33341 (closed).

Further details

gemnasium-python runs pipenv graph --json to export the dependency graph as a JSON document. This JSON doc is similar to the one pipdeptree creates. pipenv graph installs the project dependencies, and this might fail if the installed packages require a specific version of Python, or specific system libraries.

What does success look like, and how can we measure that?

  • Less failing Dependency Scanning jobs for Python projects, more Python projects being scanned.
  • Less time spent scanning Pipenv project

Links / references

Implementation plan

  • Add Pipfile.lock parser to gemnasium #33227 (closed)
  • Enable Pipfile.lock parser in gemnasium-python, and make sure the pipenv builder is skipped when a lock file is provided
  • Add exists line to detection rule for Pipfile.lock in the Dependency Scanning template
  • Update user docs to mention support

Testing

This is testing using test branch https://gitlab.com/gitlab-org/security-products/tests/python-pipenv/-/commits/pipfile-lock-FREEZE and the corresponding QA job.

Product Management - @NicoleSchwartz

  • Release Post

cc @NicoleSchwartz @gonzoyumo @plafoucriere

Edited Feb 09, 2021 by Igor Frenkel
Assignee
Assign to
Time tracking