Skip to content

Add a pip audit command/task #18115

@tonybaloney

Description

@tonybaloney

I'm looking for a solution to automatically scan the packages in my selected interpreter for a workspace and raise warning/log messages on the UI when there are security vulnerabilities.

pip-audit is a tool for scanning Python environments for packages
with known vulnerabilities. It uses the Python Packaging Advisory Database
(https://github.com/pypa/advisory-db) via the
PyPI JSON API as a source
of vulnerability reports.

So far, the best I can come up with is a task to run pip-audit on project, but this has to be configured per-project, there is no way I can find to have this for all projects with a configured interpreter.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Pip Audit",
            "type": "shell",
            "command": "${command:python.interpreterPath}",
            "args": ["-m", "pip_audit"],
            "isBackground": true,
            "group": "none",
            "runOptions": {
                "runOn": "folderOpen",
            },
        },
    ]
}

This required a module-entry point for pip-audit, which is implemented but unreleased.

This feature doesn't really fit into the linters integrations, as its not specific to the current file.

Expectations:

  1. I can run an audit task on demand via the command pallette
  2. Task is run on project open
  3. The audit task uses the currently-installed packages in the selected interpreter and reports against the vulnerability database
  4. Use of pip-audit not required, if other solutions are available

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-editor-*User-facing catch-allcommunity askFeature request that the community expressed interest infeature-requestRequest for new features or functionalityneeds proposalNeed to make some design decisions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions