Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Open [KindPath locally](http://127.0.0.1:5173/). The API listens on `127.0.0.1:3

`npm run dev` builds the current scanner and firewall runtime images before starting the API and Vite. The first build can download public packages and images; subsequent builds reuse Docker's cache. Browser QA images are only needed for the browser checks, not normal development. If Docker is unavailable, setup stops with an explanation; Chromium never runs directly on the host as a fallback. Ctrl+C stops the dev processes.

Website scanning and capture are **enabled by default for local use**. Enter a URL, select **Scan website**, and download the JSON report or open **Visual preview**. Addresses without a scheme default to HTTPS. The URL scan button waits for the bounded capability check before accepting a submission. Ordinary URL submissions never silently become sample findings. The explicitly labelled example and built-in pages remain available separately.
Website scanning and capture are **enabled by default for local use**. Enter a URL, select **Scan website**, and download the JSON report or open **Visual preview**. Addresses without a scheme default to HTTPS. The URL scan button waits for the bounded capability check before accepting a submission. Ordinary URL submissions never silently become sample findings. The landing page includes a static side-by-side illustration of blur and a red–green colour vision simulation.

To disable real scanning or capture in a local process:

Expand Down Expand Up @@ -50,7 +50,7 @@ Real-page previews use a JPEG rendered in the same isolated visit as the report.
- Captures are bounded to the scan viewport's width (up to 1,280 pixels), the first 6,000 pixels of height, and 1.5 MB of JPEG data. Long-page truncation is labelled. Horizontal overflow outside the scan viewport, content requiring interaction, and resources not loaded by the source browser are not included.
- A screenshot is an image rather than a semantic, responsive or interactive replica. Changing the panel width scales the captured desktop page; it does not rerun its responsive layout. Live content can change between scans.

Images are independently validated and embedded in sandboxed, opaque-origin iframes. The image document permits only embedded image data and trusted styling; scripts, external connections, frames, forms and navigation targets are absent. No third-party page markup or resource URL is copied into it. Legacy controlled DOM previews remain for the built-in illustration checks.
Images are independently validated and embedded in sandboxed, opaque-origin iframes. The image document permits only embedded image data and trusted styling; scripts, external connections, frames, forms and navigation targets are absent. No third-party page markup or resource URL is copied into it. Controlled DOM previews are also exercised by the automated browser checks.

## API

Expand All @@ -59,8 +59,8 @@ Images are independently validated and embedded in sandboxed, opaque-origin ifra
| GET | `/api/health` | Local API status |
| GET | `/api/scanning-capabilities` | Current scanning/capture flags and URL policy |
| POST | `/api/scan-public` | One `{ "url": "https://example.com/" }` request; real report and optional image preview |
| POST | `/api/scan-fixture` | Scan a fixed built-in page |
| POST | `/api/analyze` | Explicit illustrative example; never fetches its URL |
| POST | `/api/scan-fixture` | Scan a fixed fixture for controlled checks |
| POST | `/api/analyze` | Return an illustrative report without fetching the URL |

For successful scans, KindPath labels clearly identifiable browser verification and sign-in screens in the report and preview. The API and JSON download include an optional `pageNotice` code and a plain-language limitation. Detection uses the rendered page and can miss unfamiliar screens. Findings and previews describe the page KindPath received.

Expand Down
619 changes: 177 additions & 442 deletions scripts/preview-browser.mjs

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions server/preview.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,14 @@ import { homedir, tmpdir } from 'node:os';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { randomUUID } from 'node:crypto';
import { captureFixturePreview } from './scanner/fixturePreview.js';
import { scanFixture } from './scanner/fixtureScanner.js';
import { mapSitePreview } from './scanner/sitePreview.js';
import { createDemoReport } from './services/analyze.js';
import { openLocalDockerSession, removeAndConfirm } from './scanner/dockerWorker.js';
import { assertContainerIsolation, containerArguments, IMAGE, QA_IMAGE } from './scanner/containerPolicy.js';

// Fulfill the app's requests from the built assets and real fixture responses, entirely inside network none.
test('reports, exports and isolated previews work in Chromium, Firefox and WebKit', { timeout: 240000 }, async () => {
const snapshot = await captureFixturePreview();
const barriersSnapshot = await captureFixturePreview('barriers');
const clearSnapshot = await captureFixturePreview('clear');
const report = await scanFixture('barriers');
const clearReport = await scanFixture('clear');
const demoReport = createDemoReport(new URL('https://example.com'));
const sitePreview = mapSitePreview({url:'https://www.example.com/en/start?locale=en',capturedAt:new Date().toISOString(),omittedSubtrees:0,omittedText:0,omittedStyles:0,nodes:[
{tag:'h1',attributes:{},style:{},hover:{},children:[{text:'Captured website marker'}]},
{tag:'a',attributes:{},style:{color:'rgb(0, 0, 0)'},hover:{color:'rgb(255, 0, 0)'},children:[{text:'Captured link'}]},
Expand Down Expand Up @@ -72,14 +65,14 @@ test('reports, exports and isolated previews work in Chromium, Firefox and WebKi
{ env: { PATH: '/usr/bin:/bin', LANG: 'C.UTF-8' }, timeout: 90000, maxBuffer: 5 * 1024 * 1024 },
(error, output) => error ? reject(error) : resolve(output));
child.stdin!.on('error', () => {});
child.stdin!.end(JSON.stringify({ browser, snapshot, barriersSnapshot, clearSnapshot, report, clearReport, demoReport, sitePreview, imagePreview, qualityPreviews, assets }));
child.stdin!.end(JSON.stringify({ browser, report, sitePreview, imagePreview, qualityPreviews, assets }));
});
const result = JSON.parse(stdout); assert.equal(result.passed, true); assert.equal(result.engine, browser);
console.info(`${browser} ${result.version}: controlled browser checks passed`);
for (const kind of browser === 'chromium' ? ['fixture', 'demo'] : []) {
await writeFile(join(outputRoot, `kindpath-report-export-${kind}.pdf`), Buffer.from(result[`${kind}Pdf`], 'base64'));
if (browser === 'chromium') {
await writeFile(join(outputRoot, 'kindpath-report-export-public.pdf'), Buffer.from(result.reportPdf, 'base64'));
}
for (const size of ['desktop', 'mobile', 'findingsDesktop', 'findingsMobile', 'matchingDesktop', 'matchingMobile', 'coverageDesktop', 'coverageMobile', 'qualityEmpty', 'qualitySparse']) {
for (const size of ['landingDesktop', 'landingMobile', 'findingsDesktop', 'findingsMobile', 'coverageDesktop', 'coverageMobile', 'qualityEmpty', 'qualitySparse']) {
await writeFile(join(outputRoot, `kindpath-${browser}-static-preview-${size}.png`), Buffer.from(result[size], 'base64'));
}
} finally {
Expand Down
Loading
Loading