Metadata-Version: 2.4
Name: cvewatch
Version: 0.1.0
Summary: Scan one project or a whole folder of projects for known and brand-new vulnerabilities, in an interactive terminal UI.
Project-URL: Homepage, https://github.com/bm2ilabs/cvewatch
Project-URL: Issues, https://github.com/bm2ilabs/cvewatch/issues
Author: bm2ilabs
License-Expression: MIT
License-File: LICENSE
Keywords: cve,dependencies,osv,sca,security,supply-chain,tui,vulnerability
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console :: Curses
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# cvewatch

**Know when today's CVE hits your code.** Run `cvewatch` in any folder: one project or a folder full of
projects. It finds every lockfile, checks each dependency against [OSV.dev](https://osv.dev), and matches
advisories published in the last few hours from a live CVE feed ([cve.now](https://cve.now)). Results open in
an interactive terminal UI.

- **Zero dependencies.** Pure Python standard library: nothing extra to install, nothing to trust except this repo.
- **One project or a hundred.** Point it at `~/code` and every subfolder is scanned as its own project.
- **New and known vulns.** *Latest* shows advisories published in the last days that hit you. *All* shows every known vuln, with severity and fix version.
- **Stays updated.** `cvewatch schedule install` rescans every 30 min and sends a desktop notification when something new appears.
- **CI ready.** Text, JSON, Markdown, HTML and SARIF (GitHub code scanning) output; `--fail-on high` sets the exit code.

## Install

```sh
pipx install cvewatch        # or: uv tool install cvewatch
# try without installing:
uvx cvewatch
```

From source (no install step at all):

```sh
git clone https://github.com/bm2ilabs/cvewatch && cd cvewatch
PYTHONPATH=src python3 -m cvewatch ~/code
```

Requires Python 3.9+. The terminal UI uses `curses` (built in on macOS/Linux). On Windows you get the text report.

## Use

```sh
cvewatch                         # interactive UI for the current folder
cvewatch ~/code                  # every project under ~/code
cvewatch --no-tui                # plain text summary
cvewatch --min-severity high     # hide moderate/low
cvewatch --format html -o report.html
cvewatch --format sarif -o cvewatch.sarif
cvewatch --fail-on high          # exit 1 if any high/critical finding (CI)
cvewatch --offline               # cached data only
cvewatch watch ~/code --every 30 # keep running, notify on new issues
cvewatch schedule install ~/code # same, via launchd (macOS) / systemd timer (Linux)
cvewatch schedule remove ~/code
```

### Terminal UI keys

| key | action |
|---|---|
| `1` `2` `3` / `tab` | Latest (live feed hits) · All vulnerabilities · Projects |
| `↑↓` `j k` `PgUp PgDn` `g G` | move |
| `enter` | details (on Projects: that project's vulns) |
| `/` | filter by text · `esc` clears |
| `s` | minimum severity · `x` fixable only · `n` new since last scan |
| `o` | open advisory · `e` export HTML · `r` rescan · `?` help · `q` quit |

## What it reads

| ecosystem | files |
|---|---|
| npm / bun / pnpm / yarn | `package-lock.json`, `npm-shrinkwrap.json`, `bun.lock`, `pnpm-lock.yaml`, `yarn.lock` (`package.json` if there is no lockfile) |
| PHP | `composer.lock` |
| Python | `requirements.txt`, `poetry.lock`, `uv.lock` |
| Go | `go.mod` |
| Rust | `Cargo.lock` |
| Ruby | `Gemfile.lock` |
| Dart / Flutter | `pubspec.lock` |
| WordPress | core version, plugins and themes in `wp-content` (matched against feed titles) |

`node_modules`, `vendor`, `.git`, build output and virtualenvs are skipped.

**Single or multi.** If the folder itself looks like a project (it has a manifest, `.git` or
`wp-content`), it is scanned as one project. Otherwise each subfolder is a project. Force a mode with
`--single` / `--multi`.

## How matching works

1. **Known vulnerabilities.** Each `package@version` is sent to OSV.dev's batch API. Severity comes from the
   advisory, or is computed from its CVSS vector. The fix version is the lowest patched release above yours.
2. **Brand-new advisories.** The live feed lists what was published in the last hours. Each item is looked up on
   OSV for exact package ranges. If OSV doesn't have it yet (it lags a few hours), the title is parsed instead
   (`SureCart <= 4.9.4`, `Foo before 2.1`, `Bar 1.0 - 2.3`) and matched by product name.
3. **Confidence.**
   - `confirmed`: your lockfile version is inside the affected range.
   - `likely`: the version came from a range in a manifest, or from a title match.
   - `possible`: name match only; check it yourself.

Results are cached in `~/.cache/cvewatch` (set `CVEWATCH_HOME` to change it), so repeat scans take seconds.

## Configuration

Optional `.cvewatch.json` in the scanned folder:

```json
{
  "exclude": ["old-prototype"],
  "ignore": ["GHSA-xxxx-xxxx-xxxx", "minimatch"],
  "feeds": ["https://cve.now/feed?format=json"]
}
```

`ignore` takes advisory IDs, aliases (CVE IDs) or package names. `feeds` takes any JSON Feed 1.1 URL.

## GitHub Actions

```yaml
name: cvewatch
on:
  schedule: [{ cron: "0 */6 * * *" }]   # new CVEs land all day; check often
  push:
    branches: [main]
permissions:
  contents: read
  security-events: write
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: bm2ilabs/cvewatch@v0.1.0   # pin to a commit SHA in production
        with:
          fail-on: high
      - uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
        if: always()
        with:
          sarif_file: cvewatch.sarif
```

## Privacy

Only package names and versions are sent to OSV.dev, and only the feed URL is fetched. No source code, file
paths or project names leave your machine.

## Development

```sh
python3 -m unittest discover -s tests -v
PYTHONPATH=src python3 -m cvewatch . --no-tui
```

Contributions welcome, especially new lockfile parsers and feed sources. Please keep the zero-dependency rule.

## License

MIT
