Skip to main content

Poetry plugin to check known vulnerabilities from poetry.lock

Project description

ko-poetry-audit-plugin

Code style: black formatter Imports: isort linting: pylint

To check known vulnerabilities from poetry.lock.

Inspired by pypa/pip-audit, this adds audit command tip poetry, for checking vulnerabilities of packages found in poetry.lock.

Vulnerability reports are sourced from Python Packaging Advisory Database (https://github.com/pypa/advisory-database) using JSON API.

Installation

Please follow poetry Using Plugins for installation.

% poetry self add ko-poetry-audit-plugin

To integrate with pre-commit, trigger scan whenever poetry.lock is commit:

  - repo: https://github.com/koyeung/ko-poetry-audit-plugin.git
    rev: 0.3.0
    hooks:
      - id: poetry-audit

Note by default, it scans for main and dev dependencies groups only.

Usage

To check for main group:

% poetry audit
No known vulnerabilities found

To include packages in dev group:

% poetry audit --with dev
Found vulnerabilities
Group    Name    Version    ID                   Withdrawn    Fix Versions    Link
-------  ------  ---------  -------------------  -----------  --------------  -------------------------------------------------
dev      py      1.11.0     GHSA-w596-4wvx-j9j6                               https://osv.dev/vulnerability/GHSA-w596-4wvx-j9j6
dev      py      1.11.0     PYSEC-2022-42969                                  https://osv.dev/vulnerability/PYSEC-2022-42969
% echo $?
1

To show more details:

% poetry audit --with dev -vv
[ko_poetry_audit_plugin.auditor] get packages list from dependencies groups={'main', 'dev'}
[ko_poetry_audit_plugin.pypi_warehouse] package.name='boto3', package.version='1.26.8': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='jmespath', package.version='1.0.1': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='botocore', package.version='1.29.8': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='six', package.version='1.16.0': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='python-dateutil', package.version='2.8.2': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='s3transfer', package.version='0.6.0': no vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='py', package.version='1.11.0': vulnerabilities found
[ko_poetry_audit_plugin.pypi_warehouse] package.name='urllib3', package.version='1.26.12': no vulnerabilities found
Found vulnerabilities
Group    Name    Version    ID                   Withdrawn    Fix Versions    Link
-------  ------  ---------  -------------------  -----------  --------------  -------------------------------------------------
dev      py      1.11.0     GHSA-w596-4wvx-j9j6                               https://osv.dev/vulnerability/GHSA-w596-4wvx-j9j6
dev      py      1.11.0     PYSEC-2022-42969                                  https://osv.dev/vulnerability/PYSEC-2022-42969

Exit codes

poetry audit exits with non-zero code, unless all vulnerabilities found have been withdrawn.

Note only packages found on pypi could be checked.

Licensing

poetry audit plugin is licensed under the Apache 2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ko_poetry_audit_plugin-0.6.0a2.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ko_poetry_audit_plugin-0.6.0a2-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file ko_poetry_audit_plugin-0.6.0a2.tar.gz.

File metadata

  • Download URL: ko_poetry_audit_plugin-0.6.0a2.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for ko_poetry_audit_plugin-0.6.0a2.tar.gz
Algorithm Hash digest
SHA256 0c645fca8f85287a82ecda25fc65d107134725d9f49d7bace2d2cf56d4673009
MD5 d7913a205ead5b1b517a675c74021e8b
BLAKE2b-256 1dbc6eb8fc2da26e0d9b4bfe6565a1cb9091404e78d0e273a6d00931771c2eb3

See more details on using hashes here.

File details

Details for the file ko_poetry_audit_plugin-0.6.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for ko_poetry_audit_plugin-0.6.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 80c0e819f5f5041ba2db3b496a9bdc9d4dfac858aa852cd8124ccab5e3c30ac9
MD5 dae4200f84897831e94a5a63aab9014a
BLAKE2b-256 41bdcd4f2e3afc8854f57e05a67dda04b57e215ebed37ca7d09123d9d6ecbffc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page