One object model. Pluggable engines.
Everything in SafeTool — the home page, every tool, the workbench and the space — runs on the same pipeline: objects go through engines, engines produce findings anchored to evidence, moves turn findings into new verified versions.
From an object to an action
- ObjectA link, email, file, text or value, with versions and children (attachments, extracted links).
- EnginesPhase 1 parses, phase 2 inspects locally, phase 3 enriches over the network with consent.
- FindingsSeverity, lens, confidence and anchors to the exact evidence (text range, field, region, node, byte offset).
- MovesTransforms, extractions and lookups. Transforms create a new version that is analyzed again.
Entities (domains, IPs, people, wallets…) and relations connect objects across a case; the space visualizes them. Every event lands on the case’s trust timeline.
Write an engine
Engines are plain modules registered at startup. They receive a context with the object, its bytes or text, your rules, and functions to report findings, entities, relations, facts and child objects. Network engines declare a service and are skipped until the user consents.
import { registerEngine } from '@/core/engine';
registerEngine({
id: 'sec.my-check',
name: 'My check',
description: 'Flags invoices that ask for gift cards.',
lenses: ['security'],
phase: 2, // 1 parse · 2 inspect (local) · 3 enrich (network)
accepts: (o) => o.kind === 'text' || o.kind === 'email',
rules: [{ id: 'my.giftcard', title: 'Gift-card payment', lens: 'security', severity: 'high', description: '…' }],
async run(ctx) {
const text = ctx.text(); // body text for emails, text for documents
const m = /gift ?cards?/i.exec(text ?? '');
if (!m) return;
ctx.finding({
rule: 'my.giftcard',
lens: 'security',
severity: 'high',
title: 'Asks for payment in gift cards',
detail: 'Legitimate businesses do not invoice in gift cards.',
confidence: 0.9,
anchors: [{ type: 'text', start: m.index, end: m.index + m[0].length, quote: m[0] }],
});
},
});Server-side engines (YARA-X, Presidio, Gitleaks, a malware sandbox) plug in the same way: an engine with requiresEdge: true posts the object to an edge route and maps the response to findings.
Add a move
import { registerMove } from '@/core/moves';
registerMove({
id: 'text.defang-links',
title: 'Defang links',
verb: 'Defang',
description: 'Make links unclickable before pasting them into a report.',
kind: 'transform',
icon: 'link',
intents: ['share', 'investigate'],
appliesTo: (o) => o.kind === 'text',
async run(o) {
const text = (o.text ?? '').replace(/https?:\/\//g, 'hxxps://').replace(/\./g, '[.]');
// A transform returns a new version; SafeTool re-analyzes it and keeps the original.
return { type: 'version', text, summary: 'Links defanged', changes: ['links'] };
},
});The Cloudflare Worker
The app works without it. When deployed, the worker adds services that need a secret or must not run in the browser. Every response is JSON; every call from the app is consent-gated and logged in the privacy ledger.
| Endpoint | Purpose | Response |
|---|---|---|
| GET /api/health | Which edge services are configured | { ok, version, services: { ipinfo, webrisk, ct, fetch, claude }, model? } |
| GET /api/ip/:ip | IP owner, ASN and country (IPinfo Lite) | { ip, asn, as_name, as_domain, country, country_code, continent } |
| GET /api/webrisk?uri= | Google Web Risk lookup for a URL | { threat?: { threatTypes[], expireTime } } |
| GET /api/ct?domain= | Certificate Transparency summary (crt.sh) | { count, first?, last?, names[], issuers[] } |
| GET /api/fetch?url= | Isolated page fetch with SSRF guard | { status, finalUrl, redirects[], headers, html?, tls, error? } |
| POST /api/ai | Claude answer over finding summaries | { answer, evidence[], moves[], uncertainty?, model, refused? } |
AI contract
The worker calls Claude with a JSON schema for the answer. The app checks every cited finding id and every proposed move against local state before showing anything.
POST /api/ai
{
"question": "Is this email legit?",
"intent": "check",
"context": [{
"ref": "O1", "name": "Invoice #88213 …", "kind": "email", "posture": "Serious concerns",
"facts": ["Authentication / SPF: fail", …],
"findings": [{ "id": "f_…", "severity": "high", "lens": "authenticity", "title": "…", "detail": "…" }],
"moves": ["email.extract-links: Inspect links individually", …],
"excerpt": "… only when the user allows excerpts …"
}],
"selection": "optional selected text"
}
200 OK
{
"answer": "Treat it as phishing: …",
"evidence": ["f_…", "f_…"], // must be finding ids from the context
"moves": [{ "move": "email.extract-links", "object": "O1", "label": "Inspect the links" }],
"uncertainty": "DNS was not checked.",
"model": "claude-opus-5-5"
}Secrets stay on the server
| Variable | Enables | Set with |
|---|---|---|
| IPINFO_TOKEN | IP lookups via IPinfo Lite | wrangler secret put IPINFO_TOKEN |
| GOOGLE_WEB_RISK_API_KEY | URL reputation via Google Web Risk | wrangler secret put GOOGLE_WEB_RISK_API_KEY |
| ANTHROPIC_API_KEY | Claude answers (POST /api/ai) | wrangler secret put ANTHROPIC_API_KEY |
| ANTHROPIC_MODEL | Optional model override (default claude-opus-5-5) | vars in wrangler.jsonc |
For local development put them in .dev.vars (git-ignored). Without them the corresponding checks report “not configured” and everything else keeps working.
Open source underneath
Runtime dependencies use permissive licences compatible with commercial, ad-supported use. Network data sources have their own terms — see the Trust center.
| Project | Licence | Used for |
|---|---|---|
| React, React Router, zustand, immer | MIT | UI and state |
| pdf.js (pdfjs-dist) | Apache-2.0 | PDF parsing and rendering |
| pdf-lib | MIT | PDF sanitize and flatten |
| exifr | MIT | EXIF, XMP, IPTC, GPS |
| postal-mime | MIT-0 | Email (RFC 822) parsing |
| DOMPurify | MPL-2.0 or Apache-2.0 | Safe email/HTML previews |
| fflate | MIT | ZIP / OOXML / gzip |
| jsQR | Apache-2.0 | QR decoding |
| hash-wasm | MIT | MD5, SHA-3, BLAKE3, CRC32 |
| d3-force | ISC | Graph layout |
| diff | BSD-3-Clause | Version comparison |
| lucide-react | ISC | Icons |
| Geist, Instrument Serif | OFL-1.1 | Fonts |
| @anthropic-ai/sdk (edge) | MIT | Claude API client |
Ideas from CyberChef (Apache-2.0), Presidio, Gitleaks, YARA/YARA-X, C2PA and Web-Check informed the engines; their code is not bundled.