@hardkeel/benthic 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +121 -0
- package/LICENSE +92 -0
- package/NOTICE +16 -0
- package/README.md +424 -2
- package/action.yml +54 -0
- package/dist/agility.js +80 -0
- package/dist/badge.js +62 -0
- package/dist/baseline.js +81 -0
- package/dist/cbom-diff.js +273 -0
- package/dist/cbom.js +418 -0
- package/dist/cli.js +834 -0
- package/dist/cloud-aws-services.js +375 -0
- package/dist/cloud-aws.js +354 -0
- package/dist/cloud-azure-services.js +73 -0
- package/dist/cloud-azure.js +144 -0
- package/dist/cloud-common.js +242 -0
- package/dist/cloud-gcp-services.js +90 -0
- package/dist/cloud-gcp.js +150 -0
- package/dist/comments.js +138 -0
- package/dist/community-rules.js +37 -0
- package/dist/community.js +30 -0
- package/dist/deps.js +406 -0
- package/dist/der.js +571 -0
- package/dist/evidence-cli.js +235 -0
- package/dist/evidence-live.js +109 -0
- package/dist/evidence.js +512 -0
- package/dist/ignore.js +90 -0
- package/dist/image.js +1224 -0
- package/dist/infra.js +635 -0
- package/dist/inventory.js +277 -0
- package/dist/map-activity.js +24 -0
- package/dist/map-areas.js +60 -0
- package/dist/map-cloud-keys.js +110 -0
- package/dist/map-cloud.js +34 -0
- package/dist/map-ct.js +107 -0
- package/dist/map-host.js +335 -0
- package/dist/map-network.js +520 -0
- package/dist/map-people.js +79 -0
- package/dist/map-rank.js +70 -0
- package/dist/map-report.js +304 -0
- package/dist/map-run.js +327 -0
- package/dist/map-sarif.js +61 -0
- package/dist/map-signin.js +247 -0
- package/dist/map-types.js +19 -0
- package/dist/map-web.js +666 -0
- package/dist/native.js +168 -0
- package/dist/policy.js +221 -0
- package/dist/pqc.js +46 -0
- package/dist/profile.js +65 -0
- package/dist/project.js +928 -0
- package/dist/prose.js +159 -0
- package/dist/protocols.js +207 -0
- package/dist/registry.js +326 -0
- package/dist/report.js +190 -0
- package/dist/rules.js +230 -0
- package/dist/sarif-common.js +30 -0
- package/dist/sarif.js +114 -0
- package/dist/scan.js +601 -0
- package/dist/score.js +124 -0
- package/dist/secrets.js +192 -0
- package/dist/share-config.js +129 -0
- package/dist/share-lists.js +19 -0
- package/dist/share.js +125 -0
- package/dist/sonar.js +83 -0
- package/dist/structure.js +218 -0
- package/dist/suites.js +402 -0
- package/dist/tls-check.js +122 -0
- package/dist/types.js +4 -0
- package/dist/walk.js +78 -0
- package/dist/yaml.js +173 -0
- package/package.json +73 -4
package/dist/map-rank.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// SPDX-License-Identifier: PolyForm-Shield-1.0.0
|
|
2
|
+
// Copyright 2026 Hard Keel (https://hardkeel.com)
|
|
3
|
+
// Ranks every finding by what breaks first, and turns code findings into map findings.
|
|
4
|
+
export function tierOf(f) {
|
|
5
|
+
if (f.risk !== "quantum-vulnerable")
|
|
6
|
+
return 1;
|
|
7
|
+
if ((f.primitive === "key-agreement" || f.primitive === "public-key-encryption") && f.internetFacing)
|
|
8
|
+
return 2;
|
|
9
|
+
if (f.primitive === "signature" && f.longLived)
|
|
10
|
+
return 3;
|
|
11
|
+
return 4;
|
|
12
|
+
}
|
|
13
|
+
const SEV = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
14
|
+
const RATE = { high: 0, medium: 1, low: 2 };
|
|
15
|
+
/** Key exchange and public-key encryption protect data someone can record or store and read later. */
|
|
16
|
+
const recordable = (f) => f.primitive === "key-agreement" || f.primitive === "public-key-encryption";
|
|
17
|
+
export function ratingOf(f, tier = tierOf(f)) {
|
|
18
|
+
if (tier === 1)
|
|
19
|
+
return f.severity === "critical" || f.severity === "high" ? "high" : f.severity === "medium" ? "medium" : "low";
|
|
20
|
+
if (tier === 2 || tier === 3)
|
|
21
|
+
return "high";
|
|
22
|
+
return f.internetFacing || f.longLived || recordable(f) ? "medium" : "low";
|
|
23
|
+
}
|
|
24
|
+
/** What breaks first: tier, then rating, then internet-facing and long-lived ahead of the rest, then severity. */
|
|
25
|
+
export function rank(findings) {
|
|
26
|
+
return findings
|
|
27
|
+
.map((f) => {
|
|
28
|
+
const tier = tierOf(f);
|
|
29
|
+
return { ...f, tier, rating: ratingOf(f, tier) };
|
|
30
|
+
})
|
|
31
|
+
.sort((a, b) => a.tier - b.tier ||
|
|
32
|
+
RATE[a.rating] - RATE[b.rating] ||
|
|
33
|
+
Number(b.internetFacing) - Number(a.internetFacing) ||
|
|
34
|
+
Number(!!b.longLived) - Number(!!a.longLived) ||
|
|
35
|
+
SEV[a.severity] - SEV[b.severity] ||
|
|
36
|
+
a.area.localeCompare(b.area) ||
|
|
37
|
+
a.target.localeCompare(b.target));
|
|
38
|
+
}
|
|
39
|
+
export function fromCodeFinding(f) {
|
|
40
|
+
return {
|
|
41
|
+
area: "code",
|
|
42
|
+
target: `${f.file}:${f.line}`,
|
|
43
|
+
ruleId: f.ruleId,
|
|
44
|
+
title: f.title,
|
|
45
|
+
algorithm: f.algorithm,
|
|
46
|
+
primitive: f.primitive,
|
|
47
|
+
risk: f.risk,
|
|
48
|
+
severity: f.severity,
|
|
49
|
+
fix: f.fix,
|
|
50
|
+
internetFacing: false,
|
|
51
|
+
keySize: f.keySize,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** Back to the code scanner's shape, so the CycloneDX inventory builder can be reused. */
|
|
55
|
+
export function toFinding(f) {
|
|
56
|
+
return {
|
|
57
|
+
kind: f.risk === "secret" ? "secret" : f.risk === "exposed" || f.primitive === "setting" ? "config" : "crypto",
|
|
58
|
+
ruleId: f.ruleId,
|
|
59
|
+
title: f.title,
|
|
60
|
+
algorithm: f.algorithm,
|
|
61
|
+
primitive: f.primitive,
|
|
62
|
+
risk: f.risk,
|
|
63
|
+
severity: f.severity,
|
|
64
|
+
file: f.target,
|
|
65
|
+
line: 0,
|
|
66
|
+
snippet: "",
|
|
67
|
+
fix: f.fix,
|
|
68
|
+
keySize: f.keySize,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// SPDX-License-Identifier: PolyForm-Shield-1.0.0
|
|
2
|
+
// Copyright 2026 Hard Keel (https://hardkeel.com)
|
|
3
|
+
// The encryption map report: text for the terminal, one self-contained HTML page, and JSON.
|
|
4
|
+
// Written to the customer's own disk. Nothing here is sent anywhere.
|
|
5
|
+
import { RATING_TITLES, TIER_NOTES, TIER_TITLES } from "./map-types.js";
|
|
6
|
+
import { toFinding } from "./map-rank.js";
|
|
7
|
+
import { gradeSentence, readinessScore } from "./score.js";
|
|
8
|
+
/** Post-quantum methods already in use count toward the score the same way they do in a code scan. */
|
|
9
|
+
function strengthSignals(strengths) {
|
|
10
|
+
return strengths.map((s) => ({ algorithm: s.algorithm, use: /DSA/.test(s.algorithm) ? "signature" : "key-establishment", file: s.target, line: 0 }));
|
|
11
|
+
}
|
|
12
|
+
const AREA_TITLES = { code: "Code and config", web: "Websites and public services", host: "This machine", network: "Network and equipment", vpn: "VPNs", cloud: "Cloud" };
|
|
13
|
+
export function buildMapReport(results, ranked, version, now = new Date(), accepted = [], extras = { cloudKeys: [], people: null }) {
|
|
14
|
+
const strengths = results.flatMap((r) => r.strengths);
|
|
15
|
+
const counts = { 1: 0, 2: 0, 3: 0, 4: 0 };
|
|
16
|
+
for (const f of ranked)
|
|
17
|
+
counts[f.tier]++;
|
|
18
|
+
const ratings = { high: 0, medium: 0, low: 0 };
|
|
19
|
+
for (const f of ranked)
|
|
20
|
+
ratings[f.rating ?? "low"]++;
|
|
21
|
+
return {
|
|
22
|
+
tool: "hard-keel-benthic",
|
|
23
|
+
version,
|
|
24
|
+
createdAt: now.toISOString(),
|
|
25
|
+
areas: results.map((r) => ({ area: r.area, checked: r.checked.length, skipped: r.skipped, errors: r.errors.map(({ target, kind, message }) => ({ target, kind, message })) })),
|
|
26
|
+
score: readinessScore(ranked.map(toFinding), strengthSignals(strengths)),
|
|
27
|
+
counts,
|
|
28
|
+
ratings,
|
|
29
|
+
findings: ranked,
|
|
30
|
+
strengths,
|
|
31
|
+
accepted,
|
|
32
|
+
cloudKeys: extras.cloudKeys,
|
|
33
|
+
people: extras.people,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** "3 high, 2 medium, 1 low", leaving out any that are zero. */
|
|
37
|
+
export function ratingsLine(r) {
|
|
38
|
+
return ["high", "medium", "low"].filter((k) => r.ratings[k]).map((k) => `${r.ratings[k]} ${k}`).join(", ");
|
|
39
|
+
}
|
|
40
|
+
export function peopleSentence(p) {
|
|
41
|
+
return `People and process: ${p.inPlace} of ${p.answered} in place (${p.score}/100), answered ${p.answeredAt}.`;
|
|
42
|
+
}
|
|
43
|
+
const custodyCount = (r, c) => r.cloudKeys.filter((a) => a.custody === c).length;
|
|
44
|
+
/** A grade only means something when at least one place was actually checked. */
|
|
45
|
+
export const nothingChecked = (r) => !r.areas.some((a) => a.checked > 0) && !r.findings.length && !r.strengths.length;
|
|
46
|
+
const NOT_GRADED = "Quantum readiness: not graded, because nothing was checked.";
|
|
47
|
+
export function mapText(r) {
|
|
48
|
+
const out = ["Hard Keel Benthic · encryption map", "", nothingChecked(r) ? NOT_GRADED : gradeSentence(r.score)];
|
|
49
|
+
if (r.people)
|
|
50
|
+
out.push(peopleSentence(r.people));
|
|
51
|
+
if (r.areas.length)
|
|
52
|
+
out.push("");
|
|
53
|
+
for (const a of r.areas) {
|
|
54
|
+
const bits = [`${a.checked} checked`];
|
|
55
|
+
if (a.skipped.length)
|
|
56
|
+
bits.push(`${a.skipped.length} skipped`);
|
|
57
|
+
if (a.errors.length)
|
|
58
|
+
bits.push(`${a.errors.length} couldn't be checked`);
|
|
59
|
+
out.push(` ${AREA_TITLES[a.area] ?? a.area}: ${bits.join(", ")}`);
|
|
60
|
+
}
|
|
61
|
+
const total = r.findings.length;
|
|
62
|
+
out.push("", total ? `${total} finding${total === 1 ? "" : "s"} (${ratingsLine(r)}), ranked by what breaks first.` : nothingChecked(r) ? "No scan areas were checked this time." : "Nothing found in the areas checked.");
|
|
63
|
+
for (const t of [1, 2, 3, 4]) {
|
|
64
|
+
const list = r.findings.filter((f) => f.tier === t);
|
|
65
|
+
if (!list.length)
|
|
66
|
+
continue;
|
|
67
|
+
out.push("", `${t}. ${TIER_TITLES[t]} (${list.length})`, ` ${TIER_NOTES[t]}`);
|
|
68
|
+
for (const f of list.slice(0, 25))
|
|
69
|
+
out.push(` [${RATING_TITLES[f.rating ?? "low"]}] ${f.target} ${f.title}`, ` ${f.fix}`);
|
|
70
|
+
if (list.length > 25)
|
|
71
|
+
out.push(` ...and ${list.length - 25} more in the report.`);
|
|
72
|
+
}
|
|
73
|
+
if (r.strengths.length) {
|
|
74
|
+
out.push("", `Already quantum-safe (${r.strengths.length})`);
|
|
75
|
+
for (const s of r.strengths.slice(0, 10))
|
|
76
|
+
out.push(` ${s.target} ${s.title}`);
|
|
77
|
+
}
|
|
78
|
+
if (r.cloudKeys.length) {
|
|
79
|
+
const prov = custodyCount(r, "provider");
|
|
80
|
+
out.push("", `Who can read your cloud data (${r.cloudKeys.length}), advice, not scored`);
|
|
81
|
+
out.push(` ${prov} with keys the provider holds, ${r.cloudKeys.length - prov} with keys in the provider's key service.`);
|
|
82
|
+
for (const a of r.cloudKeys.slice(0, 10))
|
|
83
|
+
out.push(` ${a.target} ${a.resource}: ${a.title}`);
|
|
84
|
+
if (r.cloudKeys.length > 10)
|
|
85
|
+
out.push(` ...and ${r.cloudKeys.length - 10} more in the report.`);
|
|
86
|
+
out.push(` ${r.cloudKeys.find((a) => a.custody === "provider")?.fix ?? r.cloudKeys[0].fix}`);
|
|
87
|
+
}
|
|
88
|
+
if (r.people?.gaps.length) {
|
|
89
|
+
out.push("", `People and process gaps (${r.people.gaps.length})`);
|
|
90
|
+
for (const g of r.people.gaps.slice(0, 12))
|
|
91
|
+
out.push(` ${g.answer === "no" ? "No" : "Not sure"}: ${g.question}`, ` ${g.fix}`);
|
|
92
|
+
}
|
|
93
|
+
if (r.accepted.length) {
|
|
94
|
+
out.push("", `Accepted as known leftovers (${r.accepted.length}), from ${".benthic-ignore"}; not counted in the score`);
|
|
95
|
+
for (const f of r.accepted.slice(0, 10))
|
|
96
|
+
out.push(` ${f.target} ${f.title}`);
|
|
97
|
+
}
|
|
98
|
+
const errors = r.areas.flatMap((a) => a.errors);
|
|
99
|
+
if (errors.length) {
|
|
100
|
+
out.push("", "Couldn't check");
|
|
101
|
+
for (const e of errors.slice(0, 10))
|
|
102
|
+
out.push(` ${e.target}: ${e.message}`);
|
|
103
|
+
if (errors.length > 10)
|
|
104
|
+
out.push(` ...and ${errors.length - 10} more in the report.`);
|
|
105
|
+
}
|
|
106
|
+
const skipped = r.areas.flatMap((a) => a.skipped);
|
|
107
|
+
if (skipped.length) {
|
|
108
|
+
out.push("", "Skipped");
|
|
109
|
+
for (const s of skipped.slice(0, 10))
|
|
110
|
+
out.push(` ${s.target}: ${s.reason}`);
|
|
111
|
+
if (skipped.length > 10)
|
|
112
|
+
out.push(` ...and ${skipped.length - 10} more in the report.`);
|
|
113
|
+
}
|
|
114
|
+
return out.join("\n");
|
|
115
|
+
}
|
|
116
|
+
const esc = (s) => s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
117
|
+
/** The locked Hard Keel lockup: teal rings and the Inter wordmark, outlined to shapes so it renders the same offline, with no font.
|
|
118
|
+
* Colors are plain attributes (CSS variables don't work in SVG attributes). The wordmark takes the text color, as on hardkeel.com. */
|
|
119
|
+
const LOGO = `<svg class="logo" viewBox="0 0 472 72" role="img" aria-label="Hard Keel"><g class="rings" transform="scale(1.125)" fill="none" stroke="#5aa99d" stroke-width="2.2" stroke-linecap="round"><path d="M 53.01 41.35 A 23 23 0 1 1 24.13 10.39"/><path d="M 17.43 26.70 A 15.5 15.5 0 1 1 40.89 44.70"/><path d="M 29.37 40.08 A 8.5 8.5 0 1 1 36.25 24.64"/></g><g class="dots" transform="scale(1.125)" fill="#5aa99d"><circle cx="32" cy="32" r="2.2"/><circle cx="53.01" cy="41.35" r="1.8"/><circle cx="17.43" cy="26.70" r="1.6"/><circle cx="29.37" cy="40.08" r="1.4"/></g><g class="wm" transform="translate(100,56) scale(0.02685,-0.02685)" fill="currentColor"><path d="M150 0H417V649H1110V0H1377V1490H1110V874H417V1490H150ZM1863 0H2155L2277 369H2834L2961 0H3254L2722 1490H2383ZM2348 584 2411 774C2452 907 2497 1074 2550 1282C2605 1076 2652 911 2696 774L2761 584ZM3739 0H4006V547H4284L4577 0H4876L4553 592C4729 662 4821 811 4821 1013C4821 1297 4639 1490 4296 1490H3739ZM4006 768V1266H4255C4458 1266 4548 1172 4548 1013C4548 855 4458 768 4257 768ZM5865 0C6319 0 6586 281 6586 747C6586 1210 6319 1490 5875 1490H5361V0ZM5628 231V1259H5859C6164 1259 6323 1088 6323 747C6323 403 6164 231 5852 231ZM8053 0H8320V447L8523 668L8975 0H9290L8708 845L9280 1490H8948L8557 1044C8459 930 8386 836 8316 729L8320 1048V1490H8053ZM9779 0H10751V225H10046V641H10695V863H10046V1265H10747V1490H9779ZM11305 0H12277V225H11572V641H12221V863H11572V1265H12273V1490H11305ZM12831 0H13756V225H13098V1490H12831Z"/></g></svg>`;
|
|
120
|
+
const ORDER = { high: 0, medium: 1, low: 2 };
|
|
121
|
+
const pill = (r) => (r ? `<span class="rate ${r}">${RATING_TITLES[r]}</span>` : "");
|
|
122
|
+
export function groupFindings(list) {
|
|
123
|
+
const groups = new Map();
|
|
124
|
+
for (const f of list) {
|
|
125
|
+
const key = `${f.area}\u0000${f.ruleId}\u0000${f.title}\u0000${f.fix}`;
|
|
126
|
+
const g = groups.get(key) ?? { area: AREA_TITLES[f.area] ?? f.area, title: f.title, fix: f.fix, targets: [], rating: f.rating };
|
|
127
|
+
g.targets.push(f.target);
|
|
128
|
+
if (f.rating && (!g.rating || ORDER[f.rating] < ORDER[g.rating]))
|
|
129
|
+
g.rating = f.rating; // a group is as urgent as its most urgent place
|
|
130
|
+
groups.set(key, g);
|
|
131
|
+
}
|
|
132
|
+
return [...groups.values()];
|
|
133
|
+
}
|
|
134
|
+
const MAX_PLACES = 40;
|
|
135
|
+
const places = (targets) => {
|
|
136
|
+
const shown = targets.slice(0, MAX_PLACES).map((t) => `<span>${esc(t)}</span>`).join("");
|
|
137
|
+
const more = targets.length > MAX_PLACES ? `<span class="more">and ${targets.length - MAX_PLACES} more, listed in map.json</span>` : "";
|
|
138
|
+
return `<div class="places">${shown}${more}</div>`;
|
|
139
|
+
};
|
|
140
|
+
const item = (g, num) => `<article class="item"><div class="num">${num}</div><div class="body"><h3>${esc(g.title)}</h3><div class="meta">${pill(g.rating)}${esc(g.area)}${g.targets.length > 1 ? ` · ${g.targets.length} places` : ""}</div>${places(g.targets)}<p class="fix"><span class="label">How to fix</span>${esc(g.fix)}</p></div></article>`;
|
|
141
|
+
const plural = (n, one, many = one + "s") => `${n} ${n === 1 ? one : many}`;
|
|
142
|
+
const longDate = (iso) => new Date(iso).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric", timeZone: "UTC" });
|
|
143
|
+
export function mapHtml(r, activity) {
|
|
144
|
+
const g = r.score;
|
|
145
|
+
const graded = !nothingChecked(r);
|
|
146
|
+
const tone = (grade) => (grade.startsWith("A") ? "good" : grade === "B" ? "ok" : "bad");
|
|
147
|
+
const byTier = [1, 2, 3, 4].map((t) => ({ t, groups: groupFindings(r.findings.filter((f) => f.tier === t)) }));
|
|
148
|
+
const total = r.findings.length;
|
|
149
|
+
const issues = byTier.reduce((n, x) => n + x.groups.length, 0);
|
|
150
|
+
const verdict = graded
|
|
151
|
+
? `<div class="verdict"><div class="badge ${tone(g.grade)}">${esc(g.grade)}</div><div><div class="score">Quantum readiness <strong>${g.score}</strong><span class="of">/100</span></div><p>${esc(gradeSentence(g).replace(/^Quantum readiness: [^.]+\.\s*/, ""))}</p></div></div>`
|
|
152
|
+
: `<div class="verdict"><div class="badge">–</div><div><div class="score">Quantum readiness not graded</div><p>Nothing was checked, so there is nothing to grade.</p></div></div>`;
|
|
153
|
+
const p = r.people;
|
|
154
|
+
const peopleVerdict = p
|
|
155
|
+
? `<div class="verdict small"><div class="badge ${p.score >= 90 ? "good" : p.score >= 60 ? "ok" : "bad"}">${p.score}</div><div><div class="score">People and process <strong>${p.inPlace}</strong><span class="of"> of ${p.answered} in place</span></div><p>From your own answers to the checklist, scored on their own.</p></div></div>`
|
|
156
|
+
: "";
|
|
157
|
+
const stats = `<div class="stats">${byTier.map(({ t }) => `<div class="stat t${t}"><div class="n">${r.counts[t]}</div><div class="k">${esc(TIER_TITLES[t])}</div></div>`).join("")}</div>`;
|
|
158
|
+
const ratingLine = total ? `<p class="scope"><span class="label">Rated</span>${["high", "medium", "low"].map((k) => `${pill(k)} ${r.ratings[k]}`).join(" ")}</p>` : "";
|
|
159
|
+
const checkedLine = r.areas.length
|
|
160
|
+
? `<p class="scope"><span class="label">Checked</span>${r.areas.map((a) => `${esc(AREA_TITLES[a.area] ?? a.area)} (${a.checked})`).join(" · ")}</p>`
|
|
161
|
+
: "";
|
|
162
|
+
const first = byTier.flatMap(({ t, groups }) => groups.map((x, i) => ({ x, num: `${t}.${i + 1}` }))).slice(0, 3);
|
|
163
|
+
const firstSection = first.length
|
|
164
|
+
? `<section class="first"><h2>Start here</h2><p class="note">The ${first.length === 1 ? "most urgent item" : `${first.length} most urgent items`}. Everything else is ranked below.</p><ol>${first.map(({ x, num }) => `<li><span class="num">${num}</span><div>${pill(x.rating)}<strong>${esc(x.title)}</strong>${x.targets.length > 1 ? ` <span class="muted">(${x.targets.length} places)</span>` : ` <span class="muted">${esc(x.targets[0])}</span>`}<div class="fix">${esc(x.fix)}</div></div></li>`).join("")}</ol></section>`
|
|
165
|
+
: "";
|
|
166
|
+
const tiers = byTier
|
|
167
|
+
.filter(({ groups }) => groups.length)
|
|
168
|
+
.map(({ t, groups }) => `<section class="tier t${t}"><h2><span class="dot"></span>${t}. ${esc(TIER_TITLES[t])} <span class="count">${plural(r.counts[t], "finding")}</span></h2><p class="note">${esc(TIER_NOTES[t])}</p>${groups.map((x, i) => item(x, `${t}.${i + 1}`)).join("")}</section>`)
|
|
169
|
+
.join("");
|
|
170
|
+
const strengths = r.strengths.length
|
|
171
|
+
? `<section><h2>Already quantum-safe <span class="count">${r.strengths.length}</span></h2><p class="note">Post-quantum methods already in use. These count toward the score.</p><ul class="plain">${r.strengths.map((s) => `<li><strong>${esc(s.title)}</strong><span class="where">${esc(s.target)}</span></li>`).join("")}</ul></section>`
|
|
172
|
+
: "";
|
|
173
|
+
const prov = custodyCount(r, "provider");
|
|
174
|
+
const kms = custodyCount(r, "provider-kms");
|
|
175
|
+
const cloud = r.cloudKeys.length
|
|
176
|
+
? `<section><h2>Who can read your cloud data <span class="count">${r.cloudKeys.length}</span></h2><p class="note">Advice, not scored. Keys held by a cloud provider protect against a stolen disk, not against the provider, someone working there, or a legal demand made to them. ${prov} ${prov === 1 ? "uses" : "use"} keys the provider holds; ${kms} ${kms === 1 ? "uses" : "use"} keys in the provider's key service.</p>${r.cloudKeys.map((a, i) => `<article class="item"><div class="num">C.${i + 1}</div><div class="body"><h3>${esc(a.title)}</h3><div class="meta">${esc(a.resource)}</div>${places([a.target])}<p class="fix"><span class="label">What to do</span>${esc(a.fix)}</p></div></article>`).join("")}</section>`
|
|
177
|
+
: "";
|
|
178
|
+
const people = p
|
|
179
|
+
? `<section><h2>People and process <span class="count">${p.inPlace} of ${p.answered} in place</span></h2><p class="note">Your own answers from ${esc(p.answeredAt)}. They stay on this machine and are never shared.</p>${p.gaps.length
|
|
180
|
+
? p.gaps.map((q, i) => `<article class="item"><div class="num">P.${i + 1}</div><div class="body"><h3>${esc(q.question)}</h3><div class="meta">${esc(q.group)} · answered ${q.answer === "no" ? "no" : "not sure"}</div><p class="fix"><span class="label">What to do</span>${esc(q.fix)}</p></div></article>`).join("")
|
|
181
|
+
: "<p>Everything you answered is in place.</p>"}</section>`
|
|
182
|
+
: "";
|
|
183
|
+
const accepted = r.accepted.length
|
|
184
|
+
? `<section><h2>Accepted as known leftovers <span class="count">${r.accepted.length}</span></h2><p class="note">Marked in .benthic-ignore. Listed so nothing is hidden, but left out of the counts and the score.</p>${groupFindings(r.accepted).map((x, i) => item(x, `A.${i + 1}`)).join("")}</section>`
|
|
185
|
+
: "";
|
|
186
|
+
const areas = r.areas
|
|
187
|
+
.map((a) => {
|
|
188
|
+
const extra = [...a.skipped.map((s) => `${s.target}: ${s.reason}`), ...a.errors.map((e) => `${e.target}: couldn't check (${e.message})`)];
|
|
189
|
+
return `<li><strong>${esc(AREA_TITLES[a.area] ?? a.area)}</strong><span class="sub2">${plural(a.checked, a.area === "code" ? "file" : "place")} checked${a.skipped.length ? `, ${a.skipped.length} skipped` : ""}${a.errors.length ? `, ${a.errors.length} couldn't be checked` : ""}</span>${extra.length ? `<ul>${extra.map((x) => `<li>${esc(x)}</li>`).join("")}</ul>` : ""}</li>`;
|
|
190
|
+
})
|
|
191
|
+
.join("");
|
|
192
|
+
const findingsIntro = total
|
|
193
|
+
? `<p class="lead">${plural(total, "finding")}${issues < total ? `, grouped into ${plural(issues, "issue")}` : ""}, ranked by what breaks first.</p>`
|
|
194
|
+
: `<p class="lead">${graded ? "Nothing to fix in the areas checked." : "No scan areas were checked this time."}</p>`;
|
|
195
|
+
return `<!doctype html>
|
|
196
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
197
|
+
<meta name="color-scheme" content="light dark">
|
|
198
|
+
<title>Encryption map · Hard Keel</title>
|
|
199
|
+
<style>
|
|
200
|
+
:root{--bg:#fff;--fg:#121a1f;--muted:#5b6873;--faint:#8a96a0;--line:#e3e8ec;--panel:#f6f8f9;--teal:#5aa99d;--accent:#2f7d71;--bad:#b4412f;--warn:#93630f;--good:#2f7d71;--t3:#4f6b8a}
|
|
201
|
+
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#0a0e12;--fg:#eef2f5;--muted:#9aa7b2;--faint:#6f7c87;--line:#1e262d;--panel:#10161b;--accent:#5aa99d;--bad:#e07a6a;--warn:#e0b25a;--good:#5aa99d;--t3:#8fb0d1}}
|
|
202
|
+
*{box-sizing:border-box}
|
|
203
|
+
html{-webkit-text-size-adjust:100%}
|
|
204
|
+
body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.6 Inter,"Segoe UI",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;-webkit-font-smoothing:antialiased}
|
|
205
|
+
main{max-width:820px;margin:0 auto;padding:40px 24px 72px}
|
|
206
|
+
.top{display:flex;align-items:center;justify-content:space-between;gap:16px;padding-bottom:18px;border-bottom:1px solid var(--line)}
|
|
207
|
+
.logo{height:26px;width:auto;display:block;color:var(--fg);-webkit-print-color-adjust:exact;print-color-adjust:exact}.logo .rings{stroke:#5aa99d}.logo .dots{fill:#5aa99d}
|
|
208
|
+
.top .tag{font-size:12px;letter-spacing:.14em;text-transform:uppercase;color:var(--faint);text-align:right}
|
|
209
|
+
.cover{padding:56px 0 8px}
|
|
210
|
+
.eyebrow{font-size:12px;letter-spacing:.18em;text-transform:uppercase;color:var(--accent);font-weight:600}
|
|
211
|
+
h1{font-size:40px;line-height:1.15;letter-spacing:-.02em;margin:10px 0 6px;font-weight:700}
|
|
212
|
+
.sub{color:var(--muted);margin:0}
|
|
213
|
+
.verdict{display:flex;gap:22px;align-items:center;margin:40px 0 0}
|
|
214
|
+
.verdict.small{margin-top:22px}
|
|
215
|
+
.badge{flex:none;width:84px;height:84px;border-radius:50%;display:block;text-align:center;line-height:78px;font-size:36px;font-weight:700;border:3px solid var(--muted);color:var(--muted)}
|
|
216
|
+
.verdict.small .badge{width:60px;height:60px;line-height:56px;font-size:20px;border-width:2px}
|
|
217
|
+
.badge.good{color:var(--good);border-color:var(--good)}.badge.ok{color:var(--warn);border-color:var(--warn)}.badge.bad{color:var(--bad);border-color:var(--bad)}
|
|
218
|
+
.score{font-size:20px;font-weight:500}.score strong{font-size:26px;font-weight:700}.of{color:var(--muted);font-weight:400}
|
|
219
|
+
.verdict p{margin:4px 0 0;color:var(--muted);max-width:56ch}
|
|
220
|
+
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:0;margin:44px 0 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}
|
|
221
|
+
.stat{padding:18px 16px 16px 0}.stat+.stat{padding-left:16px;border-left:1px solid var(--line)}
|
|
222
|
+
.stat .n{font-size:30px;font-weight:700;line-height:1.1}.stat .k{font-size:13px;color:var(--muted);margin-top:4px}
|
|
223
|
+
.stat.t1 .n{color:var(--bad)}.stat.t2 .n{color:var(--warn)}
|
|
224
|
+
.scope{font-size:13px;color:var(--muted);margin:16px 0 0}
|
|
225
|
+
.label{display:block;font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--faint);font-weight:600;margin-bottom:2px}
|
|
226
|
+
.scope .label{display:inline;margin-right:10px}
|
|
227
|
+
section{margin-top:64px}
|
|
228
|
+
h2{font-size:22px;letter-spacing:-.01em;margin:0 0 6px;font-weight:650}
|
|
229
|
+
.count{font-size:14px;color:var(--muted);font-weight:400;margin-left:8px;white-space:nowrap}
|
|
230
|
+
.note{color:var(--muted);margin:0 0 20px;max-width:62ch}
|
|
231
|
+
.lead{font-size:18px;margin:64px 0 0;color:var(--muted)}
|
|
232
|
+
.dot{display:inline-block;width:10px;height:10px;border-radius:50%;background:var(--faint);margin-right:10px;vertical-align:.15em}
|
|
233
|
+
.t1 .dot{background:var(--bad)}.t2 .dot{background:var(--warn)}.t3 .dot{background:var(--t3)}
|
|
234
|
+
.first{background:var(--panel);border-radius:14px;padding:28px 28px 8px;border-left:4px solid var(--teal)}
|
|
235
|
+
.first ol{list-style:none;margin:0;padding:0}
|
|
236
|
+
.first li{display:flex;gap:16px;padding:0 0 20px}
|
|
237
|
+
.first .num{font-weight:700;color:var(--accent);min-width:28px}
|
|
238
|
+
.fix{color:var(--muted);margin-top:2px}
|
|
239
|
+
.item{display:flex;gap:18px;padding:20px 0;border-top:1px solid var(--line);break-inside:avoid}
|
|
240
|
+
.item .num{flex:none;width:36px;font-weight:600;color:var(--faint);font-size:14px;padding-top:2px;font-variant-numeric:tabular-nums}
|
|
241
|
+
.item .body{min-width:0;flex:1}
|
|
242
|
+
h3{font-size:17px;margin:0;font-weight:600;line-height:1.4}
|
|
243
|
+
.meta{font-size:13px;color:var(--faint);margin-top:2px}
|
|
244
|
+
.rate{display:inline-block;font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;padding:1px 7px;border:1px solid currentColor;border-radius:999px;margin-right:8px;line-height:1.5}
|
|
245
|
+
.rate.high{color:var(--bad)}.rate.medium{color:var(--warn)}.rate.low{color:var(--muted)}
|
|
246
|
+
.places{display:flex;flex-wrap:wrap;gap:4px 14px;margin:8px 0 0;font:13px/1.5 "IBM Plex Mono",ui-monospace,"Cascadia Mono",Consolas,Menlo,monospace;color:var(--muted);word-break:break-all}
|
|
247
|
+
.places .more{font-family:inherit;color:var(--faint)}
|
|
248
|
+
.item .fix{margin:12px 0 0;color:var(--fg)}
|
|
249
|
+
ul.plain{list-style:none;margin:0;padding:0}
|
|
250
|
+
ul.plain>li{padding:14px 0;border-top:1px solid var(--line)}
|
|
251
|
+
ul.plain ul{margin:6px 0 0;padding-left:18px;color:var(--muted);font-size:14px}
|
|
252
|
+
.where{display:block;font-size:13px;color:var(--muted);font-family:"IBM Plex Mono",ui-monospace,Consolas,Menlo,monospace;word-break:break-all}
|
|
253
|
+
.muted{color:var(--muted)}.sub2{display:block;font-size:14px;color:var(--muted)}
|
|
254
|
+
.about p{color:var(--muted);max-width:64ch}
|
|
255
|
+
.actions{display:flex;gap:12px;align-items:center;margin-top:28px;flex-wrap:wrap}
|
|
256
|
+
button{font:inherit;font-size:14px;font-weight:600;padding:9px 16px;border-radius:8px;border:1px solid var(--accent);background:var(--accent);color:#fff;cursor:pointer}
|
|
257
|
+
.hint{font-size:13px;color:var(--faint)}
|
|
258
|
+
details{margin-top:40px;color:var(--muted)}summary{cursor:pointer}
|
|
259
|
+
pre{white-space:pre-wrap;font-size:12px;color:var(--muted)}
|
|
260
|
+
footer{margin-top:72px;padding-top:18px;border-top:1px solid var(--line);font-size:13px;color:var(--faint);display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap}
|
|
261
|
+
a{color:var(--accent)}
|
|
262
|
+
@media (max-width:640px){main{padding:24px 16px 56px}h1{font-size:30px}.cover{padding-top:36px}.stats{grid-template-columns:repeat(2,1fr)}.stat:nth-child(3){padding-left:0;border-left:0}.stat:nth-child(n+3){border-top:1px solid var(--line)}.badge{width:68px;height:68px;line-height:62px;font-size:30px}.first{padding:22px 18px 4px}.item{gap:12px}.item .num{width:30px}.top .tag{display:none}}
|
|
263
|
+
@page{size:letter;margin:16mm 16mm 20mm;@bottom-left{content:"Hard Keel · Encryption map · Confidential";font:8pt Inter,"Segoe UI",system-ui,sans-serif;color:#76828c}@bottom-right{content:"Page " counter(page) " of " counter(pages);font:8pt Inter,"Segoe UI",system-ui,sans-serif;color:#76828c}}
|
|
264
|
+
@media print{
|
|
265
|
+
:root{--bg:#fff;--fg:#121a1f;--muted:#4d5963;--faint:#76828c;--line:#d9dfe3;--panel:#f3f6f7;--accent:#2f7d71;--bad:#a0301f;--warn:#7a520c;--good:#2f7d71;--t3:#4f6b8a}
|
|
266
|
+
html,body{background:#fff}body{font-size:10.5pt;line-height:1.5;-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
267
|
+
main{max-width:none;padding:0}
|
|
268
|
+
.cover{padding-top:18pt}h1{font-size:26pt;margin:4pt 0 2pt}.verdict{margin-top:16pt}.verdict.small{margin-top:10pt}.badge{width:62px;height:62px;line-height:56px;font-size:26px}.verdict.small .badge{width:46px;height:46px;line-height:42px;font-size:15px}.score{font-size:14pt}.score strong{font-size:18pt}.stats{margin-top:16pt}.stat{padding-top:8pt;padding-bottom:8pt}.stat .n{font-size:20pt}.scope{margin-top:8pt}.first{margin-top:18pt;padding:14pt 16pt 2pt}.first li{padding-bottom:8pt}.first .note{margin-bottom:10pt}
|
|
269
|
+
.actions,details{display:none}
|
|
270
|
+
section{margin-top:28pt}.lead{margin-top:28pt;break-after:avoid}
|
|
271
|
+
h2{break-after:avoid}.note{break-after:avoid}
|
|
272
|
+
.first{break-inside:avoid}
|
|
273
|
+
.item{padding:10pt 0}
|
|
274
|
+
.tier{break-before:auto}
|
|
275
|
+
a{color:inherit;text-decoration:none}
|
|
276
|
+
footer{margin-top:36pt;break-inside:avoid}
|
|
277
|
+
}
|
|
278
|
+
</style></head><body><main>
|
|
279
|
+
<header class="top">${LOGO}<div class="tag">Confidential</div></header>
|
|
280
|
+
<div class="cover">
|
|
281
|
+
<div class="eyebrow">Quantum readiness report</div>
|
|
282
|
+
<h1>Encryption map</h1>
|
|
283
|
+
<p class="sub">Prepared ${esc(longDate(r.createdAt))} with Hard Keel Benthic ${esc(r.version)}</p>
|
|
284
|
+
${verdict}
|
|
285
|
+
${peopleVerdict}
|
|
286
|
+
${stats}
|
|
287
|
+
${ratingLine}
|
|
288
|
+
${checkedLine}
|
|
289
|
+
<div class="actions"><button type="button" onclick="window.print()">Save as PDF</button><span class="hint">In the print window, choose Save as PDF.</span></div>
|
|
290
|
+
</div>
|
|
291
|
+
${firstSection}
|
|
292
|
+
${findingsIntro}
|
|
293
|
+
${tiers}
|
|
294
|
+
${strengths}
|
|
295
|
+
${cloud}
|
|
296
|
+
${people}
|
|
297
|
+
${accepted}
|
|
298
|
+
<section><h2>What was checked</h2><ul class="plain">${areas || "<li>Nothing this time.</li>"}</ul></section>
|
|
299
|
+
<section class="about"><h2>About this report</h2><p>Benthic uses look-only checks: normal connections and local settings, with no logins, changes or attack traffic. Findings are ranked by what breaks first: weak encryption that is unsafe today, then traffic that could be recorded now and decrypted later, then long-lived signatures, then everything else that uses RSA or elliptic curves.</p><p>The grade uses Hard Keel method v${esc(g.method)}, the same as a code scan. This report was created on your computer and stays there unless you share it. It names your systems, so treat it as confidential.</p></section>
|
|
300
|
+
<details><summary>Activity log (${activity.length} entries)</summary><pre>${esc(activity.join("\n"))}</pre></details>
|
|
301
|
+
<footer><span>Hard Keel · Encryption map · Confidential</span><span>hardkeel.com · contact@hardkeel.com</span></footer>
|
|
302
|
+
</main></body></html>
|
|
303
|
+
`;
|
|
304
|
+
}
|