diff --git a/docs/SHIP-CHECKLIST.md b/docs/SHIP-CHECKLIST.md index 4fa40992..cd9f5cf9 100644 --- a/docs/SHIP-CHECKLIST.md +++ b/docs/SHIP-CHECKLIST.md @@ -24,6 +24,7 @@ asking to deploy. Skip a step only when it truly doesn't apply, and say which we - **Hover help (test-enforced):** `public/js/ui/explain.js` needs `tool.` or `scene.`, or a HELP entry in `section-help-a.js` / `section-help-b.js`. - **Section intro:** `public/js/section-help.js` if the tool has a console page. - **Findings:** if it produces findings, wire `core/sink.js` attachSinkButton so they reach the Security Graph. +- **Hosting routes (test-enforced):** run `node scripts/sync-hosting-routes.mjs` after adding or removing a console page, Deck tool or scene, so firebase.json serves the app at its path; anything not listed answers a real 404. - **Removal:** take it out of every place above, plus pins and saved state that might point at it (fall back cleanly, as with the retired Finance view). ## 2. Docs and in-product copy @@ -31,6 +32,7 @@ asking to deploy. Skip a step only when it truly doesn't apply, and say which we - `public/js/docs.js`: Getting Started (if it changes what a product does), FAQ, Changelog (current line), Nexus CMD_GROUPS (Nexus commands), Security tab (if safety-relevant). Bump `UPDATED`. - `public/js/landing.js`: feature/bento cards, FAQ answers, pricing plan feature lists, footer links. - `public/index.html`: JSON-LD (`featureList`, descriptions), meta description if the headline offer changed. +- A new public (signed-out) page: add it to `public/js/site-meta.js` PAGES (its own title, description and canonical; the build writes `dist/pages/.html`), `public/sitemap.xml` and `public/llms.txt`, then run `node scripts/sync-hosting-routes.mjs`. - `public/sitemap.xml` for any new public page; `public/robots.txt` only if crawl rules change. - `public/js/darknode-chat.js` system prompt (the in-house assistant's description of the platform and its counts). - `public/humans.txt` for large releases. diff --git a/firebase.json b/firebase.json index f6567310..80165b7b 100644 --- a/firebase.json +++ b/firebase.json @@ -8,7 +8,18 @@ "rewrites": [ { "source": "/api/chat", "function": { "functionId": "chat", "region": "us-central1" } }, { "source": "/version", "destination": "/version.txt" }, - { "source": "**", "destination": "/index.html" } + { "regex": "^/features/?$", "destination": "/pages/features.html" }, + { "regex": "^/pricing/?$", "destination": "/pages/pricing.html" }, + { "regex": "^/faq/?$", "destination": "/pages/faq.html" }, + { "regex": "^/nexus/?$", "destination": "/pages/nexus.html" }, + { "regex": "^/security-knowledge/?$", "destination": "/pages/security-knowledge.html" }, + { "regex": "^/darknode-os/?$", "destination": "/pages/darknode-os.html" }, + { "regex": "^/government/?$", "destination": "/pages/government.html" }, + { "regex": "^/crosswalk/?$", "destination": "/pages/crosswalk.html" }, + { "regex": "^/terms/?$", "destination": "/pages/terms.html" }, + { "regex": "^/privacy/?$", "destination": "/pages/privacy.html" }, + { "regex": "^/acceptable-use/?$", "destination": "/pages/acceptable-use.html" }, + { "regex": "^/(?:console(?:/|$))?(?:(?:area|personal|enterprise)/[\\w-]+|check/[^/]+|tool-[a-z0-9-]+|accessreview|activity|addressintel|admin|adversary|adversaryplaybook|aegis|ai|all-tools|api|apifuzzer|apikeys|apispec|apitester|asnexplorer|assistant|attacksim|audit|awareness|backupready|beta|binanalyze|breachclock|breachlookup|caaudit|cheats|citadel|cloud|cloudspend|cloudtrail|coder|codescan|compliance|compliance-center|con|connections|cookieinspect|correlations|corstester|cracklab|credaudit|crosswalk|crucible|cryptotools|cspevaluator|cvesearch|cvetimeline|cvsscalc|cyberbriefing|cyberrange|darknetradar|dataflow|dataviz|deadlines|deception|device|dlguide|dlp|dmarcreports|dns|dnshunt|docs|domainguard|dossier|downloads|education|emailauth|emailheader|embedsdk|encoding|engine|engines|enterprise|evidence|exploitdb|exploitdev|favicon|fedcompliance|findings|firewall|fleetcomply|forensicstoolkit|ftimeline|fwaudit|ghdb|hashsuite|headeranalyzer|home|huntlab|hydra|iacscan|identitymatrix|incidentcost|incidents|inventory|invest|investigation|investigations|iocenrich|jml|k8saudit|leakprobe|learn|learndo|leetspeak|licenseaudit|loganalyze|loghunt|malclass|math|mcpconnect|memforensics|mobilesec|monitors|navarch|netexposure|netmap|networkscanner|networktools|nhi|oauthgov|oracle|osint|overview|packetanalyzer|packetcraft|payees|payloadgen|payloads|payloadstudio|pentestconsole|pentestreg|personal|phantom|phishtriage|plans|posture|privatecloud|privaudit|privesc|prometheus|proxyhunt|reconplanner|refs|regexlab|report|reports|reverseshell|riskreg|secdash|secgraph|secquiz|securitytxt|sentineleye|settings|setup|sigma|signins|snippets|socialeng|spectre|sslinspector|stego|strongroom|subdomains|supplychain|surface|targets|team|techfingerprint|threat|threatforest|threatmodel|tlsfleet|toolbox|toolkit|tools|urldissect|vanguard|veil|vendorrisk|vmlab|vpnaudit|vulndb|vulnimport|wayback|websockettester|wirelesslab|xsslab|yarabuilder|zerotrust)?/?$", "destination": "/index.html" } ], "headers": [ { @@ -81,7 +92,18 @@ "rewrites": [ { "source": "/api/chat", "function": { "functionId": "chat", "region": "us-central1" } }, { "source": "/version", "destination": "/version.txt" }, - { "source": "**", "destination": "/index.html" } + { "regex": "^/features/?$", "destination": "/pages/features.html" }, + { "regex": "^/pricing/?$", "destination": "/pages/pricing.html" }, + { "regex": "^/faq/?$", "destination": "/pages/faq.html" }, + { "regex": "^/nexus/?$", "destination": "/pages/nexus.html" }, + { "regex": "^/security-knowledge/?$", "destination": "/pages/security-knowledge.html" }, + { "regex": "^/darknode-os/?$", "destination": "/pages/darknode-os.html" }, + { "regex": "^/government/?$", "destination": "/pages/government.html" }, + { "regex": "^/crosswalk/?$", "destination": "/pages/crosswalk.html" }, + { "regex": "^/terms/?$", "destination": "/pages/terms.html" }, + { "regex": "^/privacy/?$", "destination": "/pages/privacy.html" }, + { "regex": "^/acceptable-use/?$", "destination": "/pages/acceptable-use.html" }, + { "regex": "^/(?:console(?:/|$))?(?:(?:area|personal|enterprise)/[\\w-]+|check/[^/]+|tool-[a-z0-9-]+|accessreview|activity|addressintel|admin|adversary|adversaryplaybook|aegis|ai|all-tools|api|apifuzzer|apikeys|apispec|apitester|asnexplorer|assistant|attacksim|audit|awareness|backupready|beta|binanalyze|breachclock|breachlookup|caaudit|cheats|citadel|cloud|cloudspend|cloudtrail|coder|codescan|compliance|compliance-center|con|connections|cookieinspect|correlations|corstester|cracklab|credaudit|crosswalk|crucible|cryptotools|cspevaluator|cvesearch|cvetimeline|cvsscalc|cyberbriefing|cyberrange|darknetradar|dataflow|dataviz|deadlines|deception|device|dlguide|dlp|dmarcreports|dns|dnshunt|docs|domainguard|dossier|downloads|education|emailauth|emailheader|embedsdk|encoding|engine|engines|enterprise|evidence|exploitdb|exploitdev|favicon|fedcompliance|findings|firewall|fleetcomply|forensicstoolkit|ftimeline|fwaudit|ghdb|hashsuite|headeranalyzer|home|huntlab|hydra|iacscan|identitymatrix|incidentcost|incidents|inventory|invest|investigation|investigations|iocenrich|jml|k8saudit|leakprobe|learn|learndo|leetspeak|licenseaudit|loganalyze|loghunt|malclass|math|mcpconnect|memforensics|mobilesec|monitors|navarch|netexposure|netmap|networkscanner|networktools|nhi|oauthgov|oracle|osint|overview|packetanalyzer|packetcraft|payees|payloadgen|payloads|payloadstudio|pentestconsole|pentestreg|personal|phantom|phishtriage|plans|posture|privatecloud|privaudit|privesc|prometheus|proxyhunt|reconplanner|refs|regexlab|report|reports|reverseshell|riskreg|secdash|secgraph|secquiz|securitytxt|sentineleye|settings|setup|sigma|signins|snippets|socialeng|spectre|sslinspector|stego|strongroom|subdomains|supplychain|surface|targets|team|techfingerprint|threat|threatforest|threatmodel|tlsfleet|toolbox|toolkit|tools|urldissect|vanguard|veil|vendorrisk|vmlab|vpnaudit|vulndb|vulnimport|wayback|websockettester|wirelesslab|xsslab|yarabuilder|zerotrust)?/?$", "destination": "/index.html" } ], "headers": [ { diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 00000000..e0e0e6d7 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/css/landing-polish.css b/public/css/landing-polish.css index 8d1d9417..c8934842 100644 --- a/public/css/landing-polish.css +++ b/public/css/landing-polish.css @@ -80,7 +80,7 @@ html body.landing .lf-bottom { /* ---- Dedicated pages (/features, /pricing, /faq ...) ---- */ /* Public legal pages (/terms, /privacy, /acceptable-use): readable long-form text */ html body.landing .dn-legal { max-width: 820px; padding: 8px 0 56px; color: rgb(39, 39, 42); font-size: .95rem; line-height: 1.7; } -html body.landing .dn-legal h3 { font-size: 1.6rem; margin: 8px 0 12px; color: rgb(15, 23, 42); } +html body.landing .dn-legal h1, html body.landing .dn-legal h3 { font-size: 1.6rem; margin: 8px 0 12px; color: rgb(15, 23, 42); } html body.landing .dn-legal h4 { font-size: 1.02rem; margin: 26px 0 8px; color: rgb(15, 23, 42); } html body.landing .dn-legal ul { padding-left: 20px; } html body.landing .dn-legal li { margin: 4px 0; } @@ -99,3 +99,27 @@ html body.landing #nav-start { display: inline-flex !important; align-items: cen html body.landing .dn-notfound .wrap { max-width: 640px; margin: 0 auto; padding: 14vh 24px 16vh; box-sizing: border-box; } html body.landing .dn-notfound h1 { font-size: 2rem; margin: 0 0 12px; color: rgb(15, 23, 42); } html body.landing .dn-notfound p { margin: 0 0 24px; color: rgb(63, 63, 70); line-height: 1.6; overflow-wrap: anywhere; } +/* "Log in" is a button (keyboard reachable): no native button chrome */ +html body.landing button#nav-signin { background: #fff; font-family: inherit; font-size: .85rem; line-height: 1; cursor: pointer; } +/* Phones: Products / Features / Resources fold into one Menu panel (auth.js showLanding) */ +html body.landing .nav-mm-btn { display: none; } +html body.landing .nav-mm[hidden] { display: none !important; } +@media (max-width: 560px) { + html body.landing .nav-mm-btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; order: 1; width: 36px; height: 36px; padding: 0; margin-left: 2px; border: 1px solid #d4d4d4; border-radius: 6px; background: #fff; color: #18181b; cursor: pointer; } + html body.landing .nav-mm-btn[aria-expanded="true"] { background: #f5f5f5; } + html body.landing .nav-mm { position: fixed; left: 0; right: 0; top: 56px; bottom: 0; z-index: 1001; overflow-y: auto; overscroll-behavior: contain; background: #fff; border-top: 1px solid #e5e5e5; padding: 4px 16px 32px; box-sizing: border-box; } + html body.landing .nav-mm-grp h2 { font-size: .8rem; font-weight: 600; color: #71717a; margin: 18px 4px 4px; } + html body.landing .nav-mm .nav-dd-item { padding: 10px 8px; } + html body.landing .nav-mm-acts { display: flex; gap: 10px; margin-top: 22px; } + html body.landing .nav-mm-acts .btn { flex: 1; height: 44px; justify-content: center; } + html.nav-mm-open, html.nav-mm-open body { overflow: hidden; } +} +/* Narrow phones: "Log in" moves into the Menu so the header never overflows */ +@media (max-width: 389px) { + html body.landing #nav-signin { display: none !important; } +} + +/* Public tool and check pages: their own bar carries the top spacing (pro-theme .dn-pubtool / + domain-check .dn-checkpage set padding-top:0, which the landing .section padding outranked). */ +html[data-style="pro"] body.landing .section.dn-pubtool, +html[data-style="pro"] body.landing .section.dn-checkpage { padding-top: 0 !important; } diff --git a/public/humans.txt b/public/humans.txt index e57da4e4..3bb8fb1d 100644 --- a/public/humans.txt +++ b/public/humans.txt @@ -1,10 +1,9 @@ /* TEAM */ Platform: Darknode -Category: Cybersecurity Education +Category: Cybersecurity Site: https://darknode.ai -Description: Interactive cybersecurity education platform with AI tutoring, practice labs, and 164+ study tools. -Standards: NIST NICE Framework, NSA CAE-CD, CompTIA Security+ -Audience: Students, educators, IT professionals, security analysts +Description: Find the real risks in your domain, code and cloud: a free domain security check, then vulnerabilities in code, dependencies and cloud configuration ranked by live exploitation data. +Contact: contact@darknode.ai /* SITE */ -Software: Firebase, Vanilla JS, CesiumJS, Ollama AI +Software: Firebase Hosting, Cloudflare Workers, vanilla JavaScript diff --git a/public/icon-192.png b/public/icon-192.png new file mode 100644 index 00000000..65d03870 Binary files /dev/null and b/public/icon-192.png differ diff --git a/public/icon-512.png b/public/icon-512.png new file mode 100644 index 00000000..62d8ac55 Binary files /dev/null and b/public/icon-512.png differ diff --git a/public/icon.svg b/public/icon.svg new file mode 100644 index 00000000..402e28f4 --- /dev/null +++ b/public/icon.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/public/index.html b/public/index.html index 987a693c..617c3a41 100644 --- a/public/index.html +++ b/public/index.html @@ -3,38 +3,32 @@ - Darknode — Security & Data-Integrity Platform for Code, Cloud & AI - - + Darknode — Find the real risks in your domain, code and cloud + + - - - - - - - - - + - - + + - + + + - - + + - + diff --git a/public/js/auth.js b/public/js/auth.js index 9bfb4abf..416718b1 100644 --- a/public/js/auth.js +++ b/public/js/auth.js @@ -672,7 +672,7 @@ function showLanding() { - Log in - `; + + + + `; document.querySelectorAll(".nav-dd").forEach(dd => { const btn = dd.querySelector(".nav-dd-btn"); let closeTimer; @@ -713,6 +715,35 @@ function showLanding() { btn.addEventListener("click", (e) => { e.stopPropagation(); dd.classList.toggle("open"); }); }); document.addEventListener("click", () => document.querySelectorAll(".nav-dd.open").forEach(d => d.classList.remove("open"))); + // Phones: the three menus fold into one full-width panel behind a Menu button. + // (on : the header is a containing block for fixed children, which would clip the panel) + document.querySelectorAll("body > .nav-mm").forEach((el) => el.remove()); + const mm = document.getElementById("nav-mm"), mmBtn = document.getElementById("nav-menu"); + mm.innerHTML = [...document.querySelectorAll(".nav-dd")].map((dd) => '").join("") + + ''; + document.body.appendChild(mm); + const mmSet = (open) => { + mm.hidden = !open; + mmBtn.setAttribute("aria-expanded", String(open)); + document.documentElement.classList.toggle("nav-mm-open", open); + if (open) { const tb = document.getElementById("topbar"); mm.style.top = (tb ? Math.round(tb.getBoundingClientRect().bottom) : 56) + "px"; } + }; + mmBtn.addEventListener("click", (e) => { e.stopPropagation(); mmSet(mm.hidden); if (!mm.hidden) { const first = mm.querySelector("a,button"); if (first) first.focus(); } }); + mm.addEventListener("click", (e) => { + const act = e.target.closest("[data-mm]"); + if (act) { mmSet(false); renderAuth(act.dataset.mm); return; } + if (e.target.closest(".nav-dd-item")) mmSet(false); + }); + document.addEventListener("keydown", (e) => { + if (mm.hidden || !mm.isConnected) return; + if (e.key === "Escape") { mmSet(false); mmBtn.focus(); return; } + // Tab stays in the open menu and its Menu button (the page behind is covered) + if (e.key !== "Tab") return; + const ring = [mmBtn, ...mm.querySelectorAll("a,button")], i = ring.indexOf(document.activeElement); + e.preventDefault(); + ring[(i < 0 ? 0 : i + (e.shiftKey ? ring.length - 1 : 1)) % ring.length].focus(); + }); + matchMedia("(min-width: 561px)").addEventListener("change", (q) => { if (q.matches) mmSet(false); }); document.querySelectorAll(".nav-dd-item[data-nav]").forEach(item => { item.addEventListener("click", (e) => { e.preventDefault(); diff --git a/public/js/check/check-view.js b/public/js/check/check-view.js index 5e253249..f744b60a 100644 --- a/public/js/check/check-view.js +++ b/public/js/check/check-view.js @@ -45,7 +45,7 @@ export function renderResult(res, { running = false, toolLabel = null } = {}) { const parts = [`${n.pass} passed`, `${n.warn} warning${n.warn === 1 ? "" : "s"}`, `${n.fail} failed`]; if (n.error) parts.push(`${n.error} could not be checked`); if (n.na) parts.push(`${n.na} not applicable`); - const scoreLine = !graded ? "Reading public DNS records and HTTP responses. Each row fills in as its source answers." + const scoreLine = !graded ? "Reading public DNS records, HTTP responses and certificate logs. Each row fills in as its source answers." : res.score == null ? "Too few checks could run to grade this domain." : `${res.score} out of 100 · ${parts.join(" · ")}`; const how = `Each check is worth the points shown. A pass earns all of them, a warning half, a fail none. Checks that could not run or do not apply are left out${graded && res.possible < 100 ? `, so this grade is based on ${fmt(res.possible)} of 100 points` : ""}.`; diff --git a/public/js/check/domain-check.js b/public/js/check/domain-check.js index e6bb7b3b..3aaef2ba 100644 --- a/public/js/check/domain-check.js +++ b/public/js/check/domain-check.js @@ -7,6 +7,7 @@ // posture-engine.js HSTS and security-header grading (the External Posture tool) // domainguard-engine.js DoH answer parsing, CAA records, registrable domain // security-txt.js RFC 9116 validation (the security.txt tool) +// ct-fetch.js certificate-transparency rows (crt.sh, Cert Spotter fallback) // DNS goes straight to public DNS-over-HTTPS (Cloudflare, then Google). Web requests go // through the Darknode fetch proxy (net.js dnFetch), which reads public responses only. // @@ -19,7 +20,7 @@ // test/check/domain-check.test.mjs with the network injected. import { analyzeSPF, analyzeDMARC, analyzeDKIM, DEFAULT_SELECTORS } from "../email-auth.js?v=1"; -import { gradeTransport, gradeHeaders, letterGrade } from "../dataprotect/posture-engine.js?v=1"; +import { gradeTransport, gradeHeaders, letterGrade, newestCert, certDaysLeft } from "../dataprotect/posture-engine.js?v=1"; import { dohStatus, rrData, txtStrings, parseCaaData, parseMx, registrableDomain, toAsciiDomain, isDomainName } from "../exposure/domainguard-engine.js?v=1"; import { validateSecurityTxt } from "../security-txt.js?v=1"; @@ -38,13 +39,14 @@ export const CHECKS = [ { id: "dmarc", group: "email", label: "DMARC policy", weight: 12, tool: "emailauth" }, { id: "dkim", group: "email", label: "DKIM", weight: 6, tool: "emailauth" }, { id: "mx", group: "email", label: "Mail servers (MX)", weight: 4, tool: "dns" }, - { id: "https", group: "https", label: "HTTPS", weight: 12, tool: "headeranalyzer" }, - { id: "redirect", group: "https", label: "HTTP to HTTPS redirect", weight: 8, tool: "headeranalyzer" }, + { id: "https", group: "https", label: "HTTPS", weight: 10, tool: "headeranalyzer" }, + { id: "redirect", group: "https", label: "HTTP to HTTPS redirect", weight: 7, tool: "headeranalyzer" }, + { id: "cert", group: "https", label: "Certificate expiry", weight: 6, tool: "sslinspector" }, { id: "hsts", group: "headers", label: "HSTS", weight: 8, tool: "headeranalyzer" }, - { id: "csp", group: "headers", label: "Content-Security-Policy", weight: 8, tool: "headeranalyzer" }, - { id: "frame", group: "headers", label: "Frame protection", weight: 5, tool: "headeranalyzer" }, + { id: "csp", group: "headers", label: "Content-Security-Policy", weight: 7, tool: "headeranalyzer" }, + { id: "frame", group: "headers", label: "Frame protection", weight: 4, tool: "headeranalyzer" }, { id: "nosniff", group: "headers", label: "X-Content-Type-Options", weight: 4, tool: "headeranalyzer" }, - { id: "referrer", group: "headers", label: "Referrer-Policy", weight: 3, tool: "headeranalyzer" }, + { id: "referrer", group: "headers", label: "Referrer-Policy", weight: 2, tool: "headeranalyzer" }, { id: "dnssec", group: "dns", label: "DNSSEC", weight: 7, tool: "dns" }, { id: "caa", group: "dns", label: "CAA records", weight: 7, tool: "dns" }, { id: "securitytxt", group: "disclosure", label: "security.txt", weight: 6, tool: "securitytxt" }, @@ -128,6 +130,18 @@ async function defaultFetch(url, opts) { return dnFetch(url, opts); } +// Certificate-transparency rows covering a host (ct-fetch.js: crt.sh, then Cert Spotter), capped +// so a slow log never holds the whole check: past the cap the check is "error", not graded. +export const CERT_TIMEOUT_MS = 15000; +async function defaultCertRows(host) { + const { fetchCertRows } = await import("/js/dataprotect/ct-fetch.js?v=20261029e"); + return fetchCertRows(host); +} +function withTimeout(p, ms, why) { + let t; + return Promise.race([p, new Promise((_, rej) => { t = setTimeout(() => rej(new Error(why)), ms); })]).finally(() => clearTimeout(t)); +} + const msgOf = (e) => String((e && e.message) || e || "unknown error").replace(/\.+$/, ""); // A failure of the proxy itself (or the site refusing the proxy) says nothing about the @@ -156,6 +170,8 @@ function dnsRes(r) { } const STATUS = { PASS: "pass", WARN: "warn", FAIL: "fail" }; +// A CT timestamp in ms: crt.sh writes zoneless ISO ("2026-01-14T23:59:59"), which is UTC. +const ctTime = (s) => { s = String(s || ""); return Date.parse(/^\d{4}-\d\d-\d\d[T ]\d\d:\d\d(:\d\d(\.\d+)?)?$/.test(s) ? s.replace(" ", "T") + "Z" : s); }; // The fix for a problem email-auth.js reports in a record that exists, keyed on its wording. const SPF_FIXES = [ [/SPF records \(v=spf1\) are published/, "Merge them into a single v=spf1 record."], @@ -288,6 +304,32 @@ const EVAL = { if (/^https:/i.test(fin)) return { status: "pass", detail: `http:// redirects to ${clip(fin.replace(/^(https:\/\/[^/]+).*$/i, "$1"), 80)}.`, fix: "" }; return { status: "fail", detail: `http:// serves the site without moving to HTTPS (HTTP ${h.value.status | 0}).`, fix: "Answer every http:// request with a 301 redirect to the same path on https://." }; }, + cert(o) { + const g = webGate(o); + if (g) return g; + const r = o.cert; + if (!r) return PENDING; + if (r.error) return err("the certificate logs", r.error); + const rows = r.value || []; + if (rows.unreachable) return err("the certificate logs", "neither crt.sh nor Cert Spotter answered"); + const now = o.now || Date.now(); + const c = newestCert(rows, now); + const days = c ? certDaysLeft(c.notAfter, now) : null; + // nothing logged says nothing certain (a private CA, or a name the logs file differently) + if (days == null) return err("the certificate logs", `no certificate for ${o.webHost} is logged`); + const tAfter = ctTime(c.notAfter), tBefore = ctTime(c.notBefore); + const until = isNaN(tAfter) ? String(c.notAfter).slice(0, 10) : new Date(tAfter).toISOString().slice(0, 10); + const by = c.issuer ? ` (${clip(String(c.issuer).replace(/^.*\bO=("?)([^,"]+)\1.*$/, "$2"), 50)})` : ""; + const fix = "Renew the certificate now, and check that automatic renewal (your ACME client or host's setting) is running."; + if (days < 0) return { status: "fail", detail: `The newest logged certificate for ${o.webHost}${by} expired on ${until}.`, fix }; + // bands follow the certificate's own lifetime, so 90-day and short-lived certificates renewing on schedule are not flagged + const life = isNaN(tAfter) || isNaN(tBefore) ? null : (tAfter - tBefore) / 86400000; + const lifeDays = life && life > 0 ? life : 90; + const left = days === 0 ? "less than a day" : days === 1 ? "1 day" : days + " days"; + if (days < Math.min(7, lifeDays * 0.1)) return { status: "fail", detail: `The newest logged certificate for ${o.webHost}${by} expires in ${left}, on ${until}.`, fix }; + if (days < Math.min(21, lifeDays * 0.25)) return { status: "warn", detail: `The newest logged certificate for ${o.webHost}${by} expires in ${left}, on ${until}, later than renewal usually happens.`, fix: "Renew the certificate before then, and check that automatic renewal (your ACME client or host's setting) is running." }; + return { status: "pass", detail: `The newest logged certificate for ${o.webHost}${by} is valid until ${until} (${left}).`, fix: "" }; + }, hsts(o) { const src = headerSource(o); if (!src.status && !src.secure) return { status: "fail", detail: "The site was only reachable over plain HTTP, and browsers ignore HSTS there.", fix: "Serve the site over HTTPS and send Strict-Transport-Security with max-age of at least 15552000." }; @@ -436,14 +478,14 @@ const lookupFailed = (r) => !r || !!r.error || !["ok", "nxdomain"].includes(dohS /** * Run the check. onProgress(result) fires as each source lands, with pending checks. - * deps: { doh(name, type, {cd}), fetchUrl(url, opts) } for tests; defaults are live. + * deps: { doh(name, type, {cd}), fetchUrl(url, opts), certRows(host), now } for tests; defaults are live. * @returns {Promise<{domain, webHost, grade, score, earned, possible, checks, counts, ranAt}>} */ -export async function runDomainCheck(input, { onProgress, doh = dohJSON, fetchUrl = defaultFetch } = {}) { +export async function runDomainCheck(input, { onProgress, doh = dohJSON, fetchUrl = defaultFetch, certRows = defaultCertRows, certTimeoutMs = CERT_TIMEOUT_MS, now } = {}) { const domain = normalizeDomain(input); if (!domain) throw new Error("Enter a domain name, like example.com."); const org = registrableDomain(domain); - const obs = { domain, org, webHost: domain, web: "pending" }; + const obs = { domain, org, webHost: domain, web: "pending", now }; const result = () => { const checks = evaluate(obs); const g = gradeChecks(checks); @@ -479,6 +521,7 @@ export async function runDomainCheck(input, { onProgress, doh = dohJSON, fetchUr track("https", settleWeb(fetchUrl("https://" + obs.webHost + "/", { timeout: 15000 }))); track("http", settleWeb(fetchUrl("http://" + obs.webHost + "/", { timeout: 15000 }))); track("stxt", settle(fetchSecurityTxt(fetchUrl, obs.webHost))); + track("cert", settle(withTimeout(Promise.resolve().then(() => certRows(obs.webHost)), certTimeoutMs, "the certificate logs did not answer within " + Math.round(certTimeoutMs / 1000) + " seconds"))); } await Promise.all(jobs); return result(); @@ -486,7 +529,7 @@ export async function runDomainCheck(input, { onProgress, doh = dohJSON, fetchUr // ---- findings (the Deck sink kit) ----------------------------------------------------------- -const HIGH_ON_FAIL = new Set(["https", "dmarc", "spf"]); +const HIGH_ON_FAIL = new Set(["https", "cert", "dmarc", "spf"]); const fid = (domain, id) => `domaincheck|${domain}|${id}`; // Failing and warning checks -> common Finding shape (core/sink-map.js). Ids are stable, diff --git a/public/js/check/first-run.js b/public/js/check/first-run.js index 3c78ef75..1bb9f694 100644 --- a/public/js/check/first-run.js +++ b/public/js/check/first-run.js @@ -83,6 +83,10 @@ function watchHtml() { : `Its certificate (expiry within 21 days) and its email/DNS records (SPF, DMARC, MX, CAA) are checked once a day. ${where} Turn the watch off any time under Monitors.`; return `
${head} ${body}
${goBtn("monitors", "Open Monitors")}
`; } + if (w.state === "guest") { + return `
Watching a domain needs a free account. Alerts go to the account's verified email address, so Test Mode cannot hold a watch. Create a free account and ${esc(d)} is checked again when the Deck first opens, ready to watch.
+
`; + } if (w.state === "conflict") { return `
Your Free plan already watches ${esc(w.other)}. The Free plan watches one domain. To watch ${esc(d)} instead, delete the watch on ${esc(w.other)} under Monitors, or request an upgrade under Plans.
${goBtn("monitors", "Open Monitors")}${goBtn("plans", "See Plans")}
`; @@ -95,6 +99,8 @@ async function watchDomain() { if (!domain || S.running || (S.watch && S.watch.domain === domain && S.watch.state === "busy")) return; const free = isFree(); const set = (w) => { if (S.res && S.res.domain === domain) { S.watch = { domain, ...w }; paint(); } }; + // a Test Mode / guest session has no account to alert: offer the sign-up instead of a call that cannot succeed + if (isTestIdentity(S.ctx && S.ctx.user)) return set({ state: "guest" }); set({ state: "busy" }); try { const { monitorApi } = await import("/js/deck/monitor-client.js?v=1"); @@ -118,10 +124,19 @@ async function watchDomain() { set({ state: "on", already: !made.length, paused: all.some((m) => m.paused), to: mail ? mail.to : "", emailAll: all.every((m) => (m.channels || []).some((c) => c.type === "email")) }); } catch (e) { const msg = (e && e.message) || "The watch could not be set up. Try again."; - set({ state: "error", plan: !!(e && e.plan), msg: !(e && e.status) && /^Sign in/.test(msg) ? "Sign in with your own account to watch a domain. Alerts go to its verified email address." : msg }); + if (!(e && e.status) && /^Sign in/.test(msg)) return set({ state: "guest" }); + set({ state: "error", plan: !!(e && e.plan), msg }); } } +// Leave the guest session for the sign-up form (auth.js opens it on /?signup=1), keeping the +// domain so the Deck checks it again on first open and the watch is one click away. +function toSignup(domain) { + try { localStorage.setItem(FIRST_DOMAIN_KEY, domain); } catch (_) {} + try { sessionStorage.removeItem("dn_guest"); } catch (_) {} + location.assign("/?signup=1"); +} + function savedHtml(sv) { const c = S.ctx || {}; const where = c.isLocked && !c.isLocked("scene:findings") ? { act: "findings", label: "Open findings" } @@ -179,7 +194,7 @@ export function mountFirstRun(slot, ctx) { S.slot = slot; S.ctx = ctx; const chip = isTestIdentity(ctx.user) ? "" : workDomainFromEmail(ctx.user && ctx.user.email); slot.innerHTML = `
-
Start with your domain

See where you stand before setting anything up: email authentication, HTTPS, security headers, DNS hardening and security.txt, read live from public records.

+
Start with your domain

See where you stand before setting anything up: email authentication, HTTPS, certificate expiry, security headers, DNS hardening and security.txt, read live from public records.

${chip ? `
From your sign-up email:
` : ""}

Use a domain you own or manage. The result is saved to this workspace, with each issue as a finding.

@@ -196,6 +211,7 @@ export function mountFirstRun(slot, ctx) { if (t.dataset.frDomain && !S.running) run(t.dataset.frDomain); else if (t.dataset.dmcTool && S.ctx.openTool) S.ctx.openTool(t.dataset.dmcTool); else if (t.dataset.frWatch) watchDomain(); + else if (t.dataset.frSignup && S.res) toSignup(S.res.domain); else if (t.dataset.frGo === "secgraph" && S.ctx.openTool) S.ctx.openTool("secgraph"); else if (t.dataset.frGo && S.ctx.go) S.ctx.go(t.dataset.frGo); }); diff --git a/public/js/check/landing-check.js b/public/js/check/landing-check.js index 2704e4ac..25dc06dd 100644 --- a/public/js/check/landing-check.js +++ b/public/js/check/landing-check.js @@ -22,6 +22,7 @@ function setNoindex() { let robots = document.querySelector('meta[name="robots"]'); if (!robots) { robots = document.createElement("meta"); robots.name = "robots"; document.head.appendChild(robots); } robots.content = "noindex"; + const canon = document.querySelector('link[rel="canonical"]'); if (canon) canon.remove(); // a noindex page names no canonical } async function copyLink(btn, domain) { @@ -111,12 +112,12 @@ function mountCheckPage(view, actions, raw) { page.innerHTML = `
Back to homeFree to use, no account needed.

Domain check

-

Run live in your browser when this page opened, from public DNS records and HTTP responses. Nothing about it is stored, so the link always shows the current state.

+

Run live in your browser when this page opened, from public DNS records, HTTP responses and certificate logs. Nothing about it is stored, so the link always shows the current state.

-

Reads public DNS records and HTTP headers only. Use a domain you own or are allowed to assess.

+

Reads public DNS records, HTTP headers and certificate logs only. Use a domain you own or are allowed to assess.

`; diff --git a/public/js/docs.js b/public/js/docs.js index f93689e0..9b0925b0 100644 --- a/public/js/docs.js +++ b/public/js/docs.js @@ -32,7 +32,7 @@ const STANDOUT = [ ]; const CHANGELOG = [ - ["3.3.x", "Live integrations: Deck security integrations are connected only after a live key test, through a relay to fixed provider endpoints (VirusTotal, Shodan, AbuseIPDB, GreyNoise, OTX, urlscan, SecurityTrails, ipinfo, Have I Been Pwned, Hunter, Pulsedive, Hybrid Analysis, plus keyless NVD and CIRCL CVE). The Deck Assistant can run lookups on connected integrations, asking first each time unless you choose Always allow. Text boxes no longer refill from saved lists on reload; a Load saved list button brings them back on request. A full bug sweep fixed about 90 issues across the Deck, the business tools, the flagship tools and all 780 quick utilities, among them wrong file hashes for binary files, a strict CSP graded as broken, missed SQL injection and display-name spoofing, the ASN Explorer (moved from the retired BGPView to RIPEstat), and spreadsheet formula injection in CSV exports. Nexus background sessions (nexus bg / attach / sessions); signed-in Nexus and desktop app report version, OS and VM counts every 6 hours (/shareusage off, or Settings > Share app usage). Docs: the Nexus Commands tab lists every Nexus command, and Cost Saving shows /cheap before-and-after costs on each Claude model, measured on real sessions. A free domain check on the home page, with no sign-up, grades email authentication, HTTPS, security headers, DNSSEC, CAA and security.txt and shows what each check is worth; a /check/your-domain link runs it again live, and a new Deck opens on the same check with each issue saved as a finding. The Free plan now watches one domain: after a check, Watch this domain checks its certificate expiry and its email/DNS records (SPF, DMARC, MX, CAA) once a day and emails your verified account address when something changes, with what changed, why it matters and the exact fix (at most 5 alert emails a day, each with a stop link). Monitors can also email your account address on Pro and above. Deadlines: a Deadlines page and an Overview block list the clocks your findings start, soonest first with the time left: a watched certificate's expiry and, only if you opt in, the Cyber Resilience Act Article 14 reporting clocks (early warning 24 hours and vulnerability notification 72 hours after you become aware of an actively exploited vulnerability in an asset you mark as shipped in a product, final report 14 days after a fix is available) and CISA BOD 22-01 due dates. Alerts go out when a clock starts and when a quarter of its time is left, and a certificate's last-week re-alert is now that reminder. A Copy early-warning facts panel lists the CVE, the product, when exploitation was confirmed, when you became aware, the Member States and the measures known. Darknode does not decide whether these rules apply and does not submit anything."], + ["3.3.x", "Live integrations: Deck security integrations are connected only after a live key test, through a relay to fixed provider endpoints (VirusTotal, Shodan, AbuseIPDB, GreyNoise, OTX, urlscan, SecurityTrails, ipinfo, Have I Been Pwned, Hunter, Pulsedive, Hybrid Analysis, plus keyless NVD and CIRCL CVE). The Deck Assistant can run lookups on connected integrations, asking first each time unless you choose Always allow. Text boxes no longer refill from saved lists on reload; a Load saved list button brings them back on request. A full bug sweep fixed about 90 issues across the Deck, the business tools, the flagship tools and all 780 quick utilities, among them wrong file hashes for binary files, a strict CSP graded as broken, missed SQL injection and display-name spoofing, the ASN Explorer (moved from the retired BGPView to RIPEstat), and spreadsheet formula injection in CSV exports. Nexus background sessions (nexus bg / attach / sessions); signed-in Nexus and desktop app report version, OS and VM counts every 6 hours (/shareusage off, or Settings > Share app usage). Docs: the Nexus Commands tab lists every Nexus command, and Cost Saving shows /cheap before-and-after costs on each Claude model, measured on real sessions. A free domain check on the home page, with no sign-up, grades email authentication, HTTPS, certificate expiry (from certificate transparency logs), security headers, DNSSEC, CAA and security.txt and shows what each check is worth; a /check/your-domain link runs it again live, and a new Deck opens on the same check with each issue saved as a finding. The Free plan now watches one domain: after a check, Watch this domain checks its certificate expiry and its email/DNS records (SPF, DMARC, MX, CAA) once a day and emails your verified account address when something changes, with what changed, why it matters and the exact fix (at most 5 alert emails a day, each with a stop link). Monitors can also email your account address on Pro and above. Deadlines: a Deadlines page and an Overview block list the clocks your findings start, soonest first with the time left: a watched certificate's expiry and, only if you opt in, the Cyber Resilience Act Article 14 reporting clocks (early warning 24 hours and vulnerability notification 72 hours after you become aware of an actively exploited vulnerability in an asset you mark as shipped in a product, final report 14 days after a fix is available) and CISA BOD 22-01 due dates. Alerts go out when a clock starts and when a quarter of its time is left, and a certificate's last-week re-alert is now that reminder. A Copy early-warning facts panel lists the CVE, the product, when exploitation was confirmed, when you became aware, the Member States and the measures known. Darknode does not decide whether these rules apply and does not submit anything."], ["3.2.x", "Business security platform: the Darknode Deck with native Personal and Organization spaces (domain posture grading, certificate watch, link and email phishing checks, code-secret scanning, sensitive-data checks with redaction, domain portfolios and fleet views), a Web toolkit tab linking the hands-on web-security tools, plan-based tool availability, team workspaces, and removal of the off-topic financial tools."], ["3.1.x", "Web console line: flagship platforms (PHANTOM packet/network ops, CITADEL SOC console, ORACLE threat-intel engine, SPECTRE cloud posture, CRUCIBLE defensive wargaming, NAVARCH maritime defense), a platform-wide Security Graph that cross-links findings, the Sentinel Eye 3D threat globe, 125 security tools plus 780 quick utilities, the Professional theme, the Darknode assistant (Help button in the top bar), and Nexus AI integration."], ["2.29.x", "Nexus multi-engine agent: /cowork model tiering, /lean /effort /cheap /estimate, local RAG (/index), /race /ensemble /bench, /plan /watch /agents (worktree-isolated), /guard /secrets /scan /redact /offline, git checkpoints (/undo /redo /rewind), MCP + hooks, ~56 commands. NEXUS.md now reaches the Claude engine; plan mode is truly read-only."], @@ -120,7 +120,7 @@ node darknode.js nexus init # optional: scaffold .nexus/ project
Where did the console go?

The Darknode Deck is the workspace after you sign in, and every tool opens inside it: use the sidebar or Ctrl K search. The older console view has been retired for users; a link to a tool (darknode.ai/<tool>) opens that tool in the Deck.

Which tools do I get on my plan?

Tools are shown according to your plan; anything outside your plan is simply not listed. Free covers the Personal space and platform basics; Pro adds exposure, application-security and reporting tools; Team adds the Organization space, identity and security-operations tools and team workspaces; Enterprise adds risk and compliance tooling.

Do the checks touch my systems?

The domain and certificate checks read only public signals (HTTP headers, DNS, certificate transparency, security.txt). Secret and sensitive-data checks run entirely in your browser. The Web toolkit's API, WebSocket and fuzzing tools do send requests to the target you name, so use them only on systems you own or are authorized to test.

-
What does the free domain check on the home page look at?

Fourteen checks worth 100 points in total, read live from public DNS and HTTP responses: email authentication (SPF 10, DMARC policy 12, DKIM 6, mail servers 4), HTTPS (HTTPS 12, HTTP to HTTPS redirect 8), security headers (HSTS 8, Content-Security-Policy 8, frame protection 5, X-Content-Type-Options 4, Referrer-Policy 3), DNS hardening (DNSSEC 7, CAA 7) and security.txt (6). A pass earns a check's points, a warning half, a fail none. A check that could not run is shown as not checked and left out of the grade rather than counted as a pass or a zero, and the grade (A 90, B 80, C 65, D 50) says how many of the 100 points it covers. It needs no account and stores nothing: a /check/your-domain link runs the check again when it is opened. In the Deck the same check saves each issue as a finding and links the tool that fixes it. It runs once each time. To keep watching a domain, choose Watch this domain after a check in the Deck (see below).

+
What does the free domain check on the home page look at?

Fifteen checks worth 100 points in total, read live from public DNS, HTTP responses and certificate transparency logs: email authentication (SPF 10, DMARC policy 12, DKIM 6, mail servers 4), HTTPS (HTTPS 10, HTTP to HTTPS redirect 7, certificate expiry 6), security headers (HSTS 8, Content-Security-Policy 7, frame protection 4, X-Content-Type-Options 4, Referrer-Policy 2), DNS hardening (DNSSEC 7, CAA 7) and security.txt (6). A pass earns a check's points, a warning half, a fail none. A check that could not run is shown as not checked and left out of the grade rather than counted as a pass or a zero, and the grade (A 90, B 80, C 65, D 50) says how many of the 100 points it covers. It needs no account and stores nothing: a /check/your-domain link runs the check again when it is opened. In the Deck the same check saves each issue as a finding and links the tool that fixes it. It runs once each time. To keep watching a domain, choose Watch this domain after a check in the Deck (see below).

What does the Free plan's domain watch do?

A Free account can watch one domain. After a domain check in the Deck, Watch this domain sets up two monitors on it: certificate expiry (from certificate transparency logs, warning 21 days ahead) and email/DNS changes (SPF, DMARC, MX and CAA, read over public DNS). They run on our servers once a day, also when the Deck is closed. When something changes, or a certificate is close to expiry, an email goes to your verified account address only, saying what changed, why it matters and the exact fix, with a link to Monitors in the Deck. The first check can also email you about a serious problem it finds straight away. A certificate close to expiry is also listed under Deadlines, and you get one reminder when a quarter of the time to expiry is left. You get at most 5 alert emails a day; anything after that is listed under Monitors. Turn the watch off under Monitors, or use the stop link in any alert email. Watching more domains, known-exploited CVE watches and Slack, Teams or webhook alerts are part of Pro.

What are Deadlines, and does Darknode file Cyber Resilience Act reports?

Deadlines lists the clocks your findings start, soonest first, with the time left (overdue ones in red) and the steps for each. A certificate your monitors see expiring is one, on every plan: it is due when the certificate expires and closes by itself when the monitor sees the renewed one. On Pro, two opt-ins under Deadlines add more, and nothing is assumed without them. Cyber Resilience Act: tick "We make products with digital elements sold in the EU" and mark the assets or components (from your Security Graph, including SBOM imports) that are shipped in a product. When your known-exploited CVE monitor finds a CISA KEV vulnerability in one of them, three clocks start, from Regulation (EU) 2024/2847 Article 14(2): an early warning within 24 hours of becoming aware, a vulnerability notification within 72 hours, and a final report no later than 14 days after a fix or mitigation is available (that clock starts when you mark the fix available). Becoming aware starts as the time Darknode alerted you; you can correct it. Article 14 applies from 11 September 2026, and the notifications go to your coordinating CSIRT and ENISA through ENISA's single reporting platform. BOD 22-01: tick "We follow CISA BOD 22-01" and each known-exploited CVE in your inventory gets the KEV catalogue's due date. Alerts go to the monitor's channels when a clock starts and when a quarter of its time is left. Cyber Resilience Act alert emails do not count against the 5 a day for monitor alerts; they have their own limit of 20 a day. Darknode does not decide whether the Cyber Resilience Act or BOD 22-01 applies to you and does not submit anything: it tracks the clocks and prepares the facts (Copy early-warning facts), and you decide and file.

Do I need an API key for Nexus?

No. The Claude engine drives your logged-in Claude Code CLI; the local engine talks to your own Ollama. Nexus stores no keys.

diff --git a/public/js/landing.js b/public/js/landing.js index 1847411c..d9399b7d 100644 --- a/public/js/landing.js +++ b/public/js/landing.js @@ -5,6 +5,7 @@ import { db } from "/js/firebase.js?v=20261021a"; import { collection, addDoc, serverTimestamp } from "https://www.gstatic.com/firebasejs/12.17.0/firebase-firestore.js"; import { mountLandingCheck } from "/js/check/landing-check.js?v=1"; +import { HOME, PAGES, applyPageMeta } from "/js/site-meta.js?v=1"; const GITHUB = "https://github.com/Darknode-Official"; @@ -98,7 +99,7 @@ const CHECKS = [ // pricing cards and the docs FAQ "Which tools do I get on my plan?". const FAQ = [ ["What is free, and how do paid plans work?", - "Free includes the Quick Checks (email security, website headers, certificates, DNS, breaches and CVEs), the Personal space, the live vulnerability feed, a local security graph and case files, the free browser tools in the Tool Library, and the Darknode assistant with 50 messages a day. The CLI is free to run from source. Pro adds the Exposure and Application Security tools, saved findings and reports, premium AI models and cloud sync; Team adds the Organization space, identity and security-operations tools and shared workspaces; Enterprise adds risk and compliance tooling. Tools outside your plan are simply not shown. Paid plans are in preview: checkout is not live yet, so upgrades are requested and granted by hand and no payment is taken."], + "Free includes the Quick Checks (email security, website headers, certificates, DNS, breaches and CVEs), the Personal space, the live vulnerability feed, a local security graph and case files, the free browser tools in the Tool Library, one watched domain with email alerts, and the Darknode assistant with 50 messages a day. The CLI is free to run from source. Pro adds the Exposure and Application Security tools, saved findings and reports, premium AI models, cloud sync, monitors for more domains and known-exploited CVEs, and deadline clocks; Team adds the Organization space, identity and security-operations tools and shared workspaces, which the owner can let members use the owner’s plan in; Enterprise adds risk and compliance tooling. Tools outside your plan are simply not shown. Paid plans are in preview: checkout is not live yet, so upgrades are requested and granted by hand and no payment is taken."], ["Does our code or data leave our environment?", "Your saved findings stay in your browser unless you turn on cloud sync, a Pro feature. Code, cloud and infrastructure-as-code files you load are analysed on your device and are not uploaded to us; dependency checks send package names and versions to the public OSV database. Live checks against a domain (DNS, headers, certificate transparency) go through our edge proxy and are not stored. The built-in assistant sends your question through that proxy to the model you choose (Google Gemini on every plan, Anthropic Claude on Pro); we do not log or store prompts or answers. Nexus in the CLI can use a local Ollama model, so nothing leaves your machine."], ["Can I run Darknode offline or air-gapped?", @@ -127,9 +128,9 @@ const PAGE_ONLY = {
-
AI Assistant
-

Nexus — the assistant on top of your findings

-

The deterministic engines do the finding and ranking; Nexus turns those results into plain-English explanations, remediation steps, and draft reports. It runs on your choice of backend — Claude, GPT, Gemini, Groq, Mistral and OpenRouter in the cloud, or a fully local model via Ollama for teams that keep everything in-house.

+
Terminal coding agent
+

Nexus — one coding agent over six engines

+

Nexus is the coding agent in the Darknode CLI. It puts one interface, with shared sessions, memory and commands, over Claude Code, the Gemini CLI, Codex, OpenCode, Aider and local Ollama models. Use the engines you already have accounts for, or keep everything on your own machine with a local model.

@@ -577,13 +578,13 @@ export function renderLanding(view, actions) {
-
Deterministic · Explainable · Offline in the CLI and desktop app
+
Deterministic · Explainable · Offline CLI

Find the real risks in your
code

-

Darknode checks your domains, code, cloud, dependencies and configs for real vulnerabilities and risks, with deterministic engines that show how they reached each result. No black-box AI deciding severity. The CLI and desktop app run on your own machines and work offline with local Ollama models.

+

Darknode checks your domains, code, cloud, dependencies and configs for real vulnerabilities and risks, with deterministic engines that show how they reached each result. No black-box AI deciding severity. The CLI runs on your own machine and works offline with local Ollama models.

-

Free, no sign-up, results in seconds. Reads public DNS records and HTTP headers: email authentication, HTTPS, security headers, DNSSEC, CAA and security.txt.

+

Free, no sign-up, results in seconds. Reads public DNS, HTTP headers and certificate logs: email authentication, HTTPS, certificate expiry, security headers, DNSSEC, CAA and security.txt.

@@ -697,15 +698,16 @@ ${pageOnly}
Recommended
Pro
$29/user/month
-

Built for working security professionals.

+

For professionals who need history, exports and the strongest AI models.

  • Everything in Free, plus:
  • Exposure and Application Security tools, findings and reports
  • Unlimited saved findings & reports
  • Premium AI models: Claude Fable 5.1, Claude Opus 5.5, Darknode Max
  • 500 AI messages a day (150 on Claude)
  • -
  • Known-exploited CVE monitors, with Cyber Resilience Act and BOD 22-01 deadline clocks
  • Cloud sync across devices
  • +
  • Monitors for more domains and known-exploited CVEs, with Slack, Teams and webhook alerts
  • +
  • Cyber Resilience Act and BOD 22-01 deadline clocks for known-exploited CVEs, if you opt in
  • Email support
@@ -713,11 +715,12 @@ ${pageOnly}
Team
$79/user/month
-

Shared findings and workflow for a security team.

+

Shared workspaces, roles and one audit trail for the whole team.

  • Everything in Pro, plus:
  • Organization space, Identity, Security Operations, Fraud & Abuse
  • Shared team workspaces & roles
  • +
  • Optionally share your plan with workspace members
  • 1,000 AI messages a day per user
  • Integrations (ticketing, chat webhooks)
  • Activity & audit log
  • @@ -727,7 +730,7 @@ ${pageOnly}
    Enterprise
    Custom
    -

    Control, compliance, and scale for organizations.

    +

    Scale, compliance and deployment on your terms.

    • Everything in Team, plus:
    • Risk & Resilience and Compliance tools
    • @@ -836,7 +839,8 @@ ${pageOnly} const scrollToCta = () => { const el = view.querySelector(".cta-notify"); if (el) el.scrollIntoView({ behavior: "smooth", block: "center" }); const inp = $("cta-email"); if (inp) inp.focus({ preventScroll: true }); }; if ($("price-pro")) $("price-pro").onclick = scrollToCta; if ($("price-team")) $("price-team").onclick = scrollToCta; - if ($("price-enterprise")) $("price-enterprise").onclick = scrollToCta; + // Enterprise is a conversation, not a launch list: the same address the Deck's Plans page uses + if ($("price-enterprise")) $("price-enterprise").onclick = () => { location.href = "mailto:sales@darknode.ai?subject=" + encodeURIComponent("Darknode Enterprise enquiry"); }; // Animated counter for hero stats — scroll-triggered with easing const counterEls = view.querySelectorAll("[data-count]"); @@ -1120,8 +1124,9 @@ ${pageOnly} // /nexus, /security-knowledge, /darknode-os and /government are not on the home page at all: // PAGE_ONLY renders them only at their own path. const PAGE_ROUTES = { "/pricing": ["pricing", "start"], "/faq": ["faq"], "/features": ["features", "how", "products"], "/nexus": ["nexus"], "/security-knowledge": ["security-knowledge"], "/darknode-os": ["darknode-os"], "/government": ["government"] }; - const PAGE_TITLES = { "/pricing": "Pricing", "/faq": "FAQ", "/features": "Features", "/nexus": "Nexus", "/security-knowledge": "Security knowledge", "/darknode-os": "Darknode OS", "/government": "Government and regulated teams" }; const dedicated = PAGE_ROUTES[path]; + // title, description and canonical of this page (the same head the build serves it with) + if (PAGES[path]) applyPageMeta(path, PAGES[path]); else if (path === "/") applyPageMeta("/", HOME); if (dedicated) { view.querySelectorAll(".section, .hero, .cta-final").forEach(sec => { if (!dedicated.includes(sec.id)) sec.hidden = true; @@ -1139,7 +1144,6 @@ ${pageOnly} } // the home page shows the first six questions; /faq shows every one if (path === "/faq") { view.querySelectorAll("[data-faq-more]").forEach((el) => { el.hidden = false; }); if ($("faq-all")) $("faq-all").hidden = true; } - document.title = (PAGE_TITLES[path] || "Darknode") + " — Darknode"; window.scrollTo(0, 0); } else if (path === "/" && location.hash.length > 1) { // a link to a home section (/#pricing) lands on it: the section did not exist when the browser looked @@ -1164,7 +1168,6 @@ ${pageOnly} const mount = page.querySelector(".dn-pubmain"); // the page renders after load, so a #section link (security.txt's Policy) scrolls once it exists pub.load().then((render) => render(mount)).then(() => { const t = location.hash.length > 1 && document.getElementById(decodeURIComponent(location.hash.slice(1))); if (t) t.scrollIntoView(); }).catch(() => { mount.textContent = "Couldn't load this tool. Check your connection and reload."; }); - document.title = pub.title + " — Darknode"; window.scrollTo(0, 0); } @@ -1178,10 +1181,7 @@ ${pageOnly} page.innerHTML = '

      Page not found

      There is no page at . Check the address, or start from the home page.

      Go to the home page
      '; page.querySelector("code").textContent = location.pathname; view.prepend(page); - let robots = document.querySelector('meta[name="robots"]'); - if (!robots) { robots = document.createElement("meta"); robots.name = "robots"; document.head.appendChild(robots); } - robots.content = "noindex"; - document.title = "Page not found — Darknode"; + applyPageMeta(path, null); // noindex, no canonical window.scrollTo(0, 0); } } diff --git a/public/js/legal.js b/public/js/legal.js index 18f002f0..6b6b9704 100644 --- a/public/js/legal.js +++ b/public/js/legal.js @@ -127,5 +127,7 @@ export async function renderLegal(mount, id) { // The docs sections carry no heading of their own (the docs sidebar names them). // (the /acceptable-use page asks for the docs section id "aup") if (id !== "terms") html = "

      " + ({ privacy: "Privacy Policy", aup: "Acceptable Use Policy" }[id] || "") + "

      " + (id === "aup" ? "

      Last updated: November 22, 2026

      " : "") + (await import("/js/docs.js?v=20261102a")).docSectionHTML(id); + // the document's own title is the page's h1 (the source keeps h3 for the docs and the TOS modal) + html = html.replace(/

      ([\s\S]*?)<\/h3>/, "

      $1

      "); mount.innerHTML = '"; } diff --git a/public/js/site-meta.js b/public/js/site-meta.js new file mode 100644 index 00000000..b0221ec6 --- /dev/null +++ b/public/js/site-meta.js @@ -0,0 +1,75 @@ +// Copyright (c) 2026 Darknode-Official. All rights reserved. See LICENSE. +// Title, description and canonical URL of every public page a signed-out visitor can land on. +// One table, two readers: +// scripts/build.mjs writes dist/pages/.html (index.html with this head) and +// firebase.json serves it at the page's path, so crawlers and link previews that do not +// run JavaScript see the right title, description and canonical for each page; +// landing.js applies the same values after a client-side render (a visit served the app +// shell by the service worker, or a page reached without a reload). +// Pure data plus one DOM helper; no imports, so Node (the build and the tests) can load it. + +export const SITE = "https://darknode.ai"; + +export const HOME = { + title: "Darknode — Find the real risks in your domain, code and cloud", + description: "Free domain security check in seconds, no sign-up. Then find real vulnerabilities in your code, dependencies and cloud, ranked by what attackers exploit now.", +}; + +// path -> { slug (the dist/pages file), title, description } +export const PAGES = { + "/features": { slug: "features", title: "Features", + description: "What Darknode checks: known-exploited vulnerabilities, domain and email security, attack surface, code and secrets, dependencies, and cloud and infrastructure as code, each with a fix." }, + "/pricing": { slug: "pricing", title: "Pricing", + description: "Free: domain, email and certificate checks, the live vulnerability feed and one watched domain. Pro ($29) and Team ($79) per user a month add scanning, monitors and shared workspaces." }, + "/faq": { slug: "faq", title: "FAQ", + description: "Answers on Darknode plans, where your code and data go, offline use, the AI models it uses, and legal use of its security checks." }, + "/nexus": { slug: "nexus", title: "Nexus, the terminal coding agent", + description: "Nexus drives six AI engines from one terminal: Claude Code, the Gemini CLI, Codex, OpenCode, Aider and local Ollama models, with planning, memory, verification and rollback." }, + "/security-knowledge": { slug: "security-knowledge", title: "Security knowledge", + description: "OWASP Top 10, security patterns, cheat sheets, privilege escalation and network reconnaissance, explained with the context to fix each finding." }, + "/darknode-os": { slug: "darknode-os", title: "Darknode OS", + description: "Two editions that run in a virtual machine: a from-scratch x86 research kernel, and an Ubuntu 24.04 desktop with the Darknode CLI, Nexus and a security toolset." }, + "/government": { slug: "government", title: "Government and regulated teams", + description: "Control mapping for NIST SP 800-53, CSF 2.0, FedRAMP, CMMC and HIPAA, vulnerability deadlines with the BOD 22-01 clock, and audit evidence built from your own findings." }, + "/crosswalk": { slug: "crosswalk", title: "GenAI Security Crosswalk", + description: "The OWASP GenAI security risks mapped to 26 security frameworks, by risk or by framework, with coverage gaps. Free, no account needed." }, + "/terms": { slug: "terms", title: "Terms of Service", + description: "The terms that govern your use of darknode.ai, the Deck, the Darknode CLI, Nexus, the desktop app and Darknode OS." }, + "/privacy": { slug: "privacy", title: "Privacy Policy", + description: "What Darknode collects, where your findings and code go, what the edge proxy does and does not keep, and your rights over your data." }, + "/acceptable-use": { slug: "acceptable-use", title: "Acceptable Use Policy", + description: "Use Darknode only on systems you own or are authorized to assess. What is not allowed, and how to report misuse." }, +}; + +export const NOT_FOUND_TITLE = "Page not found — Darknode"; + +// " — Darknode" (the home page has its own full title) +export const pageTitle = (p) => p.title + " — Darknode"; + +/** + * Point the head at one page: title, description, canonical, Open Graph and Twitter tags. + * meta = HOME, a PAGES entry, or null for a page that must not be indexed (not found): it + * loses its canonical and gets robots noindex. + */ +export function applyPageMeta(path, meta, doc = document) { + const head = doc.head; + const set = (sel, attr, val) => { const el = head.querySelector(sel); if (el) el.setAttribute(attr, val); }; + if (!meta) { + const c = head.querySelector('link[rel="canonical"]'); if (c) c.remove(); + let r = head.querySelector('meta[name="robots"]'); + if (!r) { r = doc.createElement("meta"); r.setAttribute("name", "robots"); head.appendChild(r); } + r.setAttribute("content", "noindex"); + doc.title = NOT_FOUND_TITLE; + return; + } + const title = meta === HOME ? HOME.title : pageTitle(meta); + const url = SITE + (meta === HOME ? "/" : path); + doc.title = title; + set('meta[name="description"]', "content", meta.description); + set('link[rel="canonical"]', "href", url); + set('meta[property="og:title"]', "content", title); + set('meta[property="og:description"]', "content", meta.description); + set('meta[property="og:url"]', "content", url); + set('meta[name="twitter:title"]', "content", title); + set('meta[name="twitter:description"]', "content", meta.description); +} diff --git a/public/llms.txt b/public/llms.txt new file mode 100644 index 00000000..124e576c --- /dev/null +++ b/public/llms.txt @@ -0,0 +1,36 @@ +# Darknode + +> Darknode finds the real security risks in a domain, code, dependencies and cloud configuration, ranks them by live exploitation data (CISA KEV and FIRST EPSS) rather than by an AI model's opinion, and gives a concrete fix for each. It starts with a free domain check that needs no sign-up. + +Darknode runs in the browser (the Deck workspace at darknode.ai), as a desktop app for macOS, Windows and Linux, and as a command-line tool (the Darknode CLI, which includes the Nexus terminal coding agent). Checks are deterministic: each result shows how it was reached. Use it only on systems you own or are authorized to assess. + +Plans: Free ($0) includes the domain, email and certificate checks, the live vulnerability feed, one watched domain with email alerts, and the Darknode assistant at 50 messages a day. Pro ($29 per user a month) adds the exposure and application security tools, saved findings and reports, premium AI models, monitors and deadline clocks. Team ($79 per user a month) adds shared workspaces, roles and the organization tools. Enterprise is custom. Paid plans are in preview: checkout is not live yet, so upgrades are requested and granted by hand. + +## Product + +- [Home and free domain check](https://darknode.ai/): enter a domain to grade its email authentication (SPF, DKIM, DMARC), HTTPS, certificate expiry, security headers, DNSSEC, CAA and security.txt, with the fix for each failing check +- [Shareable check page](https://darknode.ai/check/example.com): the same check for one domain at a link you can share; it runs live each time it opens +- [Features](https://darknode.ai/features): what Darknode checks (known-exploited vulnerabilities, domain and email, attack surface, code and secrets, dependencies, cloud and infrastructure as code) and how it works +- [Pricing](https://darknode.ai/pricing): Free, Pro, Team and Enterprise, and what each includes +- [FAQ](https://darknode.ai/faq): plans, where code and data go, offline use, AI models, legal use + +## Tools and products + +- [Nexus](https://darknode.ai/nexus): the terminal coding agent in the Darknode CLI; one interface over six engines (Claude Code, the Gemini CLI, Codex, OpenCode, Aider and local Ollama models) +- [GenAI Security Crosswalk](https://darknode.ai/crosswalk): the OWASP GenAI security risks mapped to 26 security frameworks; free, no account needed +- [Security knowledge](https://darknode.ai/security-knowledge): OWASP Top 10, security patterns, cheat sheets, privilege escalation and network reconnaissance +- [Darknode OS](https://darknode.ai/darknode-os): a from-scratch x86 research kernel and an Ubuntu 24.04 desktop edition, both run in a virtual machine +- [Government and regulated teams](https://darknode.ai/government): control mapping, vulnerability deadlines with the BOD 22-01 clock, and audit evidence +- [Darknode CLI source](https://github.com/Darknode-Official/darknode-cli): install from source; includes Nexus and the `darknode mcp` server for MCP clients + +## Legal + +- [Terms of Service](https://darknode.ai/terms) +- [Privacy Policy](https://darknode.ai/privacy) +- [Acceptable Use Policy](https://darknode.ai/acceptable-use) + +## Optional + +- [Source code on GitHub](https://github.com/Darknode-Official) +- [Sitemap](https://darknode.ai/sitemap.xml) +- Contact: contact@darknode.ai diff --git a/public/manifest.json b/public/manifest.json index 2357f95f..68e2f8e0 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,8 +1,8 @@ { "id": "/", - "name": "Darknode — Agentic AI Security Platform", + "name": "Darknode", "short_name": "Darknode", - "description": "Agentic AI security platform: autonomous AI agents, LLM & GenAI red-teaming, the OWASP GenAI risk crosswalk, prompt-injection and AI threat labs, and an AI security copilot.", + "description": "Find the real risks in your domain, code and cloud: a free domain security check, then vulnerabilities in your code, dependencies and cloud ranked by what attackers exploit now.", "start_url": "/", "scope": "/", "display": "standalone", @@ -10,17 +10,19 @@ "background_color": "#f8fafc", "theme_color": "#2563eb", "orientation": "any", - "categories": ["security", "productivity", "developer", "education"], + "categories": ["security", "productivity", "developer"], "prefer_related_applications": false, "icons": [ { "src": "/favicon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" }, - { "src": "/og.png", "sizes": "1200x630", "type": "image/png" } + { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" }, + { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" }, + { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } ], "shortcuts": [ { "name": "Dashboard", "short_name": "Home", "description": "Home dashboard", "url": "/", "icons": [{ "src": "/favicon.svg", "sizes": "any" }] }, { "name": "Tools", "short_name": "Tools", "description": "Security tools", "url": "/tools" }, - { "name": "Darknode AI", "short_name": "AI", "description": "Agentic AI security copilot", "url": "/ai" }, - { "name": "Nexus Agent", "short_name": "Nexus", "description": "Autonomous agentic AI agent", "url": "/coder" }, + { "name": "Darknode AI", "short_name": "AI", "description": "The security assistant", "url": "/ai" }, + { "name": "Nexus Agent", "short_name": "Nexus", "description": "The terminal coding agent", "url": "/coder" }, { "name": "GenAI Crosswalk", "short_name": "Crosswalk", "description": "OWASP GenAI risks mapped to 26 frameworks", "url": "/crosswalk" }, { "name": "Settings", "short_name": "Settings", "description": "App settings", "url": "/settings" }, { "name": "CVE Search", "short_name": "CVEs", "description": "Search and browse the newest CVEs", "url": "/cvesearch" }, diff --git a/public/og.png b/public/og.png index 1f9a9227..91bc51a8 100644 Binary files a/public/og.png and b/public/og.png differ diff --git a/public/og.svg b/public/og.svg index 3bf2ccb4..45d0debf 100644 --- a/public/og.svg +++ b/public/og.svg @@ -1,38 +1,34 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + Find the real risks in your + domain, code and cloud. + Free domain security check in seconds. No sign-up. + darknode.ai - - - - - >_ DARKNODE - - - - Learn cybersecurity by doing it. - - - - 80+ TOOLS · NEXUS AI · PRACTICE LABS · 100% LOCAL - - - - darknode.ai - diff --git a/public/robots.txt b/public/robots.txt index 8ce8a04f..4fc173f1 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,8 +1,8 @@ User-agent: * Allow: / -# AI answer engines & model crawlers — explicitly welcome, for discovery in -# AI search and assistants (agentic / AI-security queries). +# AI answer engines & model crawlers: explicitly welcome, for discovery in +# AI search and assistants. User-agent: GPTBot Allow: / User-agent: OAI-SearchBot @@ -26,11 +26,6 @@ Allow: / Sitemap: https://darknode.ai/sitemap.xml -# Darknode — Agentic AI Security Platform -# https://darknode.ai -# Category: Artificial Intelligence / AI Security / Cybersecurity -# Focus: agentic AI, autonomous AI agents, LLM & GenAI security, AI red-teaming, -# prompt injection, OWASP GenAI/LLM/Agentic Top 10, AI threat intelligence, -# Model Context Protocol (MCP), AI security copilot, AI governance -# Audience: AI engineers, security engineers, red teamers, ML engineers, CISOs -# Contact: https://darknode.ai/ +# Darknode: finds the real security risks in your domain, code, dependencies and cloud, +# ranked by live exploitation data, with a free domain check. +# https://darknode.ai | Summary for language models: https://darknode.ai/llms.txt diff --git a/public/sitemap.xml b/public/sitemap.xml index 8c0559e8..410523c0 100644 --- a/public/sitemap.xml +++ b/public/sitemap.xml @@ -45,4 +45,19 @@ monthly 0.6 + + https://darknode.ai/terms + yearly + 0.3 + + + https://darknode.ai/privacy + yearly + 0.3 + + + https://darknode.ai/acceptable-use + yearly + 0.3 + diff --git a/scripts/build.mjs b/scripts/build.mjs index 67343333..569bbdcb 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -14,10 +14,11 @@ // // Source files keep their old ?v= values, so serving public/ directly still works in // development. Usage: node scripts/build.mjs [--out dist] [--check] -import { cpSync, rmSync, readFileSync, writeFileSync, readdirSync, statSync, existsSync } from "node:fs"; +import { cpSync, rmSync, readFileSync, writeFileSync, readdirSync, statSync, existsSync, mkdirSync } from "node:fs"; import { createHash } from "node:crypto"; import { join, dirname, resolve, relative, sep, posix } from "node:path"; import { fileURLToPath } from "node:url"; +import * as SITE_META from "../public/js/site-meta.js"; const SPEC = /(["'`])((?:\.{1,2}\/|\/)[^"'`?\s$]+?\.(?:m?js|css|json|txt|svg|png|ico|webp|jpe?g|gif|woff2?))\?v=[A-Za-z0-9._-]+(\\?)\1/g; const TEXT = /\.(?:m?js|html)$/; @@ -137,6 +138,29 @@ export function addModulePreloads(html, texts) { return html.slice(0, at) + add.map((u) => "\n" + last[1] + '').join("") + html.slice(at); } +// The head of index.html pointed at one public page (js/site-meta.js): its title, description, +// canonical and social tags. meta null -> the not-found page: noindex and no canonical. +const escAttr = (s) => String(s).replace(/&/g, "&").replace(/"/g, """).replace(/ { if (!re.test(html)) throw new Error("index.html: " + re + " not found"); html = html.replace(re, (all, a, b) => a + val + b); }; + if (!meta) { + swap(/()[^<]*(<\/title>)/, site.NOT_FOUND_TITLE); + swap(/(<meta name="robots" content=")[^"]*(">)/, "noindex"); + html = html.replace(/^[ \t]*<link rel="canonical"[^>]*>\n/m, ""); + return html; + } + const title = escAttr(meta === site.HOME ? meta.title : site.pageTitle(meta)), desc = escAttr(meta.description), url = site.SITE + (meta === site.HOME ? "/" : path); + swap(/(<title>)[^<]*(<\/title>)/, title); + swap(/(<meta name="description" content=")[^"]*(">)/, desc); + swap(/(<link rel="canonical" href=")[^"]*(">)/, url); + swap(/(<meta property="og:title" content=")[^"]*(">)/, title); + swap(/(<meta property="og:description" content=")[^"]*(">)/, desc); + swap(/(<meta property="og:url" content=")[^"]*(">)/, url); + swap(/(<meta name="twitter:title" content=")[^"]*(">)/, title); + swap(/(<meta name="twitter:description" content=")[^"]*(">)/, desc); + return html; +} + export function build({ src, out, check = false }) { const list = walk(src); const files = new Map(list.filter((f) => TEXT.test(f)).map((f) => [f, readFileSync(join(src, f), "utf8")])); @@ -161,11 +185,20 @@ export function build({ src, out, check = false }) { if (first.length) sw = sw.replace(/const STATIC = \[\n/, (m) => m + [...new Set(first)].map((u) => " '" + u + "',\n").join("")); outText.set("sw.js", sw); } + // Each public page gets index.html with its own head (firebase.json serves /pricing from + // /pages/pricing.html, and so on); 404.html is what Hosting answers, with a 404, for a path + // that is neither a public page nor an app page. The app renders the same view either way. + if (outText.has("index.html") && files.has("js/site-meta.js")) { + const site = SITE_META; + const index = outText.get("index.html"); + for (const [path, meta] of Object.entries(site.PAGES)) outText.set("pages/" + meta.slug + ".html", pageHtml(index, path, meta, site)); + outText.set("404.html", pageHtml(index, "", null, site)); + } if (check) return { files: list.length, versioned: version.size, unresolved, buildHash }; rmSync(out, { recursive: true, force: true }); cpSync(src, out, { recursive: true, filter: (p) => { const rel = relative(src, p).split(sep).join("/"); return !rel || !SKIP.some((r) => r.test(rel)); } }); - for (const [f, t] of outText) if (t !== files.get(f)) writeFileSync(join(out, f), t); + for (const [f, t] of outText) if (t !== files.get(f)) { mkdirSync(dirname(join(out, f)), { recursive: true }); writeFileSync(join(out, f), t); } writeFileSync(join(out, "build.json"), JSON.stringify({ build: buildHash, at: new Date().toISOString(), files: list.length }) + "\n"); return { files: list.length, versioned: version.size, unresolved, buildHash }; } diff --git a/scripts/lib/hosting-routes.mjs b/scripts/lib/hosting-routes.mjs new file mode 100644 index 00000000..59cffb20 --- /dev/null +++ b/scripts/lib/hosting-routes.mjs @@ -0,0 +1,69 @@ +// Firebase Hosting rewrites, generated from the routers' own registries so that the HTTP +// status matches what the page shows: +// - each public page (js/site-meta.js PAGES) is served from dist/pages/<slug>.html, which +// carries that page's title, description and canonical (scripts/build.mjs writes them); +// - every path the signed-in app opens (js/deck/routes.js isAppPath with the same section +// ids auth.js appSecs() uses) gets the app shell, index.html; +// - anything else matches no rewrite, so Hosting answers 404 with dist/404.html (the same +// app, which shows "Page not found"). +// firebase.json holds the result; `node scripts/sync-hosting-routes.mjs` rewrites it, and +// test/build/hosting-routes.test.mjs fails when it drifts (a new Deck tool or page). +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname, join } from "node:path"; +import { parseBlurbs, parseConsoleNavIds } from "./deck-registry.mjs"; +import { SCENES, SCENE_PATH, isAppPath } from "../../public/js/deck/routes.js"; +import { PAGES } from "../../public/js/site-meta.js"; + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), "../.."); +const read = (f) => readFileSync(join(ROOT, f), "utf8"); + +// The same three sources auth.js appSecs() reads: console catalog, retired ids, the Deck's own tools. +export function appSecs() { + const cnav = read("public/js/console-nav.js"), auth = read("public/js/auth.js"); + const retired = [...(cnav.match(/export const RETIRED = new Set\(\[([^\]]*)/) || [, ""])[1].matchAll(/"([\w-]+)"/g)].map((m) => m[1]); + return new Set([...parseConsoleNavIds(cnav), ...retired, ...parseBlurbs(auth).keys()]); +} + +// One path segment per app page: section ids (camelCase ids also by their hyphenated path) +// and Deck scene paths, kept only where isAppPath itself says the app opens them. +export function appSegments(secs = appSecs()) { + const out = new Set(); + for (const s of secs) { + if (!/^[A-Za-z0-9-]+$/.test(s)) throw new Error("unexpected section id: " + s); + out.add(s); + if (/[A-Z]/.test(s)) out.add(s.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase())); + } + for (const k of Object.keys(SCENES)) { out.add(k); if (SCENE_PATH[k]) out.add(SCENE_PATH[k]); } + return [...out].filter((p) => !p.startsWith("tool-") && isAppPath("/" + p, secs)).sort(); +} + +// RE2 (Firebase Hosting) pattern for every app path, with or without the old /console prefix +// and a trailing slash. Mini-tools (tool-<id>) match by shape; the app says "Page not found" +// for an id that no longer exists. +export function appPathRegex(segs = appSegments()) { + return "^/(?:console(?:/|$))?(?:(?:area|personal|enterprise)/[\\w-]+|check/[^/]+|tool-[a-z0-9-]+|" + segs.join("|") + ")?/?$"; +} + +export function hostingRewrites() { + return [ + { source: "/api/chat", function: { functionId: "chat", region: "us-central1" } }, + { source: "/version", destination: "/version.txt" }, + ...Object.entries(PAGES).map(([path, p]) => ({ regex: "^" + path + "/?$", destination: "/pages/" + p.slug + ".html" })), + { regex: appPathRegex(), destination: "/index.html" }, + ]; +} + +// The rewrites block as firebase.json writes it (one rule per line, 6-space indent). +export function rewritesBlock(rules = hostingRewrites()) { + const one = (r) => "{ " + Object.entries(r).map(([k, v]) => JSON.stringify(k) + ": " + (typeof v === "object" ? "{ " + Object.entries(v).map(([a, b]) => JSON.stringify(a) + ": " + JSON.stringify(b)).join(", ") + " }" : JSON.stringify(v))).join(", ") + " }"; + return '"rewrites": [\n' + rules.map((r) => " " + one(r)).join(",\n") + "\n ]"; +} + +// firebase.json text with every hosting site's rewrites replaced by the generated block. +export function syncFirebaseJson(text) { + const re = /"rewrites": \[\n[\s\S]*?\n {6}\]/g; + const n = (text.match(re) || []).length; + if (!n) throw new Error("firebase.json: no rewrites block found"); + return text.replace(re, () => rewritesBlock()); +} diff --git a/scripts/new-deck-tool.mjs b/scripts/new-deck-tool.mjs index f0631b57..acd79fd0 100644 --- a/scripts/new-deck-tool.mjs +++ b/scripts/new-deck-tool.mjs @@ -159,7 +159,7 @@ function runScaffold(args) { for (const [rel, content] of Object.entries(creates)) { mkdirSync(dirname(join(ROOT, rel)), { recursive: true }); writeFileSync(join(ROOT, rel), content); } for (const [rel, content] of Object.entries(next)) writeFileSync(join(ROOT, rel), content); process.stdout.write(`applied (stamp ${stamp}):\n` + [...Object.keys(next).map((r) => ` M ${r}`), ...Object.keys(creates).map((r) => ` A ${r}`)].join("\n") + "\n"); - process.stdout.write("next: implement the engine checks, then `node test/run.mjs` and `node scripts/new-deck-tool.mjs --check`.\n"); + process.stdout.write("next: implement the engine checks, run `node scripts/sync-hosting-routes.mjs` (so the new path is not a 404), then `node test/run.mjs` and `node scripts/new-deck-tool.mjs --check`.\n"); } const args = parseArgs(argv); diff --git a/scripts/sync-hosting-routes.mjs b/scripts/sync-hosting-routes.mjs new file mode 100644 index 00000000..dfc5442e --- /dev/null +++ b/scripts/sync-hosting-routes.mjs @@ -0,0 +1,18 @@ +#!/usr/bin/env node +// Regenerate firebase.json's Hosting rewrites from the app's route registries and the public +// page table (see scripts/lib/hosting-routes.mjs). Run it after adding a Deck tool, a console +// page or a public page; `npm test` fails until you do. Usage: node scripts/sync-hosting-routes.mjs [--check] +import { readFileSync, writeFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname, join } from "node:path"; +import { syncFirebaseJson } from "./lib/hosting-routes.mjs"; + +const file = join(dirname(fileURLToPath(import.meta.url)), "..", "firebase.json"); +const before = readFileSync(file, "utf8"); +const after = syncFirebaseJson(before); +JSON.parse(after); // still valid JSON +if (process.argv.includes("--check")) { + if (after !== before) { console.error("firebase.json rewrites are out of date: run node scripts/sync-hosting-routes.mjs"); process.exit(1); } + console.log("firebase.json rewrites are up to date"); +} else if (after === before) console.log("firebase.json rewrites already up to date"); +else { writeFileSync(file, after); console.log("firebase.json rewrites updated"); } diff --git a/test/build/hosting-routes.test.mjs b/test/build/hosting-routes.test.mjs new file mode 100644 index 00000000..686802d9 --- /dev/null +++ b/test/build/hosting-routes.test.mjs @@ -0,0 +1,72 @@ +// scripts/lib/hosting-routes.mjs + scripts/build.mjs pageHtml: firebase.json answers a real +// 404 for unknown paths, while every path the app routes still gets the app shell and each +// public page gets its own title, description and canonical. +import { test, group, assert } from "../harness.mjs"; +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; +import { dirname, join } from "node:path"; +import { appSecs, appPathRegex, hostingRewrites, syncFirebaseJson } from "../../scripts/lib/hosting-routes.mjs"; +import { pageHtml } from "../../scripts/build.mjs"; +import { isAppPath } from "../../public/js/deck/routes.js"; +import * as SITE_META from "../../public/js/site-meta.js"; + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), "../.."); +const read = (f) => readFileSync(join(ROOT, f), "utf8"); + +group("hosting routes: firebase.json rewrites", () => { + test("firebase.json rewrites are generated (run node scripts/sync-hosting-routes.mjs)", () => { + const text = read("firebase.json"); + assert.equal(syncFirebaseJson(text), text); + const hosting = JSON.parse(text).hosting; + assert.ok(hosting.length >= 2); + for (const h of hosting) { + assert.deepEqual(h.rewrites, hostingRewrites(), h.target || h.site); + assert.ok(!h.rewrites.some((r) => r.source === "**"), "a catch-all rewrite turns every typo into a 200"); + } + }); + test("app paths get the shell; mistyped paths match nothing (404)", () => { + const re = new RegExp(appPathRegex()), secs = appSecs(); + const app = ["/", "/check/example.com", "/check/example.com/", "/console", "/console/dns", "/emailauth", "/emailauth/", + "/area/exposure", "/personal/certs", "/all-tools", "/docs", "/settings", "/overview", "/tool-hash", "/monitors", "/plans"]; + for (const p of app) assert.ok(re.test(p), p); + for (const p of ["/nope-xyz", "/get-started", "/emailauth/extra", "/js/missing.js", "/check/", "/console/nope-xyz", "/wp-admin"]) assert.notOk(re.test(p), p); + // the rule never admits a path the app itself would not open + for (const p of app) if (!/^\/(check|tool-|console)/.test(p) && p !== "/") assert.ok(isAppPath(p.replace(/\/$/, ""), secs), p); + }); + test("each public page is served from its own HTML and is in the sitemap", () => { + const sitemap = read("public/sitemap.xml"); + const rules = hostingRewrites(); + for (const [path, p] of Object.entries(SITE_META.PAGES)) { + const r = rules.find((x) => x.destination === "/pages/" + p.slug + ".html"); + assert.ok(r && new RegExp(r.regex).test(path) && new RegExp(r.regex).test(path + "/"), path); + assert.ok(sitemap.includes("<loc>" + SITE_META.SITE + path + "</loc>"), path + " missing from sitemap.xml"); + } + }); +}); + +group("hosting routes: page HTML", () => { + const index = read("public/index.html"); + test("a public page names itself in title, description, canonical, OG and Twitter tags", () => { + const meta = SITE_META.PAGES["/pricing"]; + const html = pageHtml(index, "/pricing", meta, SITE_META); + assert.ok(html.includes("<title>" + SITE_META.pageTitle(meta) + "")); + assert.ok(html.includes('')); + assert.ok(html.includes('')); + assert.ok(html.includes('')); + assert.ok(html.includes('')); + }); + test("the 404 page is noindex and names no canonical", () => { + const html = pageHtml(index, "/404", null, SITE_META); + assert.ok(html.includes("" + SITE_META.NOT_FOUND_TITLE + "")); + assert.ok(html.includes('')); + assert.notOk(/rel="canonical"/.test(html)); + }); + test("the home page head matches site-meta HOME", () => { + assert.ok(index.includes("" + SITE_META.HOME.title + "")); + assert.ok(index.includes('')); + }); + test("llms.txt is Markdown with an H1 and a summary", () => { + const t = read("public/llms.txt"); + assert.ok(/^# \S/.test(t)); assert.ok(/\n> \S/.test(t)); + }); +}); diff --git a/test/check/domain-check.test.mjs b/test/check/domain-check.test.mjs index 476435f9..ee615607 100644 --- a/test/check/domain-check.test.mjs +++ b/test/check/domain-check.test.mjs @@ -56,6 +56,14 @@ const goodWeb = (d) => fetcher({ [`http://${d}/`]: { status: 200, finalUrl: `https://${d}/`, headers: GOOD_HEADERS }, [`https://${d}/.well-known/security.txt`]: { status: 200, body: STXT }, }); +// certificate-transparency rows as ct-fetch.js returns them (crt.sh shape), against a fixed clock +const NOW = Date.UTC(2026, 5, 1); +const DAY = 86400000; +const iso = (t) => new Date(t).toISOString().slice(0, 19); +const certRow = (daysLeft, life = 90) => ({ issuer_name: 'C=US, O="Let\'s Encrypt", CN=R10', not_before: iso(NOW + (daysLeft - life) * DAY), not_after: iso(NOW + daysLeft * DAY), name_value: "good.test" }); +const certs = (...rows) => async () => rows; +// every run gets a healthy certificate unless a test passes its own certRows +const check = (d, o = {}) => runDomainCheck(d, { certRows: certs(certRow(60)), now: NOW, ...o }); const byId = (res) => Object.fromEntries(res.checks.map((c) => [c.id, c])); group("domain check: catalog and grading", () => { @@ -113,7 +121,7 @@ group("domain check: input", () => { group("domain check: live run with injected sources", () => { test("a well-configured domain passes every check (A)", async () => { - const res = await runDomainCheck("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test") }); + const res = await check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test") }); const bad = res.checks.filter((c) => c.status !== "pass").map((c) => c.id + ":" + c.status + ":" + c.detail); assert.deepEqual(bad, []); assert.equal(res.grade, "A"); assert.equal(res.score, 100); assert.equal(res.possible, 100); @@ -121,34 +129,34 @@ group("domain check: live run with injected sources", () => { }); test("progress snapshots arrive with pending checks, and the last one is complete", async () => { const snaps = []; - const res = await runDomainCheck("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test"), onProgress: (r) => snaps.push(r) }); + const res = await check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test"), onProgress: (r) => snaps.push(r) }); assert.ok(snaps.length >= 3); assert.ok(snaps.some((s) => s.checks.some((c) => c.status === "pending"))); assert.equal(res.counts.pending, 0); }); test("NXDOMAIN stops the check with a plain reason", async () => { let msg = ""; - try { await runDomainCheck("nope.test", { doh: resolver({}), fetchUrl: goodWeb("nope.test") }); } catch (e) { msg = e.message; } + try { await check("nope.test", { doh: resolver({}), fetchUrl: goodWeb("nope.test") }); } catch (e) { msg = e.message; } assert.ok(/does not exist/.test(msg), msg); }); test("invalid input is rejected before any lookup", async () => { const doh = resolver({}); let msg = ""; - try { await runDomainCheck("not a domain", { doh, fetchUrl: goodWeb("x") }); } catch (e) { msg = e.message; } + try { await check("not a domain", { doh, fetchUrl: goodWeb("x") }); } catch (e) { msg = e.message; } assert.ok(/domain name/.test(msg)); assert.equal(doh.calls.length, 0); }); test("a failing proxy makes the web checks 'error', not fails, and they leave the grade", async () => { const proxyDown = async () => { throw new Error("Network error reaching the Darknode proxy: Failed to fetch"); }; - const res = await runDomainCheck("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: proxyDown }); + const res = await check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: proxyDown, certRows: proxyDown }); const c = byId(res); - for (const id of ["https", "redirect", "hsts", "csp", "frame", "nosniff", "referrer", "securitytxt"]) assert.equal(c[id].status, "error", id); + for (const id of ["https", "redirect", "cert", "hsts", "csp", "frame", "nosniff", "referrer", "securitytxt"]) assert.equal(c[id].status, "error", id); assert.equal(c.spf.status, "pass"); assert.equal(res.possible, 46); // email 32 + DNS 14 assert.equal(res.grade, "N/A"); // 46 of 100 applicable points graded is under half }); test("a resolver outage on one record is 'error' for that check only", async () => { const t = goodDns("good.test"); t["good.test CAA"] = { Status: 2 }; - const res = await runDomainCheck("good.test", { doh: resolver(t), fetchUrl: goodWeb("good.test") }); + const res = await check("good.test", { doh: resolver(t), fetchUrl: goodWeb("good.test") }); const c = byId(res); assert.equal(c.caa.status, "error"); assert.ok(/SERVFAIL/.test(c.caa.detail)); assert.equal(c.caa.points, null); assert.equal(res.possible, 93); assert.equal(res.score, 100); @@ -158,7 +166,7 @@ group("domain check: live run with injected sources", () => { t[`${d} TXT`] = ans(d, "TXT", ['"v=spf1 include:_spf.mail.test ~all"']); t[`_dmarc.${d} TXT`] = ans("_dmarc." + d, "TXT", ['"v=DMARC1; p=none"']); t[`${d} A`] = ans(d, "A", ["192.0.2.20"]); t[`${d} AAAA`] = nodata(); delete t[`${d} DS`]; delete t[`${d} CAA`]; - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200 }, [`http://${d}/`]: { status: 200 } }) }); + const res = await check(d, { doh: resolver(t), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200 }, [`http://${d}/`]: { status: 200 } }) }); const c = byId(res); assert.equal(c.spf.status, "warn"); assert.equal(c.dmarc.status, "warn"); assert.ok(/p=quarantine/.test(c.dmarc.fix), c.dmarc.fix); assert.equal(c.https.status, "pass"); assert.equal(c.redirect.status, "fail"); @@ -174,7 +182,7 @@ group("domain check: live run with injected sources", () => { const d = "mail.test", t = goodDns(d); if (spf == null) t[`${d} TXT`] = nodata(); else t[`${d} TXT`] = ans(d, "TXT", spf.map((s) => `"${s}"`)); if (dmarc == null) t[`_dmarc.${d} TXT`] = nodata(); else t[`_dmarc.${d} TXT`] = ans("_dmarc." + d, "TXT", [`"${dmarc}"`]); - return byId(await runDomainCheck(d, { doh: resolver(t), fetchUrl: goodWeb(d) })); + return byId(await check(d, { doh: resolver(t), fetchUrl: goodWeb(d) })); }; let c = await run(["v=spf1 include:_spf.mail.test ~all"], "v=DMARC1; p=quarantine; rua=mailto:r@mail.test"); assert.ok(/change ~all to -all/.test(c.spf.fix), c.spf.fix); assert.ok(!/Publish/.test(c.spf.fix)); @@ -190,7 +198,7 @@ group("domain check: live run with injected sources", () => { }); test("HTTPS down at the site is a fail; plain-HTTP-only headers fail HSTS", async () => { const d = "plain.test"; - const res = await runDomainCheck(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: new Error("TLS handshake failed"), [`http://${d}/`]: { status: 200, headers: GOOD_HEADERS } }) }); + const res = await check(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: new Error("TLS handshake failed"), [`http://${d}/`]: { status: 200, headers: GOOD_HEADERS } }) }); const c = byId(res); assert.equal(c.https.status, "fail"); assert.ok(/TLS handshake failed/.test(c.https.detail)); assert.equal(c.redirect.status, "fail"); @@ -199,42 +207,73 @@ group("domain check: live run with injected sources", () => { }); test("closed port 80 with working HTTPS is a pass for the redirect check", async () => { const d = "tls-only.test"; - const res = await runDomainCheck(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200, headers: GOOD_HEADERS }, [`http://${d}/`]: new Error("connect ECONNREFUSED") }) }); + const res = await check(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200, headers: GOOD_HEADERS }, [`http://${d}/`]: new Error("connect ECONNREFUSED") }) }); assert.equal(byId(res).redirect.status, "pass"); }); + test("certificate expiry: bands follow the certificate's own lifetime", async () => { + const cert = async (rows, o = {}) => byId(await check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test"), certRows: certs(...rows), ...o })).cert; + let c = await cert([certRow(60)]); + assert.equal(c.status, "pass"); assert.ok(/valid until 2026-07-31 \(60 days\)/.test(c.detail), c.detail); assert.ok(/Let's Encrypt/.test(c.detail), c.detail); + c = await cert([certRow(-3)]); + assert.equal(c.status, "fail"); assert.ok(/expired on 2026-05-29/.test(c.detail), c.detail); assert.ok(/Renew/.test(c.fix)); + c = await cert([certRow(5)]); + assert.equal(c.status, "fail"); assert.ok(/expires in 5 days/.test(c.detail), c.detail); + c = await cert([certRow(15)]); + assert.equal(c.status, "warn"); assert.ok(c.fix.length > 0); + // a 6-day certificate with 3 days left is on schedule, not about to lapse + c = await cert([certRow(3, 6)]); + assert.equal(c.status, "pass", c.detail); + // the newest certificate decides: a renewed one outweighs the old one still in the logs + c = await cert([certRow(2), certRow(80)]); + assert.equal(c.status, "pass", c.detail); + }); + test("certificate expiry: nothing logged or logs down is 'error', not a fail", async () => { + const run1 = async (certRows, o = {}) => check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test"), certRows, ...o }); + for (const certRows of [certs(), async () => Object.assign([], { unreachable: true }), async () => { throw new Error("crt.sh 502"); }]) { + const res = await run1(certRows); + assert.equal(byId(res).cert.status, "error"); assert.equal(res.possible, 94); assert.equal(res.score, 100); + } + const slow = await run1(() => new Promise(() => {}), { certTimeoutMs: 20 }); + assert.equal(byId(slow).cert.status, "error"); assert.ok(/did not answer/.test(byId(slow).cert.detail), byId(slow).cert.detail); + }); + test("an expired certificate is a high-severity finding", async () => { + const res = await check("good.test", { doh: resolver(goodDns("good.test")), fetchUrl: goodWeb("good.test"), certRows: certs(certRow(-1)) }); + const f = domainCheckFindings(res).find((x) => x.id === "domaincheck|good.test|cert"); + assert.ok(f); assert.equal(f.severity, "high"); + }); test("no address at the apex: the web checks run against www", async () => { const d = "apexless.test", t = goodDns(d); t[`${d} A`] = nodata({ AD: true }); t[`www.${d} A`] = ans("www." + d, "A", ["192.0.2.30"]); const w = "www." + d; - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: goodWeb(w) }); + const res = await check(d, { doh: resolver(t), fetchUrl: goodWeb(w) }); assert.equal(res.webHost, w); assert.equal(byId(res).https.status, "pass"); }); test("no website at all: web checks are not applicable and the grade uses email + DNS", async () => { const d = "mailonly.test", t = goodDns(d); t[`${d} A`] = nodata({ AD: true }); - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: async () => { throw new Error("must not fetch"); } }); + const res = await check(d, { doh: resolver(t), fetchUrl: async () => { throw new Error("must not fetch"); } }); const c = byId(res); - for (const id of ["https", "redirect", "hsts", "csp", "frame", "nosniff", "referrer", "securitytxt"]) assert.equal(c[id].status, "na", id); + for (const id of ["https", "redirect", "cert", "hsts", "csp", "frame", "nosniff", "referrer", "securitytxt"]) assert.equal(c[id].status, "na", id); assert.equal(res.possible, 46); assert.equal(res.grade, "A"); }); test("a domain that sends no mail needs no DKIM; null MX passes", async () => { const d = "parked.test", t = goodDns(d); t[`${d} TXT`] = ans(d, "TXT", ['"v=spf1 -all"']); t[`${d} MX`] = ans(d, "MX", ["0 ."]); delete t[`selector1._domainkey.${d} TXT`]; - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); + const res = await check(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); const c = byId(res); assert.equal(c.dkim.status, "na"); assert.equal(c.mx.status, "pass"); assert.ok(/Null MX/.test(c.mx.detail)); }); test("DKIM not found at the common selectors is a warning, not a fail", async () => { const d = "nodkim.test", t = goodDns(d); delete t[`selector1._domainkey.${d} TXT`]; - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); + const res = await check(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); assert.equal(byId(res).dkim.status, "warn"); }); test("broken DNSSEC (SERVFAIL that answers with checking disabled) fails DNSSEC", async () => { const d = "bogus.test"; // validating resolvers SERVFAIL every name in a bogus zone const t = { [`${d} A`]: { Status: 2 }, [`${d} AAAA`]: { Status: 2 }, [`${d} TXT`]: { Status: 2 }, [`${d} A cd`]: ans(d, "A", ["192.0.2.40"]) }; - const res = await runDomainCheck(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); + const res = await check(d, { doh: resolver(t), fetchUrl: goodWeb(d) }); const c = byId(res); assert.equal(c.dnssec.status, "fail"); assert.equal(c.https.status, "error"); assert.equal(c.spf.status, "error"); }); @@ -243,14 +282,14 @@ group("domain check: live run with injected sources", () => { t["app.org.test A"] = ans("app.org.test", "A", ["192.0.2.50"], { AD: true }); t["app.org.test AAAA"] = nodata(); t["app.org.test TXT"] = ans("app.org.test", "TXT", ['"v=spf1 -all"']); t["app.org.test MX"] = ans("app.org.test", "MX", ["0 ."]); - const res = await runDomainCheck("app.org.test", { doh: resolver(t), fetchUrl: goodWeb("app.org.test") }); + const res = await check("app.org.test", { doh: resolver(t), fetchUrl: goodWeb("app.org.test") }); const c = byId(res); assert.equal(c.dmarc.status, "pass"); assert.ok(/inherited from org\.test/.test(c.dmarc.detail), c.dmarc.detail); assert.equal(c.caa.status, "pass"); assert.ok(/CAA at org\.test/.test(c.caa.detail)); }); test("an invalid security.txt is a warning that says why", async () => { const d = "stxt.test"; - const res = await runDomainCheck(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ + const res = await check(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200, headers: GOOD_HEADERS }, [`http://${d}/`]: { finalUrl: `https://${d}/`, headers: GOOD_HEADERS }, [`https://${d}/.well-known/security.txt`]: { status: 200, body: "Contact: mailto:a@stxt.test\nExpires: 2000-01-01T00:00:00.000Z\n" } }) }); const c = byId(res).securitytxt; @@ -258,7 +297,7 @@ group("domain check: live run with injected sources", () => { }); test("an HTML app answering every path is not a security.txt", async () => { const d = "spa.test"; - const res = await runDomainCheck(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ + const res = await check(d, { doh: resolver(goodDns(d)), fetchUrl: fetcher({ [`https://${d}/`]: { status: 200, headers: GOOD_HEADERS }, [`http://${d}/`]: { finalUrl: `https://${d}/`, headers: GOOD_HEADERS }, [`https://${d}/.well-known/security.txt`]: { status: 200, body: "

      Contact: us

      " }, [`https://${d}/security.txt`]: { status: 200, body: "" } }) });