Metadata-Version: 2.5
Name: bearscan
Version: 0.1.1
Summary: Defensive AppSec scanner for code and staging environments you own, mapped to OWASP Top 10 2025 and triaged by an LLM.
Project-URL: Homepage, https://github.com/cristhianzl/bearscan
Project-URL: Documentation, https://github.com/cristhianzl/bearscan/tree/main/docs
Project-URL: Repository, https://github.com/cristhianzl/bearscan
Project-URL: Issues, https://github.com/cristhianzl/bearscan/issues
Project-URL: Changelog, https://github.com/cristhianzl/bearscan/blob/main/CHANGELOG.md
Author: Cristhian Zanforlin Lousa
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: appsec,claude-code,devsecops,kali-linux,llm,owasp,sast,secret-scanning,security
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.12
Requires-Dist: httpx>=0.27
Requires-Dist: platformdirs>=4.2
Requires-Dist: pydantic>=2.7
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/cristhianzl/bearscan/main/docs/assets/banner.jpg" alt="bearscan" width="640">
</p>

<p align="center">
  <strong>Defensive AppSec scanner for the code and staging environments you own.</strong><br>
  Secrets, insecure code, vulnerable dependencies, and TLS, mapped to OWASP Top 10 2025 and triaged by an LLM.
</p>

<p align="center">
  <a href="https://github.com/cristhianzl/bearscan/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/cristhianzl/bearscan/ci.yml?branch=main&label=CI"></a>
  <a href="https://pypi.org/project/bearscan/"><img alt="PyPI" src="https://img.shields.io/pypi/v/bearscan"></a>
  <img alt="Python 3.12 | 3.13 | 3.14" src="https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-3776AB">
  <img alt="OWASP Top 10 2025" src="https://img.shields.io/badge/OWASP%20Top%2010-2025-1f6feb">
  <a href="https://github.com/cristhianzl/bearscan/blob/main/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/github/license/cristhianzl/bearscan"></a>
</p>

<p align="center">
  <a href="#quick-start">Quick start</a> ·
  <a href="https://github.com/cristhianzl/bearscan/blob/main/docs/README.md">Documentation</a> ·
  <a href="https://github.com/cristhianzl/bearscan/blob/main/docs/kali-linux.md">Kali Linux guide</a> ·
  <a href="https://github.com/cristhianzl/bearscan/blob/main/CHANGELOG.md">Changelog</a>
</p>

---

bearscan audits a repository or a staging URL with one command. It runs its own rules, drives the
open-source security tools already installed on your machine, merges everything into one report with CWE
and OWASP Top 10 2025 labels, and asks an LLM to separate real problems from noise. The reviewer runs on
your existing **Claude Code** or **Codex** login, or fully locally with **Ollama**.

<p align="center">
  <img src="https://raw.githubusercontent.com/cristhianzl/bearscan/main/docs/assets/demo-scan-path.svg" alt="bearscan terminal report: summary panel, findings table with LLM verdicts, and detail panels for a leaked AWS key and a Stripe key in git history" width="900">
</p>

<p align="center"><sub>Real output: a demo repository scanned on Kali Linux with all four code tools installed, triaged by Claude Code.</sub></p>

## Highlights

