Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add precommit support #6

Merged
merged 4 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- id: uv-secure
name: uv-secure
description: "Run 'uv-secure' to check uv.lock dependencies for known vulnerabilities"
entry: uv-secure
language: python
pass_filenames: false
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

Scan your uv.lock file for dependencies with known vulnerabilities

## Installation

I recommend installing uv-secure as a uv tool or with pipx as it's intended to be used
as a CLI tool and it probably only makes sense to have one version installed globally.

Installing with uv tool as follows:

```shell
uv tool install uv-secure
```

or with pipx:

```shell
pipx install uv-secure
```

you can optionally install uv-secure as a development dependency in a virtual
environment.

## Usage

After installation you can run uv-secure --help to see the options.
Expand Down Expand Up @@ -31,11 +51,11 @@ working directory and scan that for known vulnerabilities. E.g.
```text
>> uv-secure
Checking dependencies for vulnerabilities...
╭──────────────────────────────────
│ No vulnerabilities detected!
│ Checked: 160 dependencies
│ All dependencies appear safe! 🎉
╰──────────────────────────────────
╭───────────────────────────────╮
│ No vulnerabilities detected! │
│ Checked: 160 dependencies │
│ All dependencies appear safe! │
╰───────────────────────────────╯
```

## Related Work and Motivation
Expand Down
2 changes: 1 addition & 1 deletion src/uv_secure/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def check_dependencies(uv_lock_path: Path, ignore_ids: list[str]) -> int:
Panel.fit(
f"[bold green]No vulnerabilities detected![/]\n"
f"Checked: [bold]{total_dependencies}[/] {total_plural}\n"
f"All dependencies appear safe! 🎉"
f"All dependencies appear safe!"
)
)
return 0 # Exit successfully
Expand Down
Loading