question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding `pip-audit` fails with pre-commit.ci due to `pip` support

See original GitHub issue

describe your issue

I added pip-audit to my pre-commit configuration for bandersnatch and the CI doesn’t like how it uses pip. Is there anyway we can tune the environment here or is this outside what pre-commit.ci offers? If so, should we document this and have users move back to running pre-commit in my own action/ci job?

  • This all runs fine locally and I would imagine would in my own GitHub action

PR with failing action added: https://github.com/pypa/bandersnatch/pull/1116 pre-commit.ci job: https://results.pre-commit.ci/run/github/133377409/1651359348.J_Nu59G_RqyOHsV2bHdyoQ

Sorry if this is the wrong place to log issues for the .ci offering. This just seemed the best place from my quick searching etc.

pre-commit --version

Latest? Don’t know …

.pre-commit-config.yaml

https://github.com/pypa/bandersnatch/blob/pre-commit-pip-audit/.pre-commit-config.yaml#L41-L45

  - repo: https://github.com/trailofbits/pip-audit
    rev: bafa0f8
    hooks:
      -   id: pip-audit
          args: ["-r", "requirements.txt"]

pip-audit config: https://github.com/trailofbits/pip-audit/blob/main/.pre-commit-hooks.yaml

~/.cache/pre-commit/pre-commit.log (if present)

In the cloud.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
woodruffwcommented, May 1, 2022

pre-commit will always run it from an isolated environment so it doesn’t really make sense at all

That makes sense for the preconfigured environment case. For users who have frozen/completely hashed environments, either pip-audit -r ... --require-hashes or pip-audit -r ... --no-deps (upcoming: https://github.com/trailofbits/pip-audit/pull/255) will be roughly as fast since they don’t involve any dependency resolution.

But either way I leave it to you; there’s no significant advantage AFAICT to having pip-audit as a commit hook versus a CI task.

0reactions
asottilecommented, May 1, 2022

pre-commit will always run it from an isolated environment so it doesn’t really make sense at all

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auditing your python environment - Kevin Tewouda - Medium
This article presents tools to scan your project dependencies to find known vulnerabilities.
Read more >
Adding auditing to pip - LWN.net
A tool to discover known security vulnerabilities in the Python packages installed on a system or required by a project, called pip-audit, ...
Read more >
pip-audit - PyPI
A tool for scanning Python environments for known vulnerabilities.
Read more >
pre-commit
Using pip: ... Once you have pre-commit installed, adding pre-commit plugins to your ... Each git repo can support as many languages/hooks as...
Read more >
Release notes — conda 22.11.1.post14+4f2f30268 ...
Add an informative message if explicit install fails due to requested packages ... conda env update would ask for user input and hang...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found