- **Secrets, now and in history.** 15 secret detectors with masking everywhere, plus
  [gitleaks and trufflehog](https://github.com/cristhianzl/bearscan/blob/main/docs/external-tools.md#tools-for---path) to find keys in commits you deleted
  long ago. A key found by several tools is reported once.
- **Code weaknesses mapped to standards.** [37 built-in rules](https://github.com/cristhianzl/bearscan/blob/main/docs/rules.md) for secrets,
  JavaScript/TypeScript, and Python, plus semgrep's security rulesets, all labeled with CWE and
  [OWASP Top 10 2025](https://github.com/cristhianzl/bearscan/blob/main/docs/rules.md#owasp-top-10-2025-coverage).
- **Vulnerable dependencies.** osv-scanner checks your lockfiles and names the version that fixes each
  advisory.
- **Staging checks.** `--url` runs testssl.sh (or sslscan) and whatweb for protocols, ciphers,
  certificates, HSTS, and version disclosure.
- **Triage, not noise.** An [LLM reviewer](https://github.com/cristhianzl/bearscan/blob/main/docs/llm-triage.md) labels each finding *likely real*,
  *false positive*, or *uncertain*, with a confidence, a rationale, and a fix. It can never change a
  severity or hide a finding from the JSON.
- **Adapts to your machine.** Every supported tool found on `PATH` is used automatically; missing ones are
  listed with their install command. On [Kali Linux](https://github.com/cristhianzl/bearscan/blob/main/docs/kali-linux.md), nearly all of them are one
  `apt install` away.
- **Private by design.** Secrets are masked before anything is printed, saved, or sent, and you can see
  [exactly what leaves your machine](https://github.com/cristhianzl/bearscan/blob/main/docs/security-model.md#what-leaves-your-machine).

## Quick start

1. **Install** bearscan (Python 3.12+):

   ```bash
   pipx install bearscan
   ```

2. **Scan** a repository. Without a reviewer installed, add `--no-review`:

   ```bash
   bearscan scan --path ./my-repo
   ```

3. **Go further:** install the [external tools](https://github.com/cristhianzl/bearscan/blob/main/docs/installation.md#add-external-tools) for history,
   semgrep, and dependency checks, and point `--url` at a staging environment you own:

   ```bash
   bearscan scan --url https://staging.example.com
   ```

## Installation

```bash
pipx install bearscan
# or
uv tool install bearscan
```

On Kali Linux, add the packaged external tools in one go:

```bash
sudo apt install -y pipx git gitleaks trufflehog testssl.sh sslscan whatweb
pipx install semgrep
```

osv-scanner, macOS with Homebrew, installing from source, reviewers, and upgrades are covered in the
[installation guide](https://github.com/cristhianzl/bearscan/blob/main/docs/installation.md).

## Usage

```bash
bearscan scan --path ./my-repo                     # scan and triage with Claude Code
bearscan scan --path ./my-repo --llm codex         # triage with Codex
bearscan scan --path ./my-repo --llm ollama        # triage with a local model
bearscan scan --path ./my-repo --no-review         # deterministic checks only
bearscan scan --path ./my-repo --json > run.json   # machine-readable output
bearscan scan --url https://staging.example.com    # TLS, certificate, and server checks
```

| Option | Description |
|---|---|
| `--path DIR` / `--url URL` | What to scan. Pass exactly one. |
| `--review / --no-review` | Triage findings with an LLM (default: on). |
| `--llm` | `claude-code` (default), `codex`, `ollama`, or `litellm`. |
| `--model`, `--llm-base-url` | Model and endpoint for the reviewer. |
| `--max-review N` | Most findings sent to the reviewer (default: 60). |
| `--json` | Print the run as JSON instead of the report. |

Every option, environment variable, and exit code is in the [usage guide](https://github.com/cristhianzl/bearscan/blob/main/docs/usage.md).

## How it works

1. **Collect** the files git tracks (or walk the tree outside git), skipping binaries, lockfiles, and
   anything in `.gitignore`.
2. **Detect** with the built-in rules and every installed tool, then normalize each result to one severity
   scale with CWE and OWASP Top 10 2025 labels.
3. **Merge** duplicates: one finding per secret, and no semgrep repeats of built-in findings.
4. **Review** the findings that have code context with the LLM backend you chose.
5. **Report** in the terminal or as JSON, and save the run privately.

Deterministic checks decide what a finding is and how severe it is; the reviewer only adds a verdict and a
fix. See the [architecture](https://github.com/cristhianzl/bearscan/blob/main/docs/architecture.md) for the details.

### External tools

| Tool | Target | Adds |
|---|---|---|
| [gitleaks](https://github.com/gitleaks/gitleaks) | `--path` | Secrets anywhere in git history |
| [trufflehog](https://github.com/trufflesecurity/trufflehog) | `--path` | Hundreds of extra secret detectors over git history |
| [semgrep](https://github.com/semgrep/semgrep) | `--path` | AST-based analysis with the `p/default` and `p/owasp-top-ten` rulesets |
| [osv-scanner](https://github.com/google/osv-scanner) | `--path` | Known CVEs in lockfiles and manifests |
| [testssl.sh](https://github.com/testssl/testssl.sh) | `--url` | Protocols, ciphers, certificates, TLS vulnerabilities, HSTS |
| [sslscan](https://github.com/rbsec/sslscan) | `--url` | Fast TLS fallback when testssl.sh is unavailable |
| [whatweb](https://github.com/urbanadventurer/WhatWeb) | `--url` | Server and framework version disclosure |

### LLM reviewers

| `--llm` | Runs on | How bearscan calls it |
|---|---|---|
| `claude-code` | your Claude Code login | Headless, no tools, restricted mode, empty working directory |
| `codex` | your Codex login | `codex exec` in a read-only sandbox, shell and web search off |
| `ollama` | your machine | Local API with a JSON schema, temperature 0 |
| `litellm` | any OpenAI-compatible endpoint | Chat completions with a JSON schema |

Only the flagged line and two lines of context on each side are sent, with secrets masked and repository
text fenced as untrusted data. Details in [LLM triage](https://github.com/cristhianzl/bearscan/blob/main/docs/llm-triage.md).

## Privacy and security

- The built-in scan sends nothing anywhere; `--no-review` with no tools installed is fully offline.
- trufflehog never verifies secrets with their providers; semgrep runs with metrics off and never uploads
  code; osv-scanner sends only package names and versions.
- Saved runs are written with `0600` permissions, because they map your weaknesses.

The full picture is in the [security model](https://github.com/cristhianzl/bearscan/blob/main/docs/security-model.md).

## Documentation

[Installation](https://github.com/cristhianzl/bearscan/blob/main/docs/installation.md) · [Kali Linux](https://github.com/cristhianzl/bearscan/blob/main/docs/kali-linux.md) · [Usage](https://github.com/cristhianzl/bearscan/blob/main/docs/usage.md) ·
[LLM triage](https://github.com/cristhianzl/bearscan/blob/main/docs/llm-triage.md) · [External tools](https://github.com/cristhianzl/bearscan/blob/main/docs/external-tools.md) · [Rules](https://github.com/cristhianzl/bearscan/blob/main/docs/rules.md) ·
[Output format](https://github.com/cristhianzl/bearscan/blob/main/docs/output-format.md) · [Security model](https://github.com/cristhianzl/bearscan/blob/main/docs/security-model.md) ·
[Architecture](https://github.com/cristhianzl/bearscan/blob/main/docs/architecture.md) · [Troubleshooting](https://github.com/cristhianzl/bearscan/blob/main/docs/troubleshooting.md)

## Roadmap

- Built-in `--url` checks with Playwright: CSP, CORS, cookie flags, and data exposure in API responses
- `--fail-on <severity>` exit codes and SARIF output for CI pipelines
- `bearscan report --pdf` for an executive summary and `bearscan report --web` for a local dashboard
- A pre-commit hook and a GitHub Action

Ideas and votes are welcome in [issues](https://github.com/cristhianzl/bearscan/issues).

## Contributing

Contributions are welcome, from rule reports to new tool adapters. Read [CONTRIBUTING.md](https://github.com/cristhianzl/bearscan/blob/main/CONTRIBUTING.md)
to set up the project, and follow the [Code of Conduct](https://github.com/cristhianzl/bearscan/blob/main/CODE_OF_CONDUCT.md).

## Security

Found a vulnerability in bearscan itself? Please report it privately as described in
[SECURITY.md](https://github.com/cristhianzl/bearscan/blob/main/SECURITY.md).

## Responsible use

bearscan is a defensive tool. Scan only code and systems you own or are explicitly authorized to test.

## Acknowledgements

bearscan stands on the shoulders of the tools it drives: gitleaks, trufflehog, semgrep, osv-scanner,
testssl.sh, sslscan, and whatweb. Its terminal output is built with [Rich](https://github.com/Textualize/rich)
and [Typer](https://github.com/fastapi/typer), and its reviewer design borrows ideas from open-source AI
security agents such as Strix, Shannon, and PentAGI.

## License

Licensed under the [Apache License 2.0](https://github.com/cristhianzl/bearscan/blob/main/LICENSE).
