Metadata-Version: 2.4
Name: haris
Version: 0.8.0
Summary: Black-box web application security audit framework
Author: HARIS contributors
License: MIT
Keywords: security,audit,pentest,owasp,vulnerability-scanner
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Requires-Python: >=3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.14.3
Requires-Dist: requests>=2.34.2
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: jinja2>=3.1.6
Requires-Dist: bcrypt>=5.0.0
Requires-Dist: starlette>=1.10.0
Requires-Dist: yoyo-migrations>=9.0.0
Provides-Extra: web
Requires-Dist: fastapi>=0.162.2; extra == "web"
Requires-Dist: uvicorn[standard]>=0.54.0; extra == "web"
Requires-Dist: python-multipart>=0.0.33; extra == "web"
Requires-Dist: authlib>=1.9.5; extra == "web"
Requires-Dist: httpx>=0.28.1; extra == "web"
Requires-Dist: itsdangerous>=2.2.0; extra == "web"
Requires-Dist: dnspython>=2.8.0; extra == "web"
Provides-Extra: reporting
Requires-Dist: markdown>=3.11.3; extra == "reporting"
Provides-Extra: llm
Requires-Dist: litellm==1.108.0; extra == "llm"
Provides-Extra: all
Requires-Dist: haris[llm,reporting,web]; extra == "all"
Dynamic: license-file

<p align="center">
  <img src="assets/haris_logo.png" alt="HARIS" width="400"><br>
  <em>Black-box web security audit framework. Scan, correlate, prioritise, remediate.</em><br><br>
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a> <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.13+-blue.svg" alt="Python"></a> <a href="https://owasp.org/www-project-top-ten/"><img src="https://img.shields.io/badge/OWASP-Top%2010%202025-red.svg" alt="OWASP"></a>
</p>

> Scan only systems you are authorised to test. See [LEGAL_NOTICE.md](LEGAL_NOTICE.md).

Orchestrates security scanners, correlates findings, and writes one prioritised report. LLM analysis is optional.

- **Correlation.** Findings that share a fingerprint become one finding. The score combines the scanners that reported it.
- **Cross-scanner context.** Built-in checks and nmap fill a `ScanContext`. Later scanners read it. Nuclei derives its tag group from detected technologies.
- **Business risk and remediation.** Plain-language impact sits next to the technical finding. Fixes are grouped and ordered by impact and effort.
- **OWASP Top 10 (2025).** Findings are mapped, including Software Supply Chain Failures and Mishandling of Exceptional Conditions.
- **Verification.** Replay oracles, an optional LLM verdict, and an opt-in agent. A refuted finding stays in the report. See [`docs/verification.md`](docs/verification.md).
- **Profiles, templates, LLM.** Six profiles. Scan templates are named presets with per-scanner overrides, stored and reused from the web UI. LLM analysis covers Q&A, Jira text, test cases and enrichment, from the scan data.

## Quick start

```bash
git clone https://github.com/calghar/HARIS
cd HARIS
uv sync --extra web --extra reporting
uv run haris --help   # console script haris, entry point haris.cli:main
# CLI. --verify defaults to replay (off, replay, llm).
uv run haris --url https://example.com --profile quick --yes
uv run haris --list-profiles
uv run haris --web   # bind defaults are 127.0.0.1 and port 8000
# Docker
docker compose up
docker compose run --rm cli --url https://example.com --profile quick --yes
make reload
# Scanner template updates
uv run haris update-templates
uv run haris update-templates --scanner nuclei --list
```

## Scanners

| Scanner | What it tests | Install | Version recorded |
| ------- | ------------- | ------- | ---------------- |
| Wapiti | SQLi, XSS, SSRF, command injection, CRLF, XXE | `pipx install wapiti3` | 3.3 |
| SSLyze | TLS protocols, cipher suites, certificate chain, Heartbleed, ROBOT | `pipx install sslyze` | 6.x |
| Nmap | Open ports, service versions, exposed databases | system package manager | 7.x |
| Nikto | Web server misconfigurations, outdated software, dangerous files | `brew install nikto` | 2.x |
| Nuclei | technology-targeted templates, then exposure, misconfiguration and DAST baseline | `brew install nuclei` | 3.x |
| ZAP | Active and passive web scan. Off by default and in no profile. `--scanners zap` | [ZAP download](https://www.zaproxy.org/download/) | 2.16 |
| garak | Injection and leakage probes on a discovered chat route. Runs only with `--ai-active` and `--i-have-authorization` | install the binary | 0.17 |
| promptfoo | Red-team plugins on a discovered chat route. Same flags as garak | install the binary | 0.125 |

All scanners are separate programs. Install Wapiti and SSLyze with `pipx`, outside the HARIS environment. The version column is the adapter `version` attribute (docstrings: Wapiti 3.3.2, Nikto 2.6; Nuclei fixtures 3.7.1; `garak.yaml` 0.17.1; `promptfoo.yaml` 0.125.1). HARIS does not check the tool version at runtime.

## Scan profiles

Estimates are the `estimated_duration` strings on each profile.

| Profile | Scanners | Use |
| ------- | -------- | --- |
| `quick` | The 13 built-in checks other than `ai_security` | First look. 1-3 minutes |
| `pre-launch` | `quick` plus `nmap`, `sslyze`, `wapiti` | Before production. 10-30 minutes |
| `full` | `pre-launch` plus `nikto`, `nuclei` | Full audit. 20-30 minutes. ZAP, garak and promptfoo are absent |
| `ai-security` | `header_checks`, `tls_checks`, `info_disclosure`, `ai_security`, `garak`, `promptfoo` | AI endpoints. 1-10 minutes |
| `regression` | `header_checks`, `tls_checks`, `misc_checks` | CI gate. 30-60 seconds |
| `compliance` | `header_checks`, `tls_checks`, `misc_checks`, `info_disclosure`, `cookie_checks`, `nmap`, `sslyze` | TLS, headers, cookies, disclosure, ports. 5-15 minutes |

<details>
<summary>Built-in checks (14). <code>quick</code> runs every check except <code>ai_security</code>.</summary>

| Check | What it tests |
| ----- | ------------- |
| `header_checks` | Six headers: HSTS, CSP, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy. Also weak CSP or HSTS, a versioned Server banner, and any X-Powered-By header |
| `tls_checks` | Certificate and TLS basics |
| `misc_checks` | CORS, HTTP to HTTPS redirect, 14 sensitive paths |
| `info_disclosure` | Error pages, debug endpoints, HTML comments |
| `cookie_checks` | Session cookie flags, scope, expiry and name |
| `sri_checks` | Subresource Integrity on third-party resources |
| `cache_checks` | Cache-Control on login, account and session-setting responses |
| `method_checks` | OPTIONS advertisement and TRACE |
| `redirect_checks` | Open redirect via common redirect parameters |
| `graphql_checks` | GraphQL introspection |
| `openapi_checks` | Exposed OpenAPI or Swagger documents |
| `listing_checks` | Directory listing |
| `dns_checks` | CAA, SPF and DMARC |
| `ai_security` | AI endpoints and MCP servers. Prompts only with `--ai-active` and `--i-have-authorization`. See [`docs/ai_security.md`](docs/ai_security.md) |

The 14 sensitive paths are `/.env`, `/.git/config`, `/robots.txt`, `/sitemap.xml`, `/.well-known/security.txt`, `/wp-login.php`, `/admin`, `/phpmyadmin`, `/server-status`, `/server-info`, `/.DS_Store`, `/crossdomain.xml`, `/elmah.axd` and `/trace.axd`.

</details>

## Configuration

Value precedence, highest first:

1. Flags: `--url`, `--profile`, `--output`, `--formats`, `--log-level`.
2. Environment variables that override YAML keys, for example `HARIS_TARGET_URL` and `HARIS_PROFILE`.
3. The YAML file: `--config`, else `HARIS_CONFIG`, else `./config/default_config.yaml`, else the packaged `src/haris/resources/config/default_config.yaml`.
4. Built-in defaults.

Copy `.env.example` to `.env`. Docker Compose reads it. Outside Docker, export the variables in the shell.

```bash
HARIS_ADMIN_EMAIL=admin@example.com
HARIS_ADMIN_PASSWORD=changeme123
HARIS_SECRET_KEY=<random-32-char-string>   # python -c "import secrets; print(secrets.token_hex(32))"
```

```yaml
# excerpt of src/haris/resources/config/default_config.yaml
profile: full
target:
  url: "https://example.com"
  auth:
    method: none          # none | cookie | header | form
llm:
  model: ""                        # required for LLM features: <route>/<id>
  api_key_env: LITELLM_API_KEY     # name of the variable that holds the key
```

Every variable, default and effect is in [`docs/configuration.md`](docs/configuration.md).

## Web dashboard

`uv run haris --web` serves the dashboard. It requires login.

- **First admin:** startup creates one when `HARIS_ADMIN_EMAIL` and `HARIS_ADMIN_PASSWORD` are set and the user table is empty.
- **Setup page:** `/auth/setup` answers 404 until `HARIS_SETUP_TOKEN` is set, and once a user exists.
- **Registration:** self-registration uses `HARIS_ALLOWED_EMAIL_DOMAINS`. Roles are `admin` and `user`.
- **OIDC:** set `HARIS_OIDC_ENABLED=true` plus `HARIS_OIDC_ISSUER`, `HARIS_OIDC_CLIENT_ID` and `HARIS_OIDC_CLIENT_SECRET`.

Details are in [`docs/authentication.md`](docs/authentication.md).

## LLM analysis

LLM features use LiteLLM, which is optional.

- **Install:** `uv sync --extra llm`. The published image includes it.
- **Model:** set `llm.model` to `<route>/<id>`, for example `ollama_chat/llama3.1`. For a gateway, also set `llm.api_base` and `llm.api_key_env`.
- **Old backend names:** `anthropic`, `openai`, `ollama` and `bedrock` are rejected: CLI exit 3, web 400.

Setup and the container note are in [`docs/llm_integration.md`](docs/llm_integration.md). Migration steps are in [`docs/upgrading.md`](docs/upgrading.md).

```bash
uv run haris llm ask --scan-id <id> --question "Top 3 risks for an exec"
uv run haris llm remediate --scan-id <id> --format jira
uv run haris llm summarize --scan-id <id> --audience developer
uv run haris --url https://example.com --profile quick --yes --llm-enrich   # in-pipeline enrichment
```

## Documentation

- Design: [architecture](docs/architecture.md), [methodology](docs/methodology.md), [writing a check](docs/writing_checks.md), [integrating a tool](docs/integrating_tools.md).
- Safety and quality: [verification](docs/verification.md), [agent safety](docs/agent_safety.md), [AI security](docs/ai_security.md), [benchmarks](docs/benchmarks.md).
- Operation: [configuration](docs/configuration.md), [authentication](docs/authentication.md), [LLM integration](docs/llm_integration.md), [upgrading](docs/upgrading.md), [CI integrations](docs/integrations.md).

A new scanner subclasses `BaseScanner` and is added to `SCANNER_REGISTRY`. A new check is added to `CHECK_REGISTRY`. A report subclasses `BaseReporter` and implements `generate()`. An LLM backend subclasses `BaseLLMBackend` and implements `complete()`.

## Limitations, legal and licence

- Black-box only. No source code analysis. Target auth methods on `AuthConfig` are `none`, `cookie`, `header` and `form`.
- LLM features need an API key and have a cost. They are optional. Email verification needs SMTP. Without it, an admin activates accounts.
- A security professional should confirm a finding before anyone acts on it. External scanner results depend on those tools being installed.

For authorised testing only. See [LEGAL_NOTICE.md](LEGAL_NOTICE.md). MIT licence. See [LICENSE](LICENSE).
