Metadata-Version: 2.4
Name: vulnlens
Version: 0.3.1
Summary: Security scanner that sorts code, dependency and secret findings into Act now / Review / Context, using CISA KEV, EPSS and CVSS.
Author: Harish Akshay H
License-Expression: MIT
Project-URL: Homepage, https://harishakshay.github.io/open-source-vulnerability-scanner/
Project-URL: Source, https://github.com/harishakshay/open-source-vulnerability-scanner
Project-URL: Issues, https://github.com/harishakshay/open-source-vulnerability-scanner/issues
Project-URL: Changelog, https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/CHANGELOG.md
Keywords: security,sast,sca,cve,epss,kev,sarif,secrets,vulnerability-scanner,devsecops
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: ai
Requires-Dist: anthropic>=1.0; extra == "ai"
Provides-Extra: semgrep
Requires-Dist: semgrep>=1.100; extra == "semgrep"
Provides-Extra: all
Requires-Dist: anthropic>=1.0; extra == "all"
Requires-Dist: semgrep>=1.100; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Dynamic: license-file

# VulnLens

[![CI](https://github.com/harishakshay/open-source-vulnerability-scanner/actions/workflows/ci.yml/badge.svg)](https://github.com/harishakshay/open-source-vulnerability-scanner/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/vulnlens)](https://pypi.org/project/vulnlens/)
![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/LICENSE)

**A security scanner that tells you which findings actually matter.**

[Live demo](https://harishakshay.github.io/open-source-vulnerability-scanner/) · [PyPI](https://pypi.org/project/vulnlens/) · [GitHub Marketplace](https://github.com/marketplace/actions/vulnlens)

VulnLens scans your code (Semgrep), dependencies (OSV.dev) and secrets (TruffleHog), then ranks
every finding by evidence that attackers are using it:

- **CISA KEV**: is this CVE being exploited in the wild right now?
- **EPSS**: how likely is exploitation in the next 30 days?
- **CVSS**: how bad is it if it happens?
- **Secret verification**: does the leaked key still work?

Each finding goes into one of three tiers:

| Tier | What goes there |
|---|---|
| **Act now** | A CVE in CISA KEV or with high EPSS in a runtime dependency, a live secret, or a flaw confirmed by AI triage |
| **Review** | A signal in shipped code that needs a person to judge it |
| **Context** | The same signals in tests, examples, docs, vendored code or dev dependencies |

## Quickstart

```bash
pip install "vulnlens[semgrep]"
vulnlens doctor                     # checks the engines and shows how to install anything missing
vulnlens scan .
vulnlens scan . --html report.html  # interactive report in one offline file
```

TruffleHog is a separate binary; `vulnlens doctor` tells you which release file to download.

![VulnLens dashboard for OWASP PyGoat](https://raw.githubusercontent.com/harishakshay/open-source-vulnerability-scanner/main/docs/images/overview-dark.png)

<sub>A scan of [OWASP PyGoat](https://github.com/adeyosemanputra/pygoat), an intentionally vulnerable app:
273 findings, 11 to act on now, with the actively exploited Pillow CVE ranked first.
More screenshots: [light mode](https://raw.githubusercontent.com/harishakshay/open-source-vulnerability-scanner/main/docs/images/overview.png) ·
[findings](https://raw.githubusercontent.com/harishakshay/open-source-vulnerability-scanner/main/docs/images/findings.png) ·
[upgrade plan](https://raw.githubusercontent.com/harishakshay/open-source-vulnerability-scanner/main/docs/images/upgrade-plan.png)</sub>

```
$ vulnlens scan https://github.com/adeyosemanputra/pygoat

  Grade:  F    273 findings
  Act now: 11   Review: 242   Context: 20
  1 actively exploited (CISA KEV)

  Upgrade plan: 21 upgrade(s) resolve 186 dependency finding(s)
    P0 Pillow 9.4.0 -> 12.3.0  (19 vuln(s))  KEV  requirements.txt
    P1 Django 4.2 -> 5.2.17  (51 vuln(s))  requirements.txt

  Act now (11)
   1. P0 Pillow 9.4.0: libwebp: OOB write in BuildHuffmanTable
      requirements.txt:19  [osv: GHSA-j7hp-h8jx-5ppr]
      - In CISA KEV: actively exploited in the wild (listed 2023-09-13)
      - EPSS: 99.98% chance of exploitation in the next 30 days
      - CVSS 8.8 (high)
      - Fix: upgrade Pillow to 10.0.1 or later
```

## GitHub Action

```yaml
# .github/workflows/vulnlens.yml
name: VulnLens
on:
  push:
    branches: [main]
  pull_request:
permissions:
  contents: read
  security-events: write   # upload results to Security → Code scanning
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: harishakshay/open-source-vulnerability-scanner@v0
        with:
          fail-on: act     # fail on Act-now findings; `review` is stricter
```

The Action installs VulnLens, Semgrep and TruffleHog (checksum-verified), runs the scan, writes a
job summary and uploads SARIF. In **Security → Code scanning**, Act-now findings show as errors,
Review as warnings and Context as notes.

| Input | Default | |
|---|---|---|
| `path` | `.` | directory to scan |
| `fail-on` | never | `act`, `review`, or a priority `P0`-`P4` |
| `engines` | `code,deps,secrets` | |
| `baseline` | | an earlier JSON report; only new findings count |
| `upload-sarif` | `true` | needs `security-events: write` |
| `semgrep-config` | `p/default` | |

Outputs: `act`, `review`, `context`, `grade`, `sarif-file`. Use `@v0` for the latest 0.x release or
`@v0.3.1` to pin one.

## How findings are ranked

| Priority | Meaning | Rule |
|---|---|---|
| **P0** | Fix now | CVE in CISA KEV, or a verified live secret |
| **P1** | Fix this sprint | EPSS ≥ 10%, CVSS ≥ 9.0, or a high-severity code flaw that is high-confidence or flagged by two rule families |
| **P2** | Plan a fix | High severity, or EPSS ≥ 1% |
| **P3** | Low | Medium severity, or an unverified secret |
| **P4** | Informational | Everything else |

Findings in tests, examples, docs, vendored code and dev dependencies are capped at P3. Every finding
lists the reasons for its priority. The same CVE under different IDs (GHSA, PYSEC, CVE) is reported
once, and so is a package pinned in several lockfiles. The upgrade plan picks the smallest version
that fixes everything found for each package.

The rules are in [`vulnlens/priority.py`](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/vulnlens/priority.py).

## AI triage (optional)

```bash
pip install "vulnlens[ai]"
export ANTHROPIC_API_KEY=...
vulnlens scan . --ai-dry-run     # shows the estimated cost, sends nothing
vulnlens scan . --ai-triage
```

Claude (Haiku by default) reads each code finding with the surrounding code and answers: real, false
positive or needs review, with a reason and a suggested fix. Confirmed findings move up; confident
false positives drop to P3, never lower. Code is redacted before it is sent and secret findings are
never sent. Verdicts are cached, and triage stops if the estimate is above `--ai-max-cost` ($2 by
default).

On a [54-finding labeled benchmark](https://github.com/harishakshay/open-source-vulnerability-scanner/tree/main/evals/triage), it removed 61% of the false positives and dismissed
none of the 26 real issues, for $0.035.

## Usage

```bash
vulnlens scan https://github.com/owner/repo         # scan a public repo
vulnlens scan . --sarif results.sarif --json report.json
vulnlens scan . --fail-on act                       # exit 1 on Act-now findings
vulnlens scan . --baseline main.json --fail-on act  # only fail on new findings
vulnlens scan . --engines deps                      # dependencies only
vulnlens scan . --exclude 'tests/**'
vulnlens serve                                      # local dashboard at http://localhost:8765
vulnlens html a.json b.json -o report.html          # combine saved reports into one page
```

**Silencing findings:** add path globs, `rule:`, `id:` or `fingerprint:` lines (with an optional
`# reason`) to a `.vulnlensignore` file, or put `vulnlens: ignore` on the flagged line. Suppressed
findings are listed in the JSON report. When you scan someone else's repository, its own ignore rules
are not applied.

**Exit codes:** `0` ok, `1` findings at or above `--fail-on`, `2` scan error. With `--fail-on`, an
engine that didn't run is also an error, so CI never passes on a partial scan.

**Supported dependency files:** `requirements*.txt`, `Pipfile.lock`, `poetry.lock`, `uv.lock`,
`pyproject.toml`, `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock`, `pnpm-lock.yaml`, `go.mod`,
`Cargo.lock`, `composer.lock`, `Gemfile.lock`.

## Limitations

- A dependency finding means a vulnerable version is installed, not that your code calls the
  vulnerable function.
- Java (`pom.xml`, Gradle), `bun.lock` and dependencies without an exact version aren't checked yet;
  reports list them under "Not checked".
- Semgrep registry rules change over time, so results for the same commit can drift slightly.

## More

- [Architecture](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/docs/ARCHITECTURE.md): how every module works
- [Study of 50 AI apps](https://github.com/harishakshay/open-source-vulnerability-scanner/tree/main/studies/ai-apps-2026): 10,114 findings, 34 to act on now
- [AI triage benchmark](https://github.com/harishakshay/open-source-vulnerability-scanner/tree/main/evals/triage)
- [Contributing](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/CONTRIBUTING.md) · [Security policy](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/SECURITY.md) · [Changelog](https://github.com/harishakshay/open-source-vulnerability-scanner/blob/main/CHANGELOG.md)

```bash
pip install -e ".[dev]" && pytest   # development setup
```

MIT License.
