@cclabsnz/sf-audit 1.1.0 → 1.2.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/README.md +153 -31
- package/lib/checks/CheckEngine.js +1 -1
- package/lib/commands/audit/security.d.ts +5 -0
- package/lib/commands/audit/security.js +32 -3
- package/lib/compliance/catalogs/hiso10029.d.ts +3 -0
- package/lib/compliance/catalogs/hiso10029.js +35 -0
- package/lib/compliance/catalogs/index.d.ts +4 -0
- package/lib/compliance/catalogs/index.js +21 -0
- package/lib/compliance/catalogs/iso27001.d.ts +3 -0
- package/lib/compliance/catalogs/iso27001.js +39 -0
- package/lib/compliance/catalogs/nzism.d.ts +3 -0
- package/lib/compliance/catalogs/nzism.js +31 -0
- package/lib/compliance/catalogs/owasp.d.ts +3 -0
- package/lib/compliance/catalogs/owasp.js +37 -0
- package/lib/compliance/catalogs/privacyAct.d.ts +3 -0
- package/lib/compliance/catalogs/privacyAct.js +17 -0
- package/lib/compliance/catalogs/sbs.d.ts +3 -0
- package/lib/compliance/catalogs/sbs.js +61 -0
- package/lib/compliance/catalogs/soc2.d.ts +3 -0
- package/lib/compliance/catalogs/soc2.js +42 -0
- package/lib/compliance/mapping.d.ts +2 -0
- package/lib/compliance/mapping.js +111 -0
- package/lib/compliance/resolve.d.ts +12 -0
- package/lib/compliance/resolve.js +49 -0
- package/lib/compliance/types.d.ts +13 -0
- package/lib/compliance/types.js +2 -0
- package/lib/findings/CheckMeta.d.ts +9 -0
- package/lib/findings/CheckMeta.js +67 -0
- package/lib/renderers/AuditRenderer.d.ts +2 -0
- package/lib/renderers/ClientReportRenderer.d.ts +29 -0
- package/lib/renderers/ClientReportRenderer.js +205 -0
- package/lib/renderers/HtmlRenderer.js +1 -7
- package/lib/renderers/html-utils.d.ts +2 -0
- package/lib/renderers/html-utils.js +8 -0
- package/lib/report/ComplianceMatrix.d.ts +19 -0
- package/lib/report/ComplianceMatrix.js +47 -0
- package/lib/report/ExecutivePriorities.d.ts +8 -0
- package/lib/report/ExecutivePriorities.js +22 -0
- package/lib/report/RemediationRoadmap.d.ts +9 -0
- package/lib/report/RemediationRoadmap.js +18 -0
- package/lib/report/branding.d.ts +18 -0
- package/lib/report/branding.js +19 -0
- package/lib/report/fonts.d.ts +2 -0
- package/lib/report/fonts.js +22 -0
- package/package.json +2 -1
- package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
- package/config/queries/soql.json +0 -24
- package/config/queries/tooling.json +0 -28
- package/config/scoring.json +0 -17
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { esc } from './html-utils.js';
|
|
2
|
+
import { fontFaceCss } from '../report/fonts.js';
|
|
3
|
+
import { getCheckMeta } from '../findings/CheckMeta.js';
|
|
4
|
+
import { selectPriorities } from '../report/ExecutivePriorities.js';
|
|
5
|
+
import { buildRoadmap } from '../report/RemediationRoadmap.js';
|
|
6
|
+
import { buildComplianceMatrix } from '../report/ComplianceMatrix.js';
|
|
7
|
+
const SEV_COLOR = {
|
|
8
|
+
CRITICAL: '#7d3a3a', HIGH: '#a35a2a', MEDIUM: '#8a6d1f', LOW: '#3a5a82', INFO: '#636770',
|
|
9
|
+
};
|
|
10
|
+
const SEV_RANK = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3, INFO: 4 };
|
|
11
|
+
const GRADE_COLOR = {
|
|
12
|
+
A: '#4a7d5e', B: '#4a7d5e', C: '#8a6d1f', D: '#a35a2a', F: '#7d3a3a',
|
|
13
|
+
};
|
|
14
|
+
const SEV_ORDER = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'];
|
|
15
|
+
const FRAMEWORK_LABEL = {
|
|
16
|
+
OWASP: 'OWASP Top 10', SOC2: 'SOC 2', ISO27001: 'ISO/IEC 27001',
|
|
17
|
+
SBS: 'Security Benchmark for Salesforce', PRIVACY_ACT: 'NZ Privacy Act',
|
|
18
|
+
HISO10029: 'HISO 10029', NZISM: 'NZISM', HIPAA: 'HIPAA', GDPR: 'GDPR',
|
|
19
|
+
};
|
|
20
|
+
export class ClientReportRenderer {
|
|
21
|
+
opts;
|
|
22
|
+
format = 'executive';
|
|
23
|
+
fileExtension = '.html';
|
|
24
|
+
filenamePrefix = 'SF_Audit_Executive';
|
|
25
|
+
constructor(opts) {
|
|
26
|
+
this.opts = opts;
|
|
27
|
+
}
|
|
28
|
+
render(result) {
|
|
29
|
+
const b = this.opts.branding;
|
|
30
|
+
const chains = result.attackChains ?? [];
|
|
31
|
+
const chainIds = new Set();
|
|
32
|
+
for (const c of chains)
|
|
33
|
+
for (const s of c.steps)
|
|
34
|
+
chainIds.add(s.findingId);
|
|
35
|
+
const priorities = selectPriorities(result.findings, chainIds, this.opts.topN);
|
|
36
|
+
const roadmap = buildRoadmap(result.findings);
|
|
37
|
+
const matrix = buildComplianceMatrix(result, this.opts.frameworks);
|
|
38
|
+
let n = 0;
|
|
39
|
+
const num = () => String(++n).padStart(2, '0');
|
|
40
|
+
const sections = [
|
|
41
|
+
this.summary(result, num()),
|
|
42
|
+
this.prioritiesSection(priorities, chainIds, num()),
|
|
43
|
+
chains.length ? this.scenarios(chains, num()) : '',
|
|
44
|
+
this.roadmapSection(roadmap, num()),
|
|
45
|
+
matrix.length ? this.matrixSection(matrix, num()) : '',
|
|
46
|
+
this.findingsAppendix(result, num()),
|
|
47
|
+
].join('\n');
|
|
48
|
+
return `<!DOCTYPE html>
|
|
49
|
+
<html lang="en"><head><meta charset="utf-8"><title>Security Audit — ${esc(result.orgName)}</title>
|
|
50
|
+
<style>${fontFaceCss()}
|
|
51
|
+
:root{--ink:${b.ink};--bg:${b.bg};--bgalt:${b.bgAlt};--muted:${b.muted};--border:${b.border};--primary:${b.primary};
|
|
52
|
+
--display:'${b.fontDisplay}',Georgia,serif;--body:'${b.fontBody}',system-ui,sans-serif;--mono:ui-monospace,'SF Mono',Menlo,monospace;}
|
|
53
|
+
*{box-sizing:border-box}
|
|
54
|
+
html{-webkit-print-color-adjust:exact;print-color-adjust:exact}
|
|
55
|
+
body{font-family:var(--body);color:var(--ink);background:var(--bg);margin:0;line-height:1.6;font-variant-numeric:tabular-nums}
|
|
56
|
+
.wrap{max-width:780px;margin:0 auto;padding:64px 44px}
|
|
57
|
+
h1{font-family:var(--display);font-size:clamp(38px,6vw,52px);line-height:1.02;letter-spacing:-0.02em;margin:6px 0 0}
|
|
58
|
+
h2{font-family:var(--display);font-size:25px;letter-spacing:-0.01em;line-height:1.1;margin:0}
|
|
59
|
+
h3{font-family:var(--display);font-size:18px;letter-spacing:-0.01em;margin:0 0 6px}
|
|
60
|
+
p{margin:0 0 10px;max-width:68ch}
|
|
61
|
+
.label{font-family:var(--mono);text-transform:uppercase;letter-spacing:0.16em;font-size:11px;color:var(--muted)}
|
|
62
|
+
.muted{color:var(--muted)}
|
|
63
|
+
/* cover */
|
|
64
|
+
.cover{padding-bottom:8px}
|
|
65
|
+
.meta{font-family:var(--mono);font-size:11px;letter-spacing:0.12em;color:var(--muted);text-transform:uppercase;margin-top:6px}
|
|
66
|
+
.prepared{font-family:var(--mono);font-size:11px;letter-spacing:0.08em;color:var(--muted);text-transform:uppercase;margin-top:14px}
|
|
67
|
+
/* scorecard */
|
|
68
|
+
.scorecard{display:flex;align-items:center;gap:28px;margin:30px 0 8px;padding:24px 28px;background:var(--bgalt);border:1px solid var(--border);border-radius:12px;break-inside:avoid}
|
|
69
|
+
.grade{font-family:var(--display);font-size:104px;line-height:0.86;font-weight:400}
|
|
70
|
+
.score-num{font-family:var(--display);font-size:34px;line-height:1}
|
|
71
|
+
.score-num span{font-size:18px;color:var(--muted)}
|
|
72
|
+
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
|
|
73
|
+
.chip{font-family:var(--mono);font-size:11px;letter-spacing:0.04em;font-weight:600;color:var(--c);border:1px solid var(--c);border-radius:999px;padding:2px 9px;white-space:nowrap}
|
|
74
|
+
.chip.solid{background:var(--c);color:#fff;border-color:var(--c)}
|
|
75
|
+
.pnum{font-family:var(--mono);color:var(--primary);font-size:13px;letter-spacing:0.05em;margin-right:10px}
|
|
76
|
+
/* section markers */
|
|
77
|
+
.sec{display:flex;align-items:baseline;gap:14px;margin:56px 0 18px;border-bottom:1px solid var(--border);padding-bottom:10px}
|
|
78
|
+
.sec-num{font-family:var(--mono);font-size:13px;letter-spacing:0.1em;color:var(--primary)}
|
|
79
|
+
/* cards */
|
|
80
|
+
.card{background:var(--bgalt);border:1px solid var(--border);border-left:3px solid var(--c,var(--border));border-radius:8px;padding:16px 18px;margin:12px 0;break-inside:avoid}
|
|
81
|
+
.card .row{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
|
|
82
|
+
.scenario{border-left-width:3px}
|
|
83
|
+
/* roadmap */
|
|
84
|
+
.tier{display:flex;align-items:baseline;gap:10px;margin:22px 0 6px}
|
|
85
|
+
.tier h3{margin:0}
|
|
86
|
+
.count{font-family:var(--mono);font-size:11px;color:var(--muted);border:1px solid var(--border);border-radius:999px;padding:1px 8px}
|
|
87
|
+
.tier-list{list-style:none;margin:0;padding:0}
|
|
88
|
+
.tier-list li{display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid var(--border)}
|
|
89
|
+
/* findings appendix — denser, quieter */
|
|
90
|
+
.find{padding:12px 0;border-bottom:1px solid var(--border)}
|
|
91
|
+
.find h3{font-family:var(--body);font-size:15px;font-weight:600;margin:0 0 3px}
|
|
92
|
+
.find p{font-size:13px;color:var(--muted);margin:0}
|
|
93
|
+
.matrix{width:100%;border-collapse:collapse;margin:8px 0 22px;font-size:13px}
|
|
94
|
+
.matrix th{text-align:left;font-family:var(--mono);text-transform:uppercase;letter-spacing:0.08em;font-size:10px;color:var(--muted);border-bottom:1px solid var(--border);padding:6px 8px}
|
|
95
|
+
.matrix td{border-bottom:1px solid var(--border);padding:7px 8px;vertical-align:top}
|
|
96
|
+
.matrix .cid{font-family:var(--mono);font-size:12px;color:var(--primary);white-space:nowrap}
|
|
97
|
+
.matrix .st{text-align:right;white-space:nowrap}
|
|
98
|
+
footer{margin-top:56px;border-top:1px solid var(--border);padding-top:18px;color:var(--muted);font-size:12px;line-height:1.55}
|
|
99
|
+
footer .label{display:block;margin-bottom:6px;color:var(--ink)}
|
|
100
|
+
@page{margin:18mm}
|
|
101
|
+
@media print{.wrap{padding:0 0 24px}.sec{break-after:avoid}.card,.scorecard{break-inside:avoid}}
|
|
102
|
+
</style></head><body><div class="wrap">
|
|
103
|
+
${this.cover(result, b)}
|
|
104
|
+
${sections}
|
|
105
|
+
${this.footer(b)}
|
|
106
|
+
</div></body></html>`;
|
|
107
|
+
}
|
|
108
|
+
chip(sev, text) {
|
|
109
|
+
const solid = sev === 'CRITICAL' ? ' solid' : '';
|
|
110
|
+
return `<span class="chip${solid}" style="--c:${SEV_COLOR[sev]}">${esc(text)}</span>`;
|
|
111
|
+
}
|
|
112
|
+
sectionHead(numStr, title) {
|
|
113
|
+
return `<div class="sec"><span class="sec-num">${numStr} /</span><h2>${esc(title)}</h2></div>`;
|
|
114
|
+
}
|
|
115
|
+
cover(r, b) {
|
|
116
|
+
const meta = [r.orgName, r.orgType, r.orgId, r.generatedAt.toISOString().slice(0, 10)]
|
|
117
|
+
.map((s) => esc(String(s))).join(' · ');
|
|
118
|
+
const counts = SEV_ORDER
|
|
119
|
+
.map((l) => ({ l, n: r.findings.filter((f) => f.riskLevel === l && !f.passed && !f.inconclusive).length }))
|
|
120
|
+
.filter((c) => c.n > 0)
|
|
121
|
+
.map((c) => this.chip(c.l, `${c.n} ${c.l}`)).join('');
|
|
122
|
+
const prepared = b.preparedFor ? ` for ${esc(b.preparedFor)}` : '';
|
|
123
|
+
return `<header class="cover">
|
|
124
|
+
<div class="label">${esc(b.firmName)}</div>
|
|
125
|
+
<h1>Salesforce Security Audit</h1>
|
|
126
|
+
<div class="meta">${meta}</div>
|
|
127
|
+
<div class="scorecard" style="border-left:4px solid ${GRADE_COLOR[r.grade] ?? b.primary}">
|
|
128
|
+
<div class="grade" style="color:${GRADE_COLOR[r.grade] ?? b.primary}">${esc(r.grade)}</div>
|
|
129
|
+
<div>
|
|
130
|
+
<div class="label">Security grade · health score</div>
|
|
131
|
+
<div class="score-num">${r.healthScore}<span>/100</span></div>
|
|
132
|
+
<div class="chips">${counts || this.chip('LOW', 'No active findings')}</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="prepared">Prepared by ${esc(b.firmName)}${prepared}</div></header>`;
|
|
136
|
+
}
|
|
137
|
+
summary(r, numStr) {
|
|
138
|
+
const incon = r.findings.filter((f) => f.inconclusive).length;
|
|
139
|
+
const active = r.findings.filter((f) => !f.passed && !f.inconclusive).length;
|
|
140
|
+
return `${this.sectionHead(numStr, 'Executive Summary')}
|
|
141
|
+
<p>This audit assessed the org’s security configuration and scored it <strong>${r.healthScore}/100 (Grade ${esc(r.grade)})</strong> across ${active} active finding${active === 1 ? '' : 's'}${incon ? `, with ${incon} inconclusive (insufficient access)` : ''}. The priorities below are the highest-impact items to address first; the remediation roadmap groups every fix by effort. See Scope & Liability for the basis and limits of this assessment.</p>`;
|
|
142
|
+
}
|
|
143
|
+
prioritiesSection(priorities, chainIds, numStr) {
|
|
144
|
+
const head = this.sectionHead(numStr, 'Executive Priorities');
|
|
145
|
+
if (priorities.length === 0)
|
|
146
|
+
return `${head}<p class="muted">No active findings to prioritise.</p>`;
|
|
147
|
+
const items = priorities.map((f, i) => {
|
|
148
|
+
const meta = f.checkId ? getCheckMeta(f.checkId) : undefined;
|
|
149
|
+
const chained = chainIds.has(f.id) ? '<p class="muted">Part of an attack chain — see Attack Scenarios.</p>' : '';
|
|
150
|
+
const impact = meta ? `<p><strong>Impact:</strong> ${esc(meta.impact)}</p>` : '';
|
|
151
|
+
return `<div class="card" style="--c:${SEV_COLOR[f.riskLevel]}">
|
|
152
|
+
<div class="row"><h3><span class="pnum">${String(i + 1).padStart(2, '0')}</span>${esc(f.title)}</h3>${this.chip(f.riskLevel, f.riskLevel)}</div>
|
|
153
|
+
${impact}${chained}<p><strong>Fix:</strong> ${esc(f.remediation)}</p></div>`;
|
|
154
|
+
}).join('');
|
|
155
|
+
return `${head}<p class="muted">Focus areas, highest impact first.</p>${items}`;
|
|
156
|
+
}
|
|
157
|
+
scenarios(chains, numStr) {
|
|
158
|
+
const items = chains.map((c) => `<div class="card scenario" style="--c:${SEV_COLOR[c.severity]}">
|
|
159
|
+
<div class="row"><h3>${esc(c.title)}</h3>${this.chip(c.severity, c.severity)}</div>
|
|
160
|
+
<p>${esc(c.narrative)}</p><p><strong>Breaks the chain:</strong> ${esc(c.remediation)}</p></div>`).join('');
|
|
161
|
+
return `${this.sectionHead(numStr, 'Attack Scenarios')}<p class="muted">How findings combine into real attack paths.</p>${items}`;
|
|
162
|
+
}
|
|
163
|
+
roadmapSection(roadmap, numStr) {
|
|
164
|
+
const tier = (label, sub, arr) => {
|
|
165
|
+
if (arr.length === 0)
|
|
166
|
+
return '';
|
|
167
|
+
const rows = arr.map((f) => `<li><span>${esc(f.title)}</span>${this.chip(f.riskLevel, f.riskLevel)}</li>`).join('');
|
|
168
|
+
return `<div class="tier"><h3>${esc(label)}</h3><span class="count">${arr.length} · ${esc(sub)}</span></div><ul class="tier-list">${rows}</ul>`;
|
|
169
|
+
};
|
|
170
|
+
return `${this.sectionHead(numStr, 'Remediation Roadmap')}
|
|
171
|
+
${tier('Quick wins', '≤1 day', roadmap.quick)}
|
|
172
|
+
${tier('Moderate', 'days', roadmap.moderate)}
|
|
173
|
+
${tier('Projects', 'weeks', roadmap.project)}`;
|
|
174
|
+
}
|
|
175
|
+
worst(findings) {
|
|
176
|
+
return findings.slice().sort((a, b) => SEV_RANK[a.riskLevel] - SEV_RANK[b.riskLevel])[0]?.riskLevel;
|
|
177
|
+
}
|
|
178
|
+
matrixSection(matrix, numStr) {
|
|
179
|
+
const blocks = matrix.map((fm) => {
|
|
180
|
+
const rows = fm.rows.map((row) => {
|
|
181
|
+
const w = this.worst(row.findings);
|
|
182
|
+
const status = w
|
|
183
|
+
? this.chip(w, `${row.findings.length} finding${row.findings.length === 1 ? '' : 's'}`)
|
|
184
|
+
: '<span class="muted">No findings detected</span>';
|
|
185
|
+
return `<tr><td class="cid">${esc(row.control.id)}</td><td>${esc(row.control.title)}</td><td class="st">${status}</td></tr>`;
|
|
186
|
+
}).join('');
|
|
187
|
+
return `<h3>${esc(FRAMEWORK_LABEL[fm.framework])} <span class="muted">· ${esc(fm.version)}</span></h3>
|
|
188
|
+
<table class="matrix"><thead><tr><th>Control</th><th>Requirement area</th><th>Status</th></tr></thead><tbody>${rows}</tbody></table>`;
|
|
189
|
+
}).join('');
|
|
190
|
+
return `${this.sectionHead(numStr, 'Compliance Coverage')}<p class="muted">Findings mapped to framework controls. “No findings detected” is not an attestation of compliance — see Scope & Liability.</p>${blocks}`;
|
|
191
|
+
}
|
|
192
|
+
findingsAppendix(r, numStr) {
|
|
193
|
+
const rows = r.findings.map((f) => {
|
|
194
|
+
const tag = f.inconclusive ? this.chip('INFO', 'inconclusive') : f.passed ? this.chip('INFO', 'passed') : this.chip(f.riskLevel, f.riskLevel);
|
|
195
|
+
return `<div class="find"><div class="row"><h3>${esc(f.title)}</h3>${tag}</div>
|
|
196
|
+
<p>${esc(f.detail)}</p><p><strong>Remediation:</strong> ${esc(f.remediation)}</p></div>`;
|
|
197
|
+
}).join('');
|
|
198
|
+
return `${this.sectionHead(numStr, 'All Findings')}${rows}`;
|
|
199
|
+
}
|
|
200
|
+
footer(b) {
|
|
201
|
+
return `<footer><span class="label">Scope & Liability</span>
|
|
202
|
+
Read-only, point-in-time configuration review — not a penetration test, not a code audit. The grade is a prioritisation aid, not a certification. Validate findings before remediation. © ${new Date().getFullYear()} ${esc(b.firmName)} · ${esc(b.contact)}</footer>`;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=ClientReportRenderer.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { esc } from './html-utils.js';
|
|
1
2
|
const RISK_COLORS = {
|
|
2
3
|
CRITICAL: '#dc2626',
|
|
3
4
|
HIGH: '#ea580c',
|
|
@@ -17,13 +18,6 @@ const PASS_BG = 'rgba(34,197,94,0.10)';
|
|
|
17
18
|
const GRADE_COLOR = {
|
|
18
19
|
A: '#22c55e', B: '#84cc16', C: '#eab308', D: '#f97316', F: '#ef4444',
|
|
19
20
|
};
|
|
20
|
-
function esc(str) {
|
|
21
|
-
return str
|
|
22
|
-
.replace(/&/g, '&')
|
|
23
|
-
.replace(/</g, '<')
|
|
24
|
-
.replace(/>/g, '>')
|
|
25
|
-
.replace(/"/g, '"');
|
|
26
|
-
}
|
|
27
21
|
// ── Dashboard helpers ────────────────────────────────────────────────────────
|
|
28
22
|
function statusColor(value, warnThreshold, dangerThreshold) {
|
|
29
23
|
if (value <= warnThreshold)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AuditResult } from '../findings/AuditResult.js';
|
|
2
|
+
import type { Finding } from '../findings/Finding.js';
|
|
3
|
+
import type { ControlDef, Framework } from '../compliance/types.js';
|
|
4
|
+
export interface MatrixRow {
|
|
5
|
+
control: ControlDef;
|
|
6
|
+
findings: Finding[];
|
|
7
|
+
}
|
|
8
|
+
export interface FrameworkMatrix {
|
|
9
|
+
framework: Framework;
|
|
10
|
+
version: string;
|
|
11
|
+
rows: MatrixRow[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Invert the check→control mapping into framework→control→findings, for verified controls
|
|
15
|
+
* in the selected frameworks only. A control is "in scope" if any check maps to it; its row
|
|
16
|
+
* carries the active (non-passed, non-inconclusive) findings whose check maps to that control.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildComplianceMatrix(result: AuditResult, frameworks: Framework[]): FrameworkMatrix[];
|
|
19
|
+
//# sourceMappingURL=ComplianceMatrix.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CHECK_CONTROL_MAP } from '../compliance/mapping.js';
|
|
2
|
+
import { getControl } from '../compliance/catalogs/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Invert the check→control mapping into framework→control→findings, for verified controls
|
|
5
|
+
* in the selected frameworks only. A control is "in scope" if any check maps to it; its row
|
|
6
|
+
* carries the active (non-passed, non-inconclusive) findings whose check maps to that control.
|
|
7
|
+
*/
|
|
8
|
+
export function buildComplianceMatrix(result, frameworks) {
|
|
9
|
+
const fwSet = new Set(frameworks);
|
|
10
|
+
const active = result.findings.filter((f) => !f.passed && !f.inconclusive);
|
|
11
|
+
const inScope = new Map();
|
|
12
|
+
const hits = new Map();
|
|
13
|
+
for (const controlIds of Object.values(CHECK_CONTROL_MAP)) {
|
|
14
|
+
for (const id of controlIds) {
|
|
15
|
+
const c = getControl(id);
|
|
16
|
+
if (!c || !c.verified || !fwSet.has(c.framework))
|
|
17
|
+
continue;
|
|
18
|
+
inScope.set(id, c);
|
|
19
|
+
if (!hits.has(id))
|
|
20
|
+
hits.set(id, []);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
for (const f of active) {
|
|
24
|
+
if (!f.checkId)
|
|
25
|
+
continue;
|
|
26
|
+
for (const id of CHECK_CONTROL_MAP[f.checkId] ?? []) {
|
|
27
|
+
if (hits.has(id))
|
|
28
|
+
hits.get(id).push(f);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const byFw = new Map();
|
|
32
|
+
for (const [id, control] of inScope) {
|
|
33
|
+
const rows = byFw.get(control.framework) ?? [];
|
|
34
|
+
rows.push({ control, findings: hits.get(id) ?? [] });
|
|
35
|
+
byFw.set(control.framework, rows);
|
|
36
|
+
}
|
|
37
|
+
const out = [];
|
|
38
|
+
for (const fw of frameworks) {
|
|
39
|
+
const rows = byFw.get(fw);
|
|
40
|
+
if (!rows || rows.length === 0)
|
|
41
|
+
continue;
|
|
42
|
+
rows.sort((a, b) => a.control.id.localeCompare(b.control.id, undefined, { numeric: true }));
|
|
43
|
+
out.push({ framework: fw, version: rows[0].control.version, rows });
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ComplianceMatrix.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Finding } from '../findings/Finding.js';
|
|
2
|
+
/**
|
|
3
|
+
* Select the top-N findings to surface as executive priorities.
|
|
4
|
+
* Order: severity, then findings that participate in an attack chain, then title.
|
|
5
|
+
* Excludes passed and inconclusive findings.
|
|
6
|
+
*/
|
|
7
|
+
export declare function selectPriorities(findings: Finding[], chainFindingIds: Set<string>, topN: number): Finding[];
|
|
8
|
+
//# sourceMappingURL=ExecutivePriorities.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const RANK = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3, INFO: 4 };
|
|
2
|
+
/**
|
|
3
|
+
* Select the top-N findings to surface as executive priorities.
|
|
4
|
+
* Order: severity, then findings that participate in an attack chain, then title.
|
|
5
|
+
* Excludes passed and inconclusive findings.
|
|
6
|
+
*/
|
|
7
|
+
export function selectPriorities(findings, chainFindingIds, topN) {
|
|
8
|
+
return findings
|
|
9
|
+
.filter((f) => !f.passed && !f.inconclusive)
|
|
10
|
+
.slice()
|
|
11
|
+
.sort((a, b) => {
|
|
12
|
+
if (RANK[a.riskLevel] !== RANK[b.riskLevel])
|
|
13
|
+
return RANK[a.riskLevel] - RANK[b.riskLevel];
|
|
14
|
+
const ac = chainFindingIds.has(a.id) ? 0 : 1;
|
|
15
|
+
const bc = chainFindingIds.has(b.id) ? 0 : 1;
|
|
16
|
+
if (ac !== bc)
|
|
17
|
+
return ac - bc;
|
|
18
|
+
return a.title.localeCompare(b.title);
|
|
19
|
+
})
|
|
20
|
+
.slice(0, topN);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ExecutivePriorities.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Finding } from '../findings/Finding.js';
|
|
2
|
+
export interface Roadmap {
|
|
3
|
+
quick: Finding[];
|
|
4
|
+
moderate: Finding[];
|
|
5
|
+
project: Finding[];
|
|
6
|
+
}
|
|
7
|
+
/** Group active findings into effort tiers, risk-sorted within each. Unknown checkId → moderate. */
|
|
8
|
+
export declare function buildRoadmap(findings: Finding[]): Roadmap;
|
|
9
|
+
//# sourceMappingURL=RemediationRoadmap.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getCheckMeta } from '../findings/CheckMeta.js';
|
|
2
|
+
const RANK = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3, INFO: 4 };
|
|
3
|
+
/** Group active findings into effort tiers, risk-sorted within each. Unknown checkId → moderate. */
|
|
4
|
+
export function buildRoadmap(findings) {
|
|
5
|
+
const out = { quick: [], moderate: [], project: [] };
|
|
6
|
+
for (const f of findings) {
|
|
7
|
+
if (f.passed || f.inconclusive)
|
|
8
|
+
continue;
|
|
9
|
+
const effort = (f.checkId && getCheckMeta(f.checkId)?.effort) || 'moderate';
|
|
10
|
+
out[effort].push(f);
|
|
11
|
+
}
|
|
12
|
+
const sort = (arr) => arr.sort((a, b) => RANK[a.riskLevel] - RANK[b.riskLevel]);
|
|
13
|
+
sort(out.quick);
|
|
14
|
+
sort(out.moderate);
|
|
15
|
+
sort(out.project);
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=RemediationRoadmap.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface Branding {
|
|
2
|
+
firmName: string;
|
|
3
|
+
primary: string;
|
|
4
|
+
ink: string;
|
|
5
|
+
bg: string;
|
|
6
|
+
bgAlt: string;
|
|
7
|
+
muted: string;
|
|
8
|
+
border: string;
|
|
9
|
+
fontDisplay: string;
|
|
10
|
+
fontBody: string;
|
|
11
|
+
contact: string;
|
|
12
|
+
logoPath?: string;
|
|
13
|
+
preparedFor?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_BRANDING: Branding;
|
|
16
|
+
export type BrandingOverrides = Partial<Branding>;
|
|
17
|
+
export declare function resolveBranding(overrides: BrandingOverrides | undefined, preparedFor: string | undefined): Branding;
|
|
18
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const DEFAULT_BRANDING = {
|
|
2
|
+
firmName: 'CloudCounsel Limited',
|
|
3
|
+
primary: '#3a5a82',
|
|
4
|
+
ink: '#1a1d24',
|
|
5
|
+
bg: '#faf6ef',
|
|
6
|
+
bgAlt: '#f7f7f2',
|
|
7
|
+
muted: '#636770',
|
|
8
|
+
border: '#e9e9e3',
|
|
9
|
+
fontDisplay: 'DM Serif Display',
|
|
10
|
+
fontBody: 'DM Sans',
|
|
11
|
+
contact: 'hello@cloudcounsel.co.nz',
|
|
12
|
+
};
|
|
13
|
+
export function resolveBranding(overrides, preparedFor) {
|
|
14
|
+
const merged = { ...DEFAULT_BRANDING, ...(overrides ?? {}) };
|
|
15
|
+
if (preparedFor)
|
|
16
|
+
merged.preparedFor = preparedFor;
|
|
17
|
+
return merged;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=branding.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
// Resolves to <packageRoot>/src/assets/fonts from both lib/report (compiled) and src/report (ts-jest).
|
|
6
|
+
const FONT_DIR = join(HERE, '..', '..', 'src', 'assets', 'fonts');
|
|
7
|
+
function dataUri(file) {
|
|
8
|
+
const buf = readFileSync(join(FONT_DIR, file));
|
|
9
|
+
return `data:font/woff2;base64,${buf.toString('base64')}`;
|
|
10
|
+
}
|
|
11
|
+
function face(family, style, file) {
|
|
12
|
+
return `@font-face{font-family: '${family}';font-style:${style};font-display:swap;src:url(${dataUri(file)}) format('woff2');}`;
|
|
13
|
+
}
|
|
14
|
+
export function fontFaceCss() {
|
|
15
|
+
return [
|
|
16
|
+
face('DM Sans', 'normal', 'dm-sans-normal-latin.woff2'),
|
|
17
|
+
face('DM Sans', 'italic', 'dm-sans-italic-latin.woff2'),
|
|
18
|
+
face('DM Serif Display', 'normal', 'dm-serif-display-normal-latin.woff2'),
|
|
19
|
+
face('DM Serif Display', 'italic', 'dm-serif-display-italic-latin.woff2'),
|
|
20
|
+
].join('\n');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=fonts.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Salesforce Security Audit — native sf plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"/lib",
|
|
59
59
|
"/messages",
|
|
60
60
|
"/config",
|
|
61
|
+
"/src/assets",
|
|
61
62
|
"!/lib/**/*.map"
|
|
62
63
|
]
|
|
63
64
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/config/queries/soql.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"activeStandardUsers": {
|
|
3
|
-
"api": "soql",
|
|
4
|
-
"soql": "SELECT Id, Username, ProfileId FROM User WHERE IsActive = true AND UserType = 'Standard'",
|
|
5
|
-
"description": "All active standard users — used by MFA, admin, and inactive checks"
|
|
6
|
-
},
|
|
7
|
-
"profileIpRanges": {
|
|
8
|
-
"api": "soql",
|
|
9
|
-
"soql": "SELECT ProfileId, StartAddress, EndAddress FROM ProfileLoginIpRange",
|
|
10
|
-
"description": "Profile login IP ranges — not queryable in all org configurations",
|
|
11
|
-
"fallbackOnError": true
|
|
12
|
-
},
|
|
13
|
-
"orgLimits": {
|
|
14
|
-
"api": "rest",
|
|
15
|
-
"path": "/limits",
|
|
16
|
-
"description": "Org API governor limits — fetched via ctx.rest.get('/limits')"
|
|
17
|
-
},
|
|
18
|
-
"sobjectDescribe": {
|
|
19
|
-
"api": "rest",
|
|
20
|
-
"path": "/sobjects/{sobjectType}/describe/",
|
|
21
|
-
"description": "SObject describe for OWD/sharing model — called per object via ctx.rest.get(). Used by SharingModelCheck.",
|
|
22
|
-
"fallbackOnError": true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"apexClasses": {
|
|
3
|
-
"api": "tooling",
|
|
4
|
-
"soql": "SELECT Id, Name, Body, LengthWithoutComments, NamespacePrefix FROM ApexClass WHERE NamespacePrefix = null",
|
|
5
|
-
"description": "All custom Apex classes — used by HardcodedCredentialsCheck (populates apexBodies cache) and ApexSharingCheck"
|
|
6
|
-
},
|
|
7
|
-
"activeFlows": {
|
|
8
|
-
"api": "tooling",
|
|
9
|
-
"soql": "SELECT Id, MasterLabel, ProcessType, Status, RunInMode FROM Flow WHERE Status = 'Active'",
|
|
10
|
-
"description": "Active Flow versions — used by FlowSecurityCheck"
|
|
11
|
-
},
|
|
12
|
-
"connectedAppsBasic": {
|
|
13
|
-
"api": "tooling",
|
|
14
|
-
"soql": "SELECT Id, Name FROM ConnectedApplication",
|
|
15
|
-
"description": "Connected App ID list — used by IpRestrictionsCheck to fetch per-record Metadata blobs"
|
|
16
|
-
},
|
|
17
|
-
"connectedAppDetail": {
|
|
18
|
-
"api": "rest",
|
|
19
|
-
"path": "tooling/sobjects/ConnectedApplication/{id}/",
|
|
20
|
-
"description": "Per-record Connected App metadata — call via ctx.tooling.getRecord('ConnectedApplication', id).",
|
|
21
|
-
"fallbackOnError": true
|
|
22
|
-
},
|
|
23
|
-
"connectedAppsStandard": {
|
|
24
|
-
"api": "soql",
|
|
25
|
-
"soql": "SELECT Id, Name, Status, StartUrl FROM ConnectedApplication",
|
|
26
|
-
"description": "Connected Apps basic info — used by ConnectedAppsCheck via standard SOQL"
|
|
27
|
-
}
|
|
28
|
-
}
|
package/config/scoring.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"riskScores": {
|
|
3
|
-
"CRITICAL": 10,
|
|
4
|
-
"HIGH": 7,
|
|
5
|
-
"MEDIUM": 4,
|
|
6
|
-
"LOW": 1,
|
|
7
|
-
"INFO": 0
|
|
8
|
-
},
|
|
9
|
-
"checkWeights": {},
|
|
10
|
-
"gradeThresholds": {
|
|
11
|
-
"A": { "minScore": 85, "maxHigh": 0 },
|
|
12
|
-
"B": { "minScore": 70, "maxHigh": 1 },
|
|
13
|
-
"C": { "minScore": 55, "maxHigh": 3 },
|
|
14
|
-
"D": { "minScore": 40, "maxCritical": 0 },
|
|
15
|
-
"F": {}
|
|
16
|
-
}
|
|
17
|
-
}
|