Skip to content

Self-hosted OSINT exposure checker — is your email, username, phone or password leaked? Keyless sources: breaches, infostealer logs, COMB credentials, HIBP k-anonymity, 200-platform username grid. Docker one-command install, no API keys, no AI, Apache-2.0.

v1.4.0: source 22 - LeakLens breach-registry search (phone + username, keyless MCP); honest degraded->unavailable; 10-case unit test; counts 21->22 (README, badge, docs, composer)

Rana Khan507db0ce9cfd
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5195b04..8131855 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,31 @@
# Changelog
+## [1.4.0] — 2026-10-23
+
+### Sources
+
+- **Source 22: LeakLens breach-registry search (phone + username)** — keyless
+ MCP endpoint (`leaklens.org/api/mcp`, stateless JSON-RPC `tools/call`).
+ First **phone breach-exposure** source (PhoneValidity only checks E.164
+ validity) and a breach-flavored complement to the Maigret platform-presence
+ grid for usernames. 21 → 22 keyless sources across README, badge, docs and
+ composer description; the dashboard count stays registry-derived.
+- **Deliberate scope**: no email (XposedOrNot already queries the same upstream
+ corpus directly), no password (the LeakLens audit endpoint is an HIBP range
+ proxy; PwnedPasswordsSource queries HIBP directly and the browser-side
+ k-anonymity matcher is keyed to it), no domain (EC surfaces domain
+ infrastructure only — crt.sh + RDAP; website scanning stays in the scanner CE).
+- **Honest degradation** (their semantics meet ours): `isExposed:false` with
+ `degraded:true` maps to `unavailable`, never a fake clean; hits record which
+ upstreams did not answer. Result items are reduced to aggregates (breach
+ name, date, record count) — credential-like and third-party-identity fields
+ are dropped before anything reaches the client.
+- License note: leaklens.org registry data is free for non-commercial, civic
+ and human-rights use — fine for this self-hosted personal checker; not
+ licensed for the commercial platform (this source ships CE-only, by design).
+- New dedicated unit test (`LeakLensSourceTest`, 10 cases, mocked MCP
+ envelopes — hit/clean/degraded/isError/transport/malformed/cap/ethics).
+
## [1.3.1] — 2026-10-23
### Fixed
diff --git a/README.md b/README.md
index 20a4ff9..5d2b18a 100644
--- a/README.md
+++ b/README.md
@@ -10,16 +10,16 @@
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
[![PHP 8.2+](https://img.shields.io/badge/PHP-8.2%20%7C%208.3%20%7C%208.4-777BB4.svg)](composer.json)
[![No AI](https://img.shields.io/badge/verdicts-deterministic%20%C2%B7%20zero%20AI-22D3EE.svg)](#-why-no-ai-is-a-feature)
-[![Keyless](https://img.shields.io/badge/sources-21%20%C2%B7%20all%20keyless-34D399.svg)](#%EF%B8%8F-the-21-sources)
+[![Keyless](https://img.shields.io/badge/sources-22%20%C2%B7%20all%20keyless-34D399.svg)](#%EF%B8%8F-the-22-sources)
[![Docker](https://img.shields.io/badge/install-one%20command-2496ED.svg)](#-quick-start)
-Check your personal identifiers against **21 free OSINT sources** — breach databases,
+Check your personal identifiers against **22 free OSINT sources** — breach databases,
infostealer corpora, 11B+ leaked credential pairs, 150+ platform username registries —
from your own server, with your own eyes.
**The companion OSINT tool to the [200-scanner Website Vulnerability Scanner CE](https://github.com/RanaKhan77/Website-Vulnerability-Scanner).**
-[Quick Start](#-quick-start) · [The 6 Checks](#-the-6-checks) · [Sources](#%EF%B8%8F-the-21-sources) · [Why](#-why-this-exists) · [Privacy](#-privacy-by-design) · [FAQ](docs/FAQ.md) · [Donate](#-support-the-project)
+[Quick Start](#-quick-start) · [The 6 Checks](#-the-6-checks) · [Sources](#%EF%B8%8F-the-22-sources) · [Why](#-why-this-exists) · [Privacy](#-privacy-by-design) · [FAQ](docs/FAQ.md) · [Donate](#-support-the-project)
</div>
@@ -27,7 +27,7 @@ from your own server, with your own eyes.
## 📸 What you get — real screenshots, live product
-<img src="assets/dashboard-preview.png" width="880" alt="Exposure Check dashboard — one input, 6 identifier types, 21 keyless sources, live corpus stats"/>
+<img src="assets/dashboard-preview.png" width="880" alt="Exposure Check dashboard — one input, 6 identifier types, 22 keyless sources, live corpus stats"/>
**The dashboard.** Paste any identifier — the type is auto-detected, the corpus stats
(1,047+ breaches, 17.8B+ leaked records, 37M stealer infections) are computed from the
@@ -66,7 +66,7 @@ That is the whole install: one Docker container (Apache + PHP + SQLite — no My
Redis, no API keys), a generated admin password, and `http://localhost:8080` ready.
Details and non-Docker paths: [docs/SELF-HOSTING.md](docs/SELF-HOSTING.md).
-Self-test the whole stack any time (21-source reachability, storage, database,
+Self-test the whole stack any time (22-source reachability, storage, database,
site database — seconds, no real check performed):
```bash
@@ -74,7 +74,7 @@ docker compose exec app php artisan ec:doctor # add --json for machine-reada
```
```
-Sign in → paste an email → watch 21 sources answer in parallel → open the printable report.
+Sign in → paste an email → watch 22 sources answer in parallel → open the printable report.
Export any stored check as JSON or CSV — report page, history table, or right after a live check.
```
@@ -91,13 +91,13 @@ Export any stored check as JSON or CSV — report page, history table, or right
Full explanations with screenshots-level detail: [docs/CHECKS.md](docs/CHECKS.md).
-## 🛰️ The 21 Sources
+## 🛰️ The 22 Sources
All **keyless** (no API key, no account, no cost), all read-only HTTPS lookups, all
toggleable on the Settings page:
-**Breach & stealer (4):** HudsonRock infostealer corpus · XposedOrNot breach analytics ·
-ProxyNova COMB (11B+ pairs) · HIBP Pwned Passwords (k-anonymity)
+**Breach & stealer (5):** HudsonRock infostealer corpus · XposedOrNot breach analytics ·
+ProxyNova COMB (11B+ pairs) · HIBP Pwned Passwords (k-anonymity) · LeakLens phone/username breach search
**Username & social (3):** Maigret + WhatsMyName corpus (150 sites, logo grid) ·
Bluesky (AT Protocol) · Hacker News
@@ -112,7 +112,7 @@ Presend · disposable-domain blocklist · GitHub public search
Per-source endpoints, attribution and license notes: **[docs/SOURCES.md](docs/SOURCES.md)**.
Prefer reading offline? Every documentation section also ships as a print-ready PDF in
-**[pdfs/](pdfs/)** — overview guide, the 6 checks, the 21 sources, self-hosting,
+**[pdfs/](pdfs/)** — overview guide, the 6 checks, the 22 sources, self-hosting,
privacy and FAQ.
## 🧠 Why "no AI" is a feature
diff --git a/app/Modules/Osint/OsintCheckService.php b/app/Modules/Osint/OsintCheckService.php
index 984fa56..124c7ca 100644
--- a/app/Modules/Osint/OsintCheckService.php
+++ b/app/Modules/Osint/OsintCheckService.php
@@ -25,6 +25,7 @@ use App\Modules\Osint\Sources\ProxyNovaCombSource;
use App\Modules\Osint\Sources\RdapSource;
use App\Modules\Osint\Sources\ShodanInternetDbSource;
use App\Modules\Osint\Sources\BotCidrSource;
+use App\Modules\Osint\Sources\LeakLensSource;
use App\Modules\Osint\Sources\XposedOrNotSource;
use App\Services\SettingsService;
use Illuminate\Http\Client\Pool;
@@ -86,6 +87,10 @@ class OsintCheckService
// v1.3.0 (2026-10-22, gap-analysis D1): domain-infra sources, keyless
CrtShSource::class,
RdapSource::class,
+ // v1.4.0 (2026-10-23, s33 P0): LeakLens breach-registry search
+ // (phone/username via keyless MCP; email/password/domain deliberately
+ // not here - see the source class docblock for the scope reasoning)
+ LeakLensSource::class,
];
public const TYPES = ['email', 'username', 'phone', 'password', 'domain', 'ip'];
diff --git a/app/Modules/Osint/Sources/LeakLensSource.php b/app/Modules/Osint/Sources/LeakLensSource.php
new file mode 100644
index 0000000..c84a931
--- /dev/null
+++ b/app/Modules/Osint/Sources/LeakLensSource.php
@@ -0,0 +1,227 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Modules\Osint\Sources;
+
+use Illuminate\Http\Client\Response;
+
+/**
+ * LeakLens public breach-registry search (keyless MCP endpoint) — 22nd OSINT source.
+ * Endpoint: https://leaklens.org/api/mcp (JSON-RPC 2.0, stateless tools/call)
+ *
+ * Scope (deliberate):
+ * - phone -> tools/call search_phone (NEW capability: phone breach exposure;
+ * PhoneValiditySource only checks E.164 validity, not breaches)
+ * - username -> tools/call search_username (breach-flavored complement to the
+ * Maigret platform-presence grid)
+ * - email -> NOT here: XposedOrNotSource already queries the same upstream
+ * corpus directly (LeakLens aggregates XposedOrNot, own:0/agg:795)
+ * - password -> NOT here: the LeakLens audit endpoint is an HIBP range proxy;
+ * PwnedPasswordsSource already queries HIBP directly and the
+ * dashboard's client-side matcher is keyed to that source
+ * - domain -> NOT here: EC surfaces domain infrastructure only (crt.sh + RDAP);
+ * website scanning stays in the scanner CE (owner scope rule)
+ *
+ * MCP envelope: {"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":...}}
+ * Inner payload: {"isExposed":bool,"exposedCount":int,"results":[...],
+ * "degraded":bool,"errors":["upstream",...]}
+ *
+ * Honest-degradation rule (their semantics meet ours):
+ * isExposed=true -> hit (a hit is a hit even if some upstreams errored)
+ * isExposed=false, degraded=false -> clean
+ * isExposed=false, degraded=true -> UNAVAILABLE — upstreams errored, so a "not
+ * found" cannot be trusted; never fake a clean pass (platform rule).
+ *
+ * License note: leaklens.org registry data is free for non-commercial, civic and
+ * human-rights use — fine for this self-hosted personal checker; it is NOT licensed
+ * for the commercial platform, which is why this source ships only in the CE.
+ *
+ * ETHICS: aggregates only — breach/database names, dates, record counts. Any
+ * credential-like or third-party-identity fields in result items are dropped.
+ */
+class LeakLensSource implements OsintSource
+{
+ private const MCP = 'https://leaklens.org/api/mcp';
+
+ private const TOOLS = [
+ 'phone' => 'search_phone',
+ 'username' => 'search_username',
+ ];
+
+ public function key(): string
+ {
+ return 'leaklens';
+ }
+
+ public function label(): string
+ {
+ return 'LeakLens — Breach Registry Search';
+ }
+
+ public function category(): string
+ {
+ return 'breach';
+ }
+
+ public function supports(string $type): bool
+ {
+ return isset(self::TOOLS[$type]);
+ }
+
+ public function requests(string $type, string $identifier): array
+ {
+ if (!isset(self::TOOLS[$type])) {
+ return [];
+ }
+
+ $arguments = ['username' => $identifier];
+ if ($type === 'phone') {
+ // their tool expects international format (e.g. +8801712345678);
+ // normalize() gives bare digits, so re-add the plus
+ $arguments = ['phone' => '+' . ltrim($identifier, '+')];
+ }
+
+ $payload = json_encode([
+ 'jsonrpc' => '2.0',
+ 'id' => 1,
+ 'method' => 'tools/call',
+ 'params' => [
+ 'name' => self::TOOLS[$type],
+ 'arguments' => (object) $arguments,
+ ],
+ ], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+
+ return [
+ [
+ 'name' => $this->key() . '.main',
+ 'method' => 'POST',
+ 'url' => self::MCP,
+ 'headers' => [
+ 'Accept' => 'application/json, text/event-stream',
+ 'Content-Type' => 'application/json',
+ ],
+ 'body' => $payload,
+ ],
+ ];
+ }
+
+ public function parse(string $type, string $identifier, array $responses): array
+ {
+ $resp = $responses[$this->key() . '.main'] ?? null;
+ if (!$resp instanceof Response || !$resp->ok()) {
+ return ['status' => 'unavailable', 'summary' => 'LeakLens breach search unavailable right now.', 'data' => []];
+ }
+
+ $envelope = $resp->json();
+ $text = $envelope['result']['content'][0]['text'] ?? null;
+ if (!is_string($text) || $text === '') {
+ return ['status' => 'unavailable', 'summary' => 'LeakLens returned an unexpected response.', 'data' => []];
+ }
+ if (!empty($envelope['result']['isError'])) {
+ return ['status' => 'unavailable', 'summary' => 'LeakLens could not run this search.', 'data' => []];
+ }
+
+ $inner = json_decode($text, true);
+ if (!is_array($inner)) {
+ return ['status' => 'unavailable', 'summary' => 'LeakLens returned an unreadable result.', 'data' => []];
+ }
+
+ $exposed = (bool) ($inner['isExposed'] ?? false);
+ $count = (int) ($inner['exposedCount'] ?? 0);
+ $degraded = (bool) ($inner['degraded'] ?? false);
+ $errors = [];
+ foreach ((array) ($inner['errors'] ?? []) as $e) {
+ if (is_string($e) && $e !== '') {
+ $errors[] = $e;
+ }
+ }
+
+ // ---- HIT: aggregates only, credential-like fields dropped ----
+ if ($exposed) {
+ $records = [];
+ $raw = is_array($inner['results'] ?? null) ? $inner['results'] : [];
+ foreach ($raw as $r) {
+ if (is_string($r) && trim($r) !== '') {
+ $records[] = trim($r);
+ if (count($records) >= 10) {
+ break;
+ }
+ continue;
+ }
+ if (!is_array($r)) {
+ continue;
+ }
+ $name = $this->firstString($r, ['breach', 'name', 'source', 'title', 'database']);
+ $date = $this->firstString($r, ['date', 'xposed_date', 'year', 'breach_date']);
+ $rec = $r['records'] ?? $r['count'] ?? $r['exposed_records'] ?? null;
+ $line = $name;
+ if ($date !== '') {
+ $line .= ($line !== '' ? ' — ' : '') . $date;
+ }
+ if (is_numeric($rec) && (int) $rec > 0) {
+ $line .= ($line !== '' ? ' — ' : '') . number_format((int) $rec) . ' records';
+ }
+ if ($line !== '') {
+ $records[] = $line;
+ }
+ if (count($records) >= 10) {
+ break;
+ }
+ }
+ $shown = $count > 0 ? $count : count($records);
+
+ $data = [
+ 'exposures' => $shown,
+ 'records' => $records,
+ 'note' => 'Aggregate breach-registry records via leaklens.org (non-commercial civic registry).',
+ ];
+ if ($errors !== []) {
+ $data['degraded_upstreams'] = implode(', ', $errors) . ' (partial coverage)';
+ }
+
+ $summary = 'FOUND in ' . $shown . ' breach registry record(s)'
+ . ($errors !== [] ? ' — partial: some upstream sources did not answer' : '') . '.';
+
+ return [
+ 'status' => 'hit',
+ 'summary' => $summary,
+ 'severity' => 'high',
+ 'data' => $data,
+ ];
+ }
+
+ // ---- not exposed: only trust it when nothing degraded ----
+ if ($degraded) {
+ $why = $errors !== [] ? ' (' . implode(', ', $errors) . ' did not answer)' : '';
+ return [
+ 'status' => 'unavailable',
+ 'summary' => 'LeakLens could not verify — upstream sources degraded' . $why . '.',
+ 'data' => [],
+ ];
+ }
+
+ return [
+ 'status' => 'clean',
+ 'summary' => 'No exposure records found for this identifier.',
+ 'severity' => 'info',
+ 'data' => [
+ 'exposures' => 0,
+ 'note' => 'This identifier does not appear in the LeakLens breach registry.',
+ ],
+ ];
+ }
+
+ /** First non-empty string value among the given keys. */
+ private function firstString(array $row, array $keys): string
+ {
+ foreach ($keys as $k) {
+ $v = $row[$k] ?? null;
+ if (is_string($v) && trim($v) !== '') {
+ return trim($v);
+ }
+ }
+
+ return '';
+ }
+}
diff --git a/composer.json b/composer.json
index 7ead0a2..9d5d235 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,7 @@
"$schema": "https://getcomposer.org/schema.json",
"name": "2mny/exposure-check-osint",
"type": "project",
- "description": "Self-hosted personal exposure checker: email / username / phone / password / IP against 21 keyless OSINT sources. Non-AI, Laravel + Docker, k-anonymity password checks.",
+ "description": "Self-hosted personal exposure checker: email / username / phone / password / IP against 22 keyless OSINT sources. Non-AI, Laravel + Docker, k-anonymity password checks.",
"keywords": [
"osint",
"email-osint",
diff --git a/docs/SOURCES.md b/docs/SOURCES.md
index adcbaff..292dacf 100644
--- a/docs/SOURCES.md
+++ b/docs/SOURCES.md
@@ -1,4 +1,4 @@
-# Data Sources — all 21, all keyless
+# Data Sources — all 22, all keyless
Every source below is **free, keyless (no API key, no account), read-only, and queried over HTTPS**.
Per-source enable/disable lives on the Settings page. Attribution and limits are listed honestly —
@@ -27,6 +27,7 @@ if a source is down, its card shows `unavailable` and the check continues (per-s
| 19 | Bot-CIDR attribution | infra | ip | offline crawler-network ranges (CrawlerScope-inspired) | Is the IP a known crawler/bot network — offline, no external call |
| 20 | crt.sh — Certificate Transparency | infra | domain | `crt.sh/?q=%.{domain}` (keyless) | Historical subdomains that ever obtained a TLS certificate — counts + first 40 names |
| 21 | RDAP — Domain Registration Records | infra | domain | `rdap.org/domain/{domain}` (keyless) | Registrar, registration/expiry dates, status — registration age as a fraud/trust signal |
+| 22 | LeakLens | breach | phone, username | `leaklens.org/api/mcp` (keyless JSON-RPC tools/call) | Breach-registry search for phone numbers and usernames; honest `unavailable` when upstreams degrade |
## Display images
diff --git a/tests/Unit/LeakLensSourceTest.php b/tests/Unit/LeakLensSourceTest.php
new file mode 100644
index 0000000..62720a0
--- /dev/null
+++ b/tests/Unit/LeakLensSourceTest.php
@@ -0,0 +1,174 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Tests\Unit;
+
+use App\Modules\Osint\Sources\LeakLensSource;
+use GuzzleHttp\Psr7\Response as Psr7Response;
+use Illuminate\Http\Client\Response;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * LeakLensSource tests (v1.4.0, s33 P0 — breach-registry phone/username search).
+ *
+ * All responses are mocked (no network): the MCP envelope wraps a JSON text
+ * payload exactly like the live endpoint.
+ */
+final class LeakLensSourceTest extends TestCase
+{
+ private LeakLensSource $src;
+
+ protected function setUp(): void
+ {
+ $this->src = new LeakLensSource();
+ }
+
+ /** Build a mocked pool Response carrying an MCP envelope. */
+ private function mcp(array $inner, bool $isError = false, int $status = 200): Response
+ {
+ $envelope = [
+ 'jsonrpc' => '2.0',
+ 'id' => 1,
+ 'result' => [
+ 'content' => [
+ ['type' => 'text', 'text' => json_encode($inner, JSON_UNESCAPED_SLASHES)],
+ ],
+ 'isError' => $isError,
+ ],
+ ];
+
+ return new Response(new Psr7Response($status, ['Content-Type' => 'application/json'], json_encode($envelope)));
+ }
+
+ private function responses(Response $resp): array
+ {
+ return ['leaklens.main' => $resp];
+ }
+
+ public function test_supports_phone_and_username_only(): void
+ {
+ $this->assertTrue($this->src->supports('phone'));
+ $this->assertTrue($this->src->supports('username'));
+ // email is covered by XposedOrNot direct; password by HIBP direct;
+ // domain stays out of EC scope (scanner CE owns it)
+ $this->assertFalse($this->src->supports('email'));
+ $this->assertFalse($this->src->supports('password'));
+ $this->assertFalse($this->src->supports('domain'));
+ $this->assertFalse($this->src->supports('ip'));
+ }
+
+ public function test_request_is_a_valid_stateless_mcp_call(): void
+ {
+ $specs = $this->src->requests('phone', '8801712345678');
+ $this->assertCount(1, $specs);
+ $s = $specs[0];
+ $this->assertSame('POST', $s['method']);
+ $this->assertSame('https://leaklens.org/api/mcp', $s['url']);
+ $this->assertSame('application/json', $s['headers']['Content-Type']);
+ $body = json_decode((string) $s['body'], true);
+ $this->assertSame('2.0', $body['jsonrpc']);
+ $this->assertSame('tools/call', $body['method']);
+ $this->assertSame('search_phone', $body['params']['name']);
+ // international format per their tool contract
+ $this->assertSame('+8801712345678', $body['params']['arguments']['phone']);
+ }
+
+ public function test_username_request_uses_search_username_tool(): void
+ {
+ $body = json_decode((string) $this->src->requests('username', 'someuser')[0]['body'], true);
+ $this->assertSame('search_username', $body['params']['name']);
+ $this->assertSame('someuser', $body['params']['arguments']['username']);
+ }
+
+ public function test_hit_exposes_aggregates_and_drops_credential_fields(): void
+ {
+ $inner = [
+ 'isExposed' => true,
+ 'exposedCount' => 2,
+ 'results' => [
+ ['breach' => 'Collection1', 'date' => '2019-01-07', 'records' => 772904991, 'email' => '[email protected]', 'password' => 'hunter2'],
+ ['source' => 'MyFitnessPal', 'year' => '2018'],
+ ],
+ 'degraded' => true,
+ 'errors' => ['occrp-aleph'],
+ ];
+ $r = $this->src->parse('username', 'someuser', $this->responses($this->mcp($inner)));
+ $this->assertSame('hit', $r['status']);
+ $this->assertSame('high', $r['severity']);
+ $this->assertSame(2, $r['data']['exposures']);
+ $this->assertSame('Collection1 — 2019-01-07 — 772,904,991 records', $r['data']['records'][0]);
+ $this->assertSame('MyFitnessPal — 2018', $r['data']['records'][1]);
+ $this->assertStringContainsString('occrp-aleph', (string) $r['data']['degraded_upstreams']);
+ // ethics: no credential or third-party identity fields survive
+ $flat = json_encode($r['data']);
+ $this->assertStringNotContainsString('[email protected]', $flat);
+ $this->assertStringNotContainsString('hunter2', $flat);
+ }
+
+ public function test_string_results_become_labels(): void
+ {
+ $inner = ['isExposed' => true, 'exposedCount' => 2, 'results' => ['BreachA', 'BreachB'], 'degraded' => false];
+ $r = $this->src->parse('phone', '8801712345678', $this->responses($this->mcp($inner)));
+ $this->assertSame('hit', $r['status']);
+ $this->assertSame(['BreachA', 'BreachB'], $r['data']['records']);
+ }
+
+ public function test_clean_when_not_exposed_and_not_degraded(): void
+ {
+ $inner = ['isExposed' => false, 'exposedCount' => 0, 'results' => [], 'degraded' => false];
+ $r = $this->src->parse('phone', '8801712345678', $this->responses($this->mcp($inner)));
+ $this->assertSame('clean', $r['status']);
+ $this->assertSame(0, $r['data']['exposures']);
+ }
+
+ public function test_degraded_clean_is_unavailable_never_fake_clean(): void
+ {
+ // the core honesty rule: upstreams errored, so "not found" is not trustworthy
+ $inner = ['isExposed' => false, 'exposedCount' => 0, 'results' => [], 'degraded' => true, 'errors' => ['leakcheck', 'xposedornot']];
+ $r = $this->src->parse('username', 'someuser', $this->responses($this->mcp($inner)));
+ $this->assertSame('unavailable', $r['status']);
+ $this->assertStringContainsString('leakcheck', $r['summary']);
+ }
+
+ public function test_mcp_isError_is_unavailable(): void
+ {
+ $r = $this->src->parse('username', 'someuser', $this->responses($this->mcp(['whatever' => 1], true)));
+ $this->assertSame('unavailable', $r['status']);
+ }
+
+ public function test_transport_error_is_unavailable(): void
+ {
+ $r = $this->src->parse('username', 'someuser', []);
+ $this->assertSame('unavailable', $r['status']);
+
+ $http500 = new Response(new Psr7Response(500, [], 'boom'));
+ $r = $this->src->parse('username', 'someuser', $this->responses($http500));
+ $this->assertSame('unavailable', $r['status']);
+ }
+
+ public function test_malformed_envelope_is_unavailable(): void
+ {
+ $garbage = new Response(new Psr7Response(200, ['Content-Type' => 'application/json'], 'not json'));
+ $r = $this->src->parse('username', 'someuser', $this->responses($garbage));
+ $this->assertSame('unavailable', $r['status']);
+
+ $noText = new Response(new Psr7Response(200, ['Content-Type' => 'application/json'], json_encode(['result' => ['content' => []]])));
+ $r = $this->src->parse('username', 'someuser', $this->responses($noText));
+ $this->assertSame('unavailable', $r['status']);
+ }
+
+ public function test_records_cap_at_ten(): void
+ {
+ $results = [];
+ for ($i = 1; $i <= 25; $i++) {
+ $results[] = ['breach' => 'B' . $i];
+ }
+ $inner = ['isExposed' => true, 'exposedCount' => 25, 'results' => $results, 'degraded' => false];
+ $r = $this->src->parse('username', 'someuser', $this->responses($this->mcp($inner)));
+ $this->assertSame('hit', $r['status']);
+ $this->assertCount(10, $r['data']['records']);
+ // the true count is still shown
+ $this->assertSame(25, $r['data']['exposures']);
+ }
+}