@cclabsnz/sf-audit 1.18.1 → 1.20.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 +64 -0
- package/lib/apps/apiLogSource.js +3 -2
- package/lib/chains/AttackChain.d.ts +12 -0
- package/lib/chains/ChainEngine.js +12 -3
- package/lib/chains/namedChains.d.ts +72 -0
- package/lib/chains/namedChains.js +381 -207
- package/lib/checks/CheckEngine.js +5 -2
- package/lib/checks/impl/AgentActionSurfaceCheck.js +2 -13
- package/lib/checks/impl/AgentInventoryCheck.js +2 -15
- package/lib/checks/impl/ApexLoggingCheck.js +2 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +2 -0
- package/lib/checks/impl/GuestUserAccessCheck.js +2 -0
- package/lib/checks/impl/UsersAndAdminsCheck.js +91 -26
- package/lib/checks/support/missingObject.js +2 -1
- package/lib/checks/support/schema.js +1 -1
- package/lib/commands/audit/incident/collect.js +2 -1
- package/lib/findings/Finding.d.ts +7 -0
- package/lib/findings/unknownMetrics.d.ts +5 -0
- package/lib/findings/unknownMetrics.js +29 -0
- package/lib/history/DiffEngine.js +6 -1
- package/lib/incident/collect/orgErrors.js +3 -1
- package/lib/incident/collect/streamGuestLogs.js +3 -2
- package/lib/lib/apiErrorText.d.ts +8 -0
- package/lib/lib/apiErrorText.js +15 -0
- package/lib/renderers/AttackChainDagRenderer.d.ts +5 -1
- package/lib/renderers/AttackChainDagRenderer.js +16 -31
- package/lib/renderers/ClientReportRenderer.js +4 -1
- package/lib/renderers/HtmlRenderer.js +23 -7
- package/lib/renderers/MarkdownRenderer.js +61 -2
- package/lib/renderers/SarifRenderer.js +10 -2
- package/lib/threats/linddun.d.ts +3 -0
- package/lib/threats/linddun.js +40 -0
- package/lib/threats/resolve.d.ts +8 -0
- package/lib/threats/resolve.js +18 -0
- package/lib/threats/stride.d.ts +3 -0
- package/lib/threats/stride.js +120 -0
- package/lib/threats/types.d.ts +16 -0
- package/lib/threats/types.js +22 -0
- package/lib/threats/view.d.ts +27 -0
- package/lib/threats/view.js +51 -0
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { esc, firaFontFaceCss, INTERACTIVE_CSP_META } from '@cclabsnz/sf-core';
|
|
2
2
|
import { renderAttackChainDagSvg } from './AttackChainDagRenderer.js';
|
|
3
3
|
import { coverageSummary, coverageAdvice } from '../findings/coverage.js';
|
|
4
|
+
import { unknownMetrics } from '../findings/unknownMetrics.js';
|
|
4
5
|
const RISK_COLORS = {
|
|
5
6
|
CRITICAL: '#dc2626',
|
|
6
7
|
HIGH: '#ea580c',
|
|
@@ -21,6 +22,8 @@ const GRADE_COLOR = {
|
|
|
21
22
|
A: '#22c55e', B: '#84cc16', C: '#eab308', D: '#f97316', F: '#ef4444',
|
|
22
23
|
};
|
|
23
24
|
// ── Dashboard helpers ────────────────────────────────────────────────────────
|
|
25
|
+
/** The grey used for inconclusive findings. */
|
|
26
|
+
const UNKNOWN_COLOR = '#8b949e';
|
|
24
27
|
function statusColor(value, warnThreshold, dangerThreshold) {
|
|
25
28
|
if (value <= warnThreshold)
|
|
26
29
|
return '#22c55e';
|
|
@@ -94,14 +97,19 @@ function buildDashboard(result, counts) {
|
|
|
94
97
|
<div class="kpi-value" style="color:${RISK_COLORS[l]}">${counts[l] ?? 0}</div>
|
|
95
98
|
<div class="kpi-label">${l}</div>
|
|
96
99
|
</div>`).join('');
|
|
97
|
-
// Users & Access
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
+
// Users & Access. A count the audit could not read is shown as unknown, never as a green 0.
|
|
101
|
+
const unknown = unknownMetrics(result.findings);
|
|
102
|
+
const countRow = (label, key, warn, danger) => {
|
|
103
|
+
if (unknown.has(key))
|
|
104
|
+
return metricRow(label, 'unknown', UNKNOWN_COLOR);
|
|
105
|
+
const color = statusColor(m[key], warn, danger);
|
|
106
|
+
return metricRow(label, m[key], color, m.totalActiveUsers > 0 ? progressBar(m[key], m.totalActiveUsers, color) : '');
|
|
107
|
+
};
|
|
100
108
|
const inactiveColor = statusColor(m.inactiveUsers90d, 0, 5);
|
|
101
109
|
const usersCard = inventoryCard('Users & Access', [
|
|
102
110
|
metricRow('Active Users', m.totalActiveUsers),
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
countRow('Modify All Data', 'modifyAllDataUsersCount', 2, 5),
|
|
112
|
+
countRow('View All Data', 'viewAllDataUsersCount', 5, 15),
|
|
105
113
|
metricRow('Inactive 90d', m.inactiveUsers90d, inactiveColor),
|
|
106
114
|
metricRow('Profiles', m.profileCount),
|
|
107
115
|
metricRow('Permission Sets', m.permissionSetCount),
|
|
@@ -185,14 +193,22 @@ export class HtmlRenderer {
|
|
|
185
193
|
const conf = c.confidence === 'named' ? '' : ' (potential)';
|
|
186
194
|
const dagSvg = renderAttackChainDagSvg(c, { theme: 'dark' });
|
|
187
195
|
const steps = c.steps
|
|
188
|
-
.map((s) =>
|
|
196
|
+
.map((s) => {
|
|
197
|
+
const grants = s.capabilityInferred ? '' : `: grants <code>${esc(s.capability)}</code>`;
|
|
198
|
+
const cut = s.breaksChain ? ' <strong>✂ break point</strong>' : '';
|
|
199
|
+
return `<li><strong>${esc(s.title ?? s.findingId)}</strong> (${esc(s.severity ?? '—')})${grants}${cut}</li>`;
|
|
200
|
+
})
|
|
189
201
|
.join('');
|
|
190
202
|
return `<div class="attack-chain severity-${c.severity.toLowerCase()}">
|
|
191
203
|
<h3>[${esc(c.severity)}] ${esc(c.title)}${conf}</h3>
|
|
204
|
+
${c.abuseCase ? `<p><strong>Abuse case:</strong> ${esc(c.abuseCase.actor)} wants to ${esc(c.abuseCase.goal)}.</p>` : ''}
|
|
192
205
|
<p>${esc(c.narrative)}</p>
|
|
193
206
|
${dagSvg}
|
|
194
207
|
<ol>${steps}</ol>
|
|
195
|
-
|
|
208
|
+
${c.abuseCase
|
|
209
|
+
? `<p class="remediation"><strong>Breaks the chain:</strong> ${esc(c.abuseCase.breakPoint)}</p>
|
|
210
|
+
<p class="remediation"><strong>Remediation:</strong> ${esc(c.remediation)}</p>`
|
|
211
|
+
: `<p class="remediation"><strong>Recommended fixes:</strong> ${esc(c.remediation)}</p>`}
|
|
196
212
|
</div>`;
|
|
197
213
|
})
|
|
198
214
|
.join('\n');
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { coverageSummary, coverageAdvice } from '../findings/coverage.js';
|
|
2
|
+
import { buildThreatView, threatRowStatusText, PRIVACY_COST_OF_LOGGING } from '../threats/view.js';
|
|
2
3
|
function escapeMdCell(s) {
|
|
3
4
|
return s.replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\n/g, ' ');
|
|
4
5
|
}
|
|
6
|
+
function threatTags(f) {
|
|
7
|
+
const parts = [];
|
|
8
|
+
if (f.threats?.stride?.length)
|
|
9
|
+
parts.push(`STRIDE ${f.threats.stride.join(' · ')}`);
|
|
10
|
+
if (f.threats?.linddun?.length)
|
|
11
|
+
parts.push(`LINDDUN ${f.threats.linddun.join(' · ')}`);
|
|
12
|
+
return parts.join(' | ');
|
|
13
|
+
}
|
|
14
|
+
function threatTable(lines, rows) {
|
|
15
|
+
lines.push('| Category | Coverage | Findings |');
|
|
16
|
+
lines.push('| --- | --- | --- |');
|
|
17
|
+
for (const r of rows) {
|
|
18
|
+
const titles = r.findings.map((f) => escapeMdCell(f.title)).join('; ') || '—';
|
|
19
|
+
lines.push(`| ${r.category}: ${r.name} | ${threatRowStatusText(r)} | ${titles} |`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
5
22
|
export class MarkdownRenderer {
|
|
6
23
|
format = 'md';
|
|
7
24
|
fileExtension = '.md';
|
|
@@ -31,15 +48,28 @@ export class MarkdownRenderer {
|
|
|
31
48
|
const conf = c.confidence === 'named' ? '' : ' _(potential)_';
|
|
32
49
|
lines.push(`### [${c.severity}] ${c.title}${conf}`);
|
|
33
50
|
lines.push('');
|
|
51
|
+
if (c.abuseCase) {
|
|
52
|
+
lines.push(`**Abuse case:** ${c.abuseCase.actor} wants to ${c.abuseCase.goal}.`);
|
|
53
|
+
lines.push('');
|
|
54
|
+
}
|
|
34
55
|
lines.push(c.narrative);
|
|
35
56
|
lines.push('');
|
|
36
57
|
lines.push('**Steps:**');
|
|
37
58
|
lines.push('');
|
|
38
59
|
c.steps.forEach((s, i) => {
|
|
39
|
-
|
|
60
|
+
const grants = s.capabilityInferred ? '' : `: grants \`${s.capability}\``;
|
|
61
|
+
const cut = s.breaksChain ? ' ✂ _break point_' : '';
|
|
62
|
+
lines.push(`${i + 1}. **${s.title ?? s.findingId}** (${s.severity ?? '—'})${grants}${cut}`);
|
|
40
63
|
});
|
|
41
64
|
lines.push('');
|
|
42
|
-
|
|
65
|
+
if (c.abuseCase) {
|
|
66
|
+
lines.push(`**Breaks the chain:** ${c.abuseCase.breakPoint}`);
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push(`**Remediation:** ${c.remediation}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lines.push(`**Recommended fixes:** ${c.remediation}`);
|
|
72
|
+
}
|
|
43
73
|
lines.push('');
|
|
44
74
|
lines.push('---');
|
|
45
75
|
lines.push('');
|
|
@@ -63,6 +93,11 @@ export class MarkdownRenderer {
|
|
|
63
93
|
lines.push('');
|
|
64
94
|
lines.push(`**Compliance:** ${f.complianceTags.join(' · ')}`);
|
|
65
95
|
}
|
|
96
|
+
const threats = threatTags(f);
|
|
97
|
+
if (threats) {
|
|
98
|
+
lines.push('');
|
|
99
|
+
lines.push(`**Threats:** ${threats}`);
|
|
100
|
+
}
|
|
66
101
|
if (f.affectedItems?.length) {
|
|
67
102
|
const hasUrls = f.affectedItems.some((i) => i.url);
|
|
68
103
|
const hasNotes = f.affectedItems.some((i) => i.note);
|
|
@@ -86,6 +121,30 @@ export class MarkdownRenderer {
|
|
|
86
121
|
lines.push('');
|
|
87
122
|
}
|
|
88
123
|
}
|
|
124
|
+
const view = buildThreatView(result.findings);
|
|
125
|
+
lines.push('');
|
|
126
|
+
lines.push('## Threat View');
|
|
127
|
+
lines.push('');
|
|
128
|
+
lines.push('_Findings grouped by threat category. Coverage shows what this run looked at, not that a threat is absent._');
|
|
129
|
+
lines.push('');
|
|
130
|
+
lines.push('### STRIDE');
|
|
131
|
+
lines.push('');
|
|
132
|
+
threatTable(lines, view.stride);
|
|
133
|
+
if (view.linddun) {
|
|
134
|
+
lines.push('');
|
|
135
|
+
lines.push('### LINDDUN (privacy)');
|
|
136
|
+
lines.push('');
|
|
137
|
+
threatTable(lines, view.linddun);
|
|
138
|
+
}
|
|
139
|
+
if (view.dualReadings.length > 0) {
|
|
140
|
+
lines.push('');
|
|
141
|
+
lines.push('### Logging, read both ways');
|
|
142
|
+
lines.push('');
|
|
143
|
+
lines.push(`Each of these is a repudiation gap (STRIDE R). ${PRIVACY_COST_OF_LOGGING}`);
|
|
144
|
+
lines.push('');
|
|
145
|
+
for (const f of view.dualReadings)
|
|
146
|
+
lines.push(`- ${f.title}`);
|
|
147
|
+
}
|
|
89
148
|
lines.push('');
|
|
90
149
|
lines.push('---');
|
|
91
150
|
lines.push('');
|
|
@@ -101,7 +101,11 @@ export class SarifRenderer {
|
|
|
101
101
|
}
|
|
102
102
|
const acc = this.ruleFor(rules, ruleId, f);
|
|
103
103
|
acc.worst = acc.worst ? maxRisk(acc.worst, f.riskLevel) : f.riskLevel;
|
|
104
|
-
|
|
104
|
+
const threatTags = [
|
|
105
|
+
...(f.threats?.stride ?? []).map((c) => `stride:${c}`),
|
|
106
|
+
...(f.threats?.linddun ?? []).map((c) => `linddun:${c}`),
|
|
107
|
+
];
|
|
108
|
+
for (const tag of [...(f.complianceTags ?? []), ...threatTags]) {
|
|
105
109
|
if (!acc.rule.properties.tags.includes(tag))
|
|
106
110
|
acc.rule.properties.tags.push(tag);
|
|
107
111
|
}
|
|
@@ -224,7 +228,10 @@ export class SarifRenderer {
|
|
|
224
228
|
const stepLocation = (step, idx) => ({
|
|
225
229
|
message: { text: `Step ${idx + 1}: ${step.title ?? step.findingId} (${step.findingId})` },
|
|
226
230
|
logicalLocations: logicalLocations([step.findingId]),
|
|
227
|
-
properties: {
|
|
231
|
+
properties: {
|
|
232
|
+
...(step.capabilityInferred ? {} : { capability: step.capability }),
|
|
233
|
+
...(step.breaksChain ? { breaksChain: true } : {}),
|
|
234
|
+
},
|
|
228
235
|
});
|
|
229
236
|
return {
|
|
230
237
|
ruleId,
|
|
@@ -243,6 +250,7 @@ export class SarifRenderer {
|
|
|
243
250
|
confidence: chain.confidence,
|
|
244
251
|
attackChainId: chain.id,
|
|
245
252
|
remediation: chain.remediation,
|
|
253
|
+
...(chain.abuseCase ? { abuseCase: chain.abuseCase } : {}),
|
|
246
254
|
},
|
|
247
255
|
};
|
|
248
256
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// LINDDUN categories of the checks that concern personal data (RULE-102). A check with no privacy
|
|
2
|
+
// bearing has no entry: there is no default category.
|
|
3
|
+
export const CHECK_LINDDUN_MAP = {
|
|
4
|
+
// Who can see personal data
|
|
5
|
+
'sharing-model': ['DD', 'L'],
|
|
6
|
+
'public-group-sharing': ['DD'],
|
|
7
|
+
'field-level-security': ['DD'],
|
|
8
|
+
'report-folder-access': ['DD'],
|
|
9
|
+
'restriction-rules-integrity': ['DD'],
|
|
10
|
+
'external-account-hierarchy-exposure': ['DD'],
|
|
11
|
+
'guest-user-access': ['DD', 'I'],
|
|
12
|
+
'guest-object-exposure': ['DD'],
|
|
13
|
+
'guest-record-access-policy': ['DD'],
|
|
14
|
+
'guest-site-options': ['DD'],
|
|
15
|
+
'guest-api-access': ['DD'],
|
|
16
|
+
'guest-user-visibility': ['I', 'DD'],
|
|
17
|
+
'experience-cloud-site': ['DD', 'I'],
|
|
18
|
+
'classic-sites': ['DD'],
|
|
19
|
+
'content-links': ['DD', 'L'],
|
|
20
|
+
'public-content-exposure': ['DD'],
|
|
21
|
+
'data-export-access': ['DD'],
|
|
22
|
+
'debug-log-access': ['DD'],
|
|
23
|
+
'data-cloud-data-space-isolation': ['L', 'DD'],
|
|
24
|
+
'agent-query-reach': ['DD'],
|
|
25
|
+
'agent-outbound-actions': ['DD', 'Nc'],
|
|
26
|
+
'genai-prompt-template-grounding': ['DD'],
|
|
27
|
+
// How personal data is protected and governed
|
|
28
|
+
'data-classification': ['Nc', 'U'],
|
|
29
|
+
'encryption-coverage': ['DD'],
|
|
30
|
+
'shield-tenant-secret-lifecycle': ['DD'],
|
|
31
|
+
'sandbox-data-masking': ['DD', 'Nc'],
|
|
32
|
+
// Logging that records personal data (read both ways with STRIDE R, RULE-103)
|
|
33
|
+
'audit-trail': ['Nr', 'D'],
|
|
34
|
+
'field-history-tracking': ['Nr', 'D'],
|
|
35
|
+
'event-monitoring': ['D', 'Nr'],
|
|
36
|
+
'apex-logging': ['DD', 'D'],
|
|
37
|
+
'siem-integration': ['D', 'Nc'],
|
|
38
|
+
'agent-monitoring-coverage': ['D', 'Nr'],
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=linddun.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FindingThreats } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The threat categories for a finding of this check. A category list the check set inline on the
|
|
4
|
+
* finding replaces the check-level entry for that taxonomy; the other taxonomy still comes from
|
|
5
|
+
* the maps.
|
|
6
|
+
*/
|
|
7
|
+
export declare function threatsFor(checkId: string, inline?: FindingThreats): FindingThreats | undefined;
|
|
8
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CHECK_STRIDE_MAP } from './stride.js';
|
|
2
|
+
import { CHECK_LINDDUN_MAP } from './linddun.js';
|
|
3
|
+
/**
|
|
4
|
+
* The threat categories for a finding of this check. A category list the check set inline on the
|
|
5
|
+
* finding replaces the check-level entry for that taxonomy; the other taxonomy still comes from
|
|
6
|
+
* the maps.
|
|
7
|
+
*/
|
|
8
|
+
export function threatsFor(checkId, inline) {
|
|
9
|
+
const stride = inline?.stride ?? CHECK_STRIDE_MAP[checkId];
|
|
10
|
+
const linddun = inline?.linddun ?? CHECK_LINDDUN_MAP[checkId];
|
|
11
|
+
const out = {};
|
|
12
|
+
if (stride?.length)
|
|
13
|
+
out.stride = [...stride];
|
|
14
|
+
if (linddun?.length)
|
|
15
|
+
out.linddun = [...linddun];
|
|
16
|
+
return out.stride || out.linddun ? out : undefined;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// STRIDE category of each check, primary first (RULE-101). A check whose findings differ in kind
|
|
2
|
+
// sets `threats.stride` on those findings, which overrides this entry.
|
|
3
|
+
export const CHECK_STRIDE_MAP = {
|
|
4
|
+
// Identity and authentication
|
|
5
|
+
'login-session': ['S'],
|
|
6
|
+
'password-session-policy': ['S'],
|
|
7
|
+
'ip-restrictions': ['S'],
|
|
8
|
+
'trusted-ip-ranges': ['S'],
|
|
9
|
+
'sso-enforcement': ['S'],
|
|
10
|
+
'mfa-enforcement': ['S'],
|
|
11
|
+
'internal-user-mfa': ['S'],
|
|
12
|
+
'mfa-registration': ['S'],
|
|
13
|
+
'mfa-method-strength': ['S'],
|
|
14
|
+
'my-domain-login-policy': ['S'],
|
|
15
|
+
'high-assurance-session': ['S'],
|
|
16
|
+
'enhanced-domains': ['S'],
|
|
17
|
+
'session-hardening': ['S', 'T'],
|
|
18
|
+
'auth-providers': ['S'],
|
|
19
|
+
'auth-provider-registration-handler': ['S', 'E'],
|
|
20
|
+
'delegated-authentication-exposure': ['S'],
|
|
21
|
+
'oauth-device-and-asset-token-flows': ['S'],
|
|
22
|
+
'oauth-token-inventory': ['S'],
|
|
23
|
+
'connected-apps': ['S', 'E'],
|
|
24
|
+
'connected-app-scope': ['E', 'S'],
|
|
25
|
+
'connected-app-inactivity': ['S'],
|
|
26
|
+
'inactive-users': ['S'],
|
|
27
|
+
'certificate-expiry': ['D', 'S'],
|
|
28
|
+
'external-credentials': ['S', 'I'],
|
|
29
|
+
'api-client-permission': ['S', 'E'],
|
|
30
|
+
'soap-login-api-auth': ['S'],
|
|
31
|
+
'email-security': ['S', 'T'],
|
|
32
|
+
'org-wide-email-spoofing': ['S'],
|
|
33
|
+
'login-anomaly': ['S'],
|
|
34
|
+
'failed-login-detection': ['S', 'R'],
|
|
35
|
+
'health-check': ['S', 'E'],
|
|
36
|
+
// Privilege
|
|
37
|
+
'users-and-admins': ['E'],
|
|
38
|
+
'permissions': ['E'],
|
|
39
|
+
'standard-profiles': ['E'],
|
|
40
|
+
'escalation-perms': ['E'],
|
|
41
|
+
'privileged-access': ['E'],
|
|
42
|
+
'separation-of-duties': ['E'],
|
|
43
|
+
'delegated-administration-groups': ['E'],
|
|
44
|
+
'login-access-policy': ['E', 'R'],
|
|
45
|
+
'integration-users': ['E', 'S'],
|
|
46
|
+
'integration-least-privilege': ['E'],
|
|
47
|
+
'apex-sharing': ['E', 'I'],
|
|
48
|
+
'flows-without-sharing': ['E', 'I'],
|
|
49
|
+
'apex-crud-fls': ['E', 'I'],
|
|
50
|
+
'apex-rest-endpoint': ['E', 'I'],
|
|
51
|
+
'guest-executable-apex': ['E', 'I'],
|
|
52
|
+
'scheduled-apex': ['E'],
|
|
53
|
+
'anonymous-apex-audit': ['E', 'R'],
|
|
54
|
+
'platform-event-subscriber-context': ['E'],
|
|
55
|
+
'inbound-email-handler-exposure': ['E', 'S'],
|
|
56
|
+
'agent-inventory': ['E'],
|
|
57
|
+
'agent-user-privilege': ['E'],
|
|
58
|
+
// Data exposure
|
|
59
|
+
'sharing-model': ['I'],
|
|
60
|
+
'public-group-sharing': ['I'],
|
|
61
|
+
'field-level-security': ['I'],
|
|
62
|
+
'report-folder-access': ['I'],
|
|
63
|
+
'data-export-access': ['I'],
|
|
64
|
+
'data-classification': ['I'],
|
|
65
|
+
'encryption-coverage': ['I'],
|
|
66
|
+
'shield-tenant-secret-lifecycle': ['I'],
|
|
67
|
+
'sandbox-data-masking': ['I'],
|
|
68
|
+
'restriction-rules-integrity': ['I'],
|
|
69
|
+
'data-cloud-data-space-isolation': ['I'],
|
|
70
|
+
'external-account-hierarchy-exposure': ['I', 'E'],
|
|
71
|
+
'content-links': ['I'],
|
|
72
|
+
'public-content-exposure': ['I'],
|
|
73
|
+
'guest-user-access': ['I', 'T'],
|
|
74
|
+
'guest-object-exposure': ['I'],
|
|
75
|
+
'guest-site-options': ['I'],
|
|
76
|
+
'guest-record-access-policy': ['I'],
|
|
77
|
+
'guest-user-visibility': ['I'],
|
|
78
|
+
'guest-api-access': ['I', 'T'],
|
|
79
|
+
'experience-cloud-site': ['I', 'S'],
|
|
80
|
+
'classic-sites': ['I'],
|
|
81
|
+
'guest-traffic-anomaly': ['I', 'R'],
|
|
82
|
+
'debug-log-access': ['I'],
|
|
83
|
+
'hardcoded-credentials': ['I', 'S'],
|
|
84
|
+
'custom-settings': ['I'],
|
|
85
|
+
'custom-labels-credential': ['I'],
|
|
86
|
+
'named-credentials': ['I'],
|
|
87
|
+
'flow-http-callout-credential-bypass': ['I', 'S'],
|
|
88
|
+
'remote-sites': ['I'],
|
|
89
|
+
'outbound-messages': ['I'],
|
|
90
|
+
'cors-allowlist': ['I', 'T'],
|
|
91
|
+
'csp-trusted-sites': ['I', 'T'],
|
|
92
|
+
'agent-channel-exposure': ['I', 'E'],
|
|
93
|
+
'agent-query-reach': ['I'],
|
|
94
|
+
'agent-outbound-actions': ['I'],
|
|
95
|
+
'trusted-url-hygiene': ['I'],
|
|
96
|
+
'genai-prompt-template-grounding': ['I', 'T'],
|
|
97
|
+
// Integrity of code, components and deployments
|
|
98
|
+
'code-security': ['T', 'I'],
|
|
99
|
+
'visualforce-xss': ['T', 'S'],
|
|
100
|
+
'lightning-message-channel': ['T', 'I'],
|
|
101
|
+
'experience-csp': ['T', 'I'],
|
|
102
|
+
'installed-packages': ['T', 'E'],
|
|
103
|
+
'package-post-install-supply-chain': ['T', 'E'],
|
|
104
|
+
'deployment-identity': ['T', 'R'],
|
|
105
|
+
'release-updates': ['T'],
|
|
106
|
+
'legacy-api-version': ['T'],
|
|
107
|
+
'agent-action-surface': ['T', 'E'],
|
|
108
|
+
// Accountability and detection
|
|
109
|
+
'audit-trail': ['R'],
|
|
110
|
+
'field-history-tracking': ['R'],
|
|
111
|
+
'event-monitoring': ['R'],
|
|
112
|
+
'siem-integration': ['R'],
|
|
113
|
+
'apex-logging': ['R', 'I'],
|
|
114
|
+
'threat-detection': ['R'],
|
|
115
|
+
'transaction-security-policy': ['R'],
|
|
116
|
+
'agent-monitoring-coverage': ['R'],
|
|
117
|
+
// Availability
|
|
118
|
+
'api-limits': ['D'],
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=stride.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Spoofing, Tampering, Repudiation, Information disclosure, Denial of service, Elevation of privilege. */
|
|
2
|
+
export type StrideCategory = 'S' | 'T' | 'R' | 'I' | 'D' | 'E';
|
|
3
|
+
/**
|
|
4
|
+
* LINDDUN (2023): Linking, Identifying, Non-repudiation, Detecting, Data disclosure,
|
|
5
|
+
* Unawareness & unintervenability, Non-compliance.
|
|
6
|
+
*/
|
|
7
|
+
export type LinddunCategory = 'L' | 'I' | 'Nr' | 'D' | 'DD' | 'U' | 'Nc';
|
|
8
|
+
export interface FindingThreats {
|
|
9
|
+
stride?: StrideCategory[];
|
|
10
|
+
linddun?: LinddunCategory[];
|
|
11
|
+
}
|
|
12
|
+
export declare const STRIDE_CATEGORIES: readonly StrideCategory[];
|
|
13
|
+
export declare const LINDDUN_CATEGORIES: readonly LinddunCategory[];
|
|
14
|
+
export declare const STRIDE_NAMES: Record<StrideCategory, string>;
|
|
15
|
+
export declare const LINDDUN_NAMES: Record<LinddunCategory, string>;
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Threat categories. These classify the harm a finding describes; they are not compliance
|
|
2
|
+
// controls and never enter the compliance catalog or matrix (RULE-100).
|
|
3
|
+
export const STRIDE_CATEGORIES = ['S', 'T', 'R', 'I', 'D', 'E'];
|
|
4
|
+
export const LINDDUN_CATEGORIES = ['L', 'I', 'Nr', 'D', 'DD', 'U', 'Nc'];
|
|
5
|
+
export const STRIDE_NAMES = {
|
|
6
|
+
S: 'Spoofing',
|
|
7
|
+
T: 'Tampering',
|
|
8
|
+
R: 'Repudiation',
|
|
9
|
+
I: 'Information disclosure',
|
|
10
|
+
D: 'Denial of service',
|
|
11
|
+
E: 'Elevation of privilege',
|
|
12
|
+
};
|
|
13
|
+
export const LINDDUN_NAMES = {
|
|
14
|
+
L: 'Linking',
|
|
15
|
+
I: 'Identifying',
|
|
16
|
+
Nr: 'Non-repudiation',
|
|
17
|
+
D: 'Detecting',
|
|
18
|
+
DD: 'Data disclosure',
|
|
19
|
+
U: 'Unawareness & unintervenability',
|
|
20
|
+
Nc: 'Non-compliance',
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Finding } from '../findings/Finding.js';
|
|
2
|
+
import { type LinddunCategory, type StrideCategory } from './types.js';
|
|
3
|
+
export type ThreatRowStatus = 'findings' | 'no-findings' | 'not-assessed-in-run' | 'not-covered';
|
|
4
|
+
export interface ThreatRow<C extends string> {
|
|
5
|
+
category: C;
|
|
6
|
+
name: string;
|
|
7
|
+
/** Active findings in this category: not passed, inconclusive, not assessed or waived. */
|
|
8
|
+
findings: Finding[];
|
|
9
|
+
/** Checks in this run whose map entry names the category. */
|
|
10
|
+
coveringChecks: number;
|
|
11
|
+
/** Of those, the checks that gathered evidence. */
|
|
12
|
+
assessedChecks: number;
|
|
13
|
+
status: ThreatRowStatus;
|
|
14
|
+
}
|
|
15
|
+
export interface ThreatView {
|
|
16
|
+
stride: ThreatRow<StrideCategory>[];
|
|
17
|
+
/** Present only when a privacy-tagged check ran. */
|
|
18
|
+
linddun?: ThreatRow<LinddunCategory>[];
|
|
19
|
+
/** Findings that are a repudiation gap and also log personal data once fixed (RULE-103). */
|
|
20
|
+
dualReadings: Finding[];
|
|
21
|
+
}
|
|
22
|
+
export declare const PRIVACY_COST_OF_LOGGING = "The logging this fix adds records personal data: decide what it captures, how long it is kept and who can read it.";
|
|
23
|
+
/** The threat view (RULE-104): coverage per category, never a pass. */
|
|
24
|
+
export declare function buildThreatView(findings: readonly Finding[]): ThreatView;
|
|
25
|
+
/** How a row reads in every output. Never "pass", "compliant" or "no threats". */
|
|
26
|
+
export declare function threatRowStatusText(row: ThreatRow<string>): string;
|
|
27
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CHECK_STRIDE_MAP } from './stride.js';
|
|
2
|
+
import { CHECK_LINDDUN_MAP } from './linddun.js';
|
|
3
|
+
import { LINDDUN_CATEGORIES, LINDDUN_NAMES, STRIDE_CATEGORIES, STRIDE_NAMES, } from './types.js';
|
|
4
|
+
export const PRIVACY_COST_OF_LOGGING = 'The logging this fix adds records personal data: decide what it captures, how long it is kept and who can read it.';
|
|
5
|
+
const isActive = (f) => !f.passed && !f.inconclusive && !f.notAssessed && !f.waived;
|
|
6
|
+
/** The threat view (RULE-104): coverage per category, never a pass. */
|
|
7
|
+
export function buildThreatView(findings) {
|
|
8
|
+
const assessed = new Map();
|
|
9
|
+
for (const f of findings) {
|
|
10
|
+
const id = f.checkId ?? f.id;
|
|
11
|
+
assessed.set(id, (assessed.get(id) ?? false) || !(f.inconclusive || f.notAssessed));
|
|
12
|
+
}
|
|
13
|
+
const active = findings.filter(isActive);
|
|
14
|
+
function rows(categories, names, map, of) {
|
|
15
|
+
return categories.map((category) => {
|
|
16
|
+
const covering = [...assessed.keys()].filter((id) => map[id]?.includes(category));
|
|
17
|
+
const assessedChecks = covering.filter((id) => assessed.get(id)).length;
|
|
18
|
+
const inCategory = active.filter((f) => of(f)?.includes(category));
|
|
19
|
+
const status = inCategory.length > 0 ? 'findings'
|
|
20
|
+
: assessedChecks > 0 ? 'no-findings'
|
|
21
|
+
: covering.length > 0 ? 'not-assessed-in-run'
|
|
22
|
+
: 'not-covered';
|
|
23
|
+
return { category, name: names[category], findings: inCategory, coveringChecks: covering.length, assessedChecks, status };
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const view = {
|
|
27
|
+
stride: rows(STRIDE_CATEGORIES, STRIDE_NAMES, CHECK_STRIDE_MAP, (f) => f.threats?.stride),
|
|
28
|
+
dualReadings: active.filter((f) => {
|
|
29
|
+
const linddun = f.threats?.linddun ?? [];
|
|
30
|
+
return (f.threats?.stride ?? []).includes('R') && (linddun.includes('Nr') || linddun.includes('D'));
|
|
31
|
+
}),
|
|
32
|
+
};
|
|
33
|
+
if ([...assessed.keys()].some((id) => CHECK_LINDDUN_MAP[id])) {
|
|
34
|
+
view.linddun = rows(LINDDUN_CATEGORIES, LINDDUN_NAMES, CHECK_LINDDUN_MAP, (f) => f.threats?.linddun);
|
|
35
|
+
}
|
|
36
|
+
return view;
|
|
37
|
+
}
|
|
38
|
+
/** How a row reads in every output. Never "pass", "compliant" or "no threats". */
|
|
39
|
+
export function threatRowStatusText(row) {
|
|
40
|
+
switch (row.status) {
|
|
41
|
+
case 'findings':
|
|
42
|
+
return `${row.findings.length} finding${row.findings.length === 1 ? '' : 's'} (from ${row.assessedChecks} check${row.assessedChecks === 1 ? '' : 's'})`;
|
|
43
|
+
case 'no-findings':
|
|
44
|
+
return `no findings from ${row.assessedChecks} check${row.assessedChecks === 1 ? '' : 's'}`;
|
|
45
|
+
case 'not-assessed-in-run':
|
|
46
|
+
return 'not assessed in this run';
|
|
47
|
+
case 'not-covered':
|
|
48
|
+
return 'not assessed by this tool';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=view.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "Read-only Salesforce security audit for the sf CLI: 109 checks, attack-chain correlation, A-F risk grading, compliance mapping, free EventLogFile capture, and Guest User Anomaly investigation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salesforce",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"test:jest": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@cclabsnz/sf-core": "^0.
|
|
50
|
-
"@oclif/core": "^
|
|
49
|
+
"@cclabsnz/sf-core": "^0.12.0",
|
|
50
|
+
"@oclif/core": "^5",
|
|
51
51
|
"@salesforce/core": "^9.3.0",
|
|
52
52
|
"@salesforce/sf-plugins-core": "^13",
|
|
53
53
|
"chart.js": "^4.5.1",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"form-data": "^4.0.6",
|
|
113
113
|
"handlebars": "^4.7.9",
|
|
114
114
|
"brace-expansion": "^5.0.11",
|
|
115
|
-
"fast-uri@3": "^3.1.
|
|
115
|
+
"fast-uri@3": "^3.1.9",
|
|
116
116
|
"browserslist": "^4.28.7",
|
|
117
117
|
"@istanbuljs/load-nyc-config>js-yaml": "^4.1.1"
|
|
118
118
|
}
|