# bramcps/web-security-auditor architecture

> Architecture diagram of the GitHub repository bramcps/web-security-auditor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bramcps/web-security-auditor
- Repository: https://github.com/bramcps/web-security-auditor

## Overview

SiteAudit scans a submitted website and returns an evidence-backed security report with findings and a weighted A–F grade. Users submit targets through either the web interface or CLI; the scanner normalizes the URL, fetches the landing page, inspects TLS, runs passive checks and optional authorization-gated active probes, then grades the findings. The web endpoint also enforces consent, active-mode configuration, and rate limits. README capabilities include discovery, frontend, network, and server checks; these are represented under the check modules. Relationships reflect shown calls and documented behavior; unsampled details are not expanded.

Main entry points: [`src/Scanner.php`](https://github.com/bramcps/web-security-auditor/blob/main/src/Scanner.php) (Scan coordinator), [`src/Http.php`](https://github.com/bramcps/web-security-auditor/blob/main/src/Http.php) (Safe HTTP client), [`api/scan.php`](https://github.com/bramcps/web-security-auditor/blob/main/api/scan.php) (JSON endpoint), [`src/Advanced.php`](https://github.com/bramcps/web-security-auditor/blob/main/src/Advanced.php) (Advanced checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_web_ui["Web interface<br/>[app.js]"]
  node_web_endpoint["JSON endpoint<br/>[scan.php]"]
  node_cli_runner["CLI runner<br/>[scan.php]"]
end

subgraph group_scan["Scan orchestration"]
  node_scanner["Scan coordinator<br/>[Scanner.php]"]
  node_http_client["Safe HTTP client<br/>[Http.php]"]
  node_tls_inspector["TLS inspection<br/>[Tls.php]"]
end

subgraph group_checks["Security checks"]
  node_passive_checks["Passive checks<br/>[Checks.php]"]
  node_advanced_checks["Advanced checks<br/>[Advanced.php]"]
  node_active_probes["Active probes<br/>[Active.php]"]
end

subgraph group_report["Report output"]
  node_grader["Weighted grader<br/>[Grade.php]"]
  node_web_report["Web report<br/>[app.js]"]
  node_cli_report["CLI report<br/>[scan.php]"]
end

node_web_user(("Web user"))
node_cli_user(("CLI user"))
node_target_site(("Target website"))
node_dns[("DNS records")]

node_web_user -->|"submits target"| node_web_ui
node_web_ui -->|"posts scan"| node_web_endpoint
node_web_endpoint -->|"runs scan"| node_scanner
node_cli_user -->|"starts scan"| node_cli_runner
node_cli_runner -->|"runs scan"| node_scanner
node_scanner -->|"fetches page"| node_http_client
node_scanner -->|"inspects TLS"| node_tls_inspector
node_scanner -->|"runs checks"| node_passive_checks
node_scanner -->|"runs checks"| node_advanced_checks
node_scanner -->|"runs when enabled"| node_active_probes
node_scanner -->|"grades findings"| node_grader
node_http_client -->|"requests pages"| node_target_site
node_tls_inspector -->|"opens TLS connection"| node_target_site
node_passive_checks -->|"fetches paths"| node_http_client
node_advanced_checks -->|"fetches resources"| node_http_client
node_advanced_checks -->|"queries records"| node_dns
node_active_probes -->|"sends probes"| node_http_client
node_active_probes -->|"tests parameters"| node_target_site
node_web_endpoint -->|"returns JSON"| node_web_report
node_web_report -->|"shows report"| node_web_user
node_cli_report -->|"prints report"| node_cli_user

click node_web_ui "https://github.com/bramcps/web-security-auditor/blob/main/public/app.js"
click node_web_endpoint "https://github.com/bramcps/web-security-auditor/blob/main/api/scan.php"
click node_cli_runner "https://github.com/bramcps/web-security-auditor/blob/main/bin/scan.php"
click node_scanner "https://github.com/bramcps/web-security-auditor/blob/main/src/Scanner.php"
click node_http_client "https://github.com/bramcps/web-security-auditor/blob/main/src/Http.php"
click node_tls_inspector "https://github.com/bramcps/web-security-auditor/blob/main/src/Tls.php"
click node_passive_checks "https://github.com/bramcps/web-security-auditor/blob/main/src/Checks.php"
click node_advanced_checks "https://github.com/bramcps/web-security-auditor/blob/main/src/Advanced.php"
click node_active_probes "https://github.com/bramcps/web-security-auditor/blob/main/src/Active.php"
click node_grader "https://github.com/bramcps/web-security-auditor/blob/main/src/Grade.php"
click node_web_report "https://github.com/bramcps/web-security-auditor/blob/main/public/app.js"
click node_cli_report "https://github.com/bramcps/web-security-auditor/blob/main/bin/scan.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_ui,node_web_endpoint,node_cli_runner,node_web_user,node_cli_user toneBlue
class node_scanner,node_http_client,node_tls_inspector,node_dns toneAmber
class node_passive_checks,node_advanced_checks,node_active_probes toneMint
class node_grader,node_web_report,node_cli_report toneRose
class node_target_site toneIndigo
```

## Components

### User interfaces

- [Web interface](https://github.com/bramcps/web-security-auditor/blob/main/public/app.js): `public/app.js`
- [JSON endpoint](https://github.com/bramcps/web-security-auditor/blob/main/api/scan.php): `api/scan.php`
- [CLI runner](https://github.com/bramcps/web-security-auditor/blob/main/bin/scan.php): `bin/scan.php`

### Scan orchestration

- [Scan coordinator](https://github.com/bramcps/web-security-auditor/blob/main/src/Scanner.php): `src/Scanner.php`
- [Safe HTTP client](https://github.com/bramcps/web-security-auditor/blob/main/src/Http.php): `src/Http.php`
- [TLS inspection](https://github.com/bramcps/web-security-auditor/blob/main/src/Tls.php): `src/Tls.php`

### Security checks

- [Passive checks](https://github.com/bramcps/web-security-auditor/blob/main/src/Checks.php): `src/Checks.php`
- [Advanced checks](https://github.com/bramcps/web-security-auditor/blob/main/src/Advanced.php): `src/Advanced.php`
- [Active probes](https://github.com/bramcps/web-security-auditor/blob/main/src/Active.php): `src/Active.php`

### Report output

- [Weighted grader](https://github.com/bramcps/web-security-auditor/blob/main/src/Grade.php): `src/Grade.php`
- [Web report](https://github.com/bramcps/web-security-auditor/blob/main/public/app.js): `public/app.js`
- [CLI report](https://github.com/bramcps/web-security-auditor/blob/main/bin/scan.php): `bin/scan.php`

### Other components

- **Web user**
- **CLI user**
- **Target website**
- **DNS records**

## Connections

- Web user → Web interface: submits target (evidence: `README.md`)
- Web interface → JSON endpoint: posts scan (evidence: `public/app.js`)
- JSON endpoint → Scan coordinator: runs scan (evidence: `api/scan.php`)
- CLI user → CLI runner: starts scan (evidence: `README.md`)
- CLI runner → Scan coordinator: runs scan (evidence: `bin/scan.php`)
- Scan coordinator → Safe HTTP client: fetches page (evidence: `src/Scanner.php`)
- Scan coordinator → TLS inspection: inspects TLS (evidence: `src/Scanner.php`)
- Scan coordinator → Passive checks: runs checks (evidence: `src/Scanner.php`)
- Scan coordinator → Advanced checks: runs checks (evidence: `src/Scanner.php`)
- Scan coordinator → Active probes: runs when enabled (evidence: `src/Scanner.php`)
- Scan coordinator → Weighted grader: grades findings (evidence: `src/Scanner.php`)
- Safe HTTP client → Target website: requests pages (evidence: `src/Http.php`)
- TLS inspection → Target website: opens TLS connection (evidence: `src/Tls.php`)
- Passive checks → Safe HTTP client: fetches paths (evidence: `src/Checks.php`)
- Advanced checks → Safe HTTP client: fetches resources (evidence: `src/Advanced.php`)
- Advanced checks → DNS records: queries records (evidence: `README.md`)
- Active probes → Safe HTTP client: sends probes (evidence: `src/Active.php`)
- Active probes → Target website: tests parameters (evidence: `README.md`)
- JSON endpoint → Web report: returns JSON (evidence: `public/app.js`)
- Web report → Web user: shows report (evidence: `public/app.js`)
- CLI report → CLI user: prints report (evidence: `bin/scan.php`)
