@cclabsnz/sf-audit 1.19.0 → 1.21.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 +52 -0
- package/lib/apps/apiLogSource.js +3 -2
- package/lib/chains/AttackChain.d.ts +14 -0
- package/lib/chains/CapabilityRegistry.d.ts +5 -0
- package/lib/chains/CapabilityRegistry.js +31 -31
- package/lib/chains/ChainEngine.d.ts +2 -0
- package/lib/chains/ChainEngine.js +31 -6
- package/lib/chains/namedChains.d.ts +85 -0
- package/lib/chains/namedChains.js +404 -210
- 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 +5 -5
- package/lib/checks/registry.js +1 -1
- 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/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 +12 -2
- package/lib/renderers/MarkdownRenderer.js +67 -2
- package/lib/renderers/SarifRenderer.js +16 -2
- package/lib/threats/attack.d.ts +63 -0
- package/lib/threats/attack.js +156 -0
- package/lib/threats/linddun.d.ts +3 -0
- package/lib/threats/linddun.js +40 -0
- package/lib/threats/resolve.d.ts +11 -0
- package/lib/threats/resolve.js +27 -0
- package/lib/threats/stride.d.ts +3 -0
- package/lib/threats/stride.js +120 -0
- package/lib/threats/types.d.ts +20 -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 +3 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Capability } from '../chains/Capability.js';
|
|
2
|
+
import type { Finding } from '../findings/Finding.js';
|
|
3
|
+
/** The Enterprise ATT&CK release every technique below was checked against. */
|
|
4
|
+
export declare const ATTACK_RELEASE = "20.0";
|
|
5
|
+
/** The Enterprise matrix's tactic order in the pinned release, earliest stage first (RULE-116). */
|
|
6
|
+
export declare const ATTACK_TACTIC_ORDER: readonly string[];
|
|
7
|
+
export interface AttackTechnique {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
/** Tactic short names as the pinned release spells them. */
|
|
11
|
+
tactics: string[];
|
|
12
|
+
release: string;
|
|
13
|
+
url: string;
|
|
14
|
+
/** Provenance gate: true only once id, name, tactics and fit are recorded in the verification worksheet. */
|
|
15
|
+
verified: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const ATTACK_TECHNIQUES: Record<string, AttackTechnique>;
|
|
18
|
+
/**
|
|
19
|
+
* What an attacker does with each capability. A technique sits here only if it fits every finding
|
|
20
|
+
* that grants the capability; a finding it does not fit overrides it in its registry entry
|
|
21
|
+
* (`CapabilityEntry.techniques`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const CAPABILITY_TECHNIQUES: Record<Capability, string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Detection gaps: the technique a finding leaves unobserved (RULE-108). Never a technique the
|
|
26
|
+
* finding grants, and never added to a chain step.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DETECTION_GAP_TECHNIQUES: Record<string, string[]>;
|
|
29
|
+
/** RULE-109: on only while every capability has a verified technique. */
|
|
30
|
+
export declare const ATTACK_OUTPUT_ENABLED = true;
|
|
31
|
+
/** Verified techniques for one capability as granted by this finding id. */
|
|
32
|
+
export declare function techniquesForGrant(findingId: string, capability: Capability): string[];
|
|
33
|
+
/** Verified techniques for every capability the finding grants; none for capabilities it only requires. */
|
|
34
|
+
export declare function attackFor(finding: Finding): string[] | undefined;
|
|
35
|
+
/** Verified techniques this detection-gap finding leaves unobserved. */
|
|
36
|
+
export declare function detectsFor(finding: Finding): string[] | undefined;
|
|
37
|
+
/** "T1213.004 Customer Relationship Management Software" — for text outputs. */
|
|
38
|
+
export declare function techniqueLabel(id: string): string;
|
|
39
|
+
/** Capabilities with no verified technique; RULE-109 requires this to be empty while output is on. */
|
|
40
|
+
export declare function capabilitiesWithoutTechnique(): Capability[];
|
|
41
|
+
/** Position of the earliest tactic among these verified techniques; undefined when there are none. */
|
|
42
|
+
export declare function tacticRank(ids: readonly string[] | undefined): number | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Where a step sits in tactic order: its own techniques, or, when its finding has none, the
|
|
45
|
+
* default technique of the capability it grants. The default orders the step and is never
|
|
46
|
+
* rendered on it. An inferred step has no rank of its own.
|
|
47
|
+
*/
|
|
48
|
+
export declare function stepTacticRank(step: {
|
|
49
|
+
capability: Capability;
|
|
50
|
+
capabilityInferred?: true;
|
|
51
|
+
techniques?: string[];
|
|
52
|
+
}): number | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Steps in ATT&CK tactic order (RULE-116). A step without a rank takes the earliest rank in its
|
|
55
|
+
* precondition group, else the rank of the group before it, else of the step before it; ties keep
|
|
56
|
+
* their order. Sorting changes no step, only where it is listed.
|
|
57
|
+
*/
|
|
58
|
+
export declare function orderStepsByTactic<T extends {
|
|
59
|
+
capability: Capability;
|
|
60
|
+
capabilityInferred?: true;
|
|
61
|
+
techniques?: string[];
|
|
62
|
+
}>(steps: readonly T[], groupOf?: (step: T) => number | undefined): T[];
|
|
63
|
+
//# sourceMappingURL=attack.d.ts.map
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// MITRE ATT&CK techniques. They attach to the attacker capabilities a finding grants, never to a
|
|
2
|
+
// check (RULE-106), and only verified techniques ever render (RULE-107, MN-059).
|
|
3
|
+
import { ALL_CAPABILITIES } from '../chains/Capability.js';
|
|
4
|
+
import { CAPABILITY_REGISTRY, capabilitiesFor } from '../chains/CapabilityRegistry.js';
|
|
5
|
+
/** The Enterprise ATT&CK release every technique below was checked against. */
|
|
6
|
+
export const ATTACK_RELEASE = '20.0';
|
|
7
|
+
/** The Enterprise matrix's tactic order in the pinned release, earliest stage first (RULE-116). */
|
|
8
|
+
export const ATTACK_TACTIC_ORDER = [
|
|
9
|
+
'reconnaissance', 'resource-development', 'initial-access', 'execution', 'persistence',
|
|
10
|
+
'privilege-escalation', 'stealth', 'defense-impairment', 'credential-access', 'discovery',
|
|
11
|
+
'lateral-movement', 'collection', 'command-and-control', 'exfiltration', 'impact',
|
|
12
|
+
];
|
|
13
|
+
function t(id, name, tactics, verified) {
|
|
14
|
+
return {
|
|
15
|
+
id, name, tactics, release: ATTACK_RELEASE,
|
|
16
|
+
url: `https://attack.mitre.org/techniques/${id.replace('.', '/')}`,
|
|
17
|
+
verified,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const ATTACK_TECHNIQUES = {
|
|
21
|
+
'T1190': t('T1190', 'Exploit Public-Facing Application', ['initial-access'], true),
|
|
22
|
+
'T1078.004': t('T1078.004', 'Cloud Accounts', ['stealth', 'persistence', 'privilege-escalation', 'initial-access'], true),
|
|
23
|
+
'T1213.004': t('T1213.004', 'Customer Relationship Management Software', ['collection'], true),
|
|
24
|
+
'T1565.001': t('T1565.001', 'Stored Data Manipulation', ['impact'], true),
|
|
25
|
+
'T1059.009': t('T1059.009', 'Cloud API', ['execution'], true),
|
|
26
|
+
'T1552': t('T1552', 'Unsecured Credentials', ['credential-access'], true),
|
|
27
|
+
'T1528': t('T1528', 'Steal Application Access Token', ['credential-access'], true),
|
|
28
|
+
'T1110': t('T1110', 'Brute Force', ['credential-access'], true),
|
|
29
|
+
'T1110.003': t('T1110.003', 'Password Spraying', ['credential-access'], true),
|
|
30
|
+
'T1136.003': t('T1136.003', 'Cloud Account', ['persistence'], true),
|
|
31
|
+
'T1087.004': t('T1087.004', 'Cloud Account', ['discovery'], true),
|
|
32
|
+
'T1485': t('T1485', 'Data Destruction', ['impact'], true),
|
|
33
|
+
'T1556': t('T1556', 'Modify Authentication Process', ['defense-impairment', 'persistence', 'credential-access'], true),
|
|
34
|
+
'T1556.007': t('T1556.007', 'Hybrid Identity', ['defense-impairment', 'persistence', 'credential-access'], true),
|
|
35
|
+
'T1098.003': t('T1098.003', 'Additional Cloud Roles', ['persistence', 'privilege-escalation'], true),
|
|
36
|
+
'T1098': t('T1098', 'Account Manipulation', ['persistence', 'privilege-escalation'], true),
|
|
37
|
+
'T1546': t('T1546', 'Event Triggered Execution', ['privilege-escalation', 'persistence'], true),
|
|
38
|
+
'T1648': t('T1648', 'Serverless Execution', ['execution'], true),
|
|
39
|
+
'T1567': t('T1567', 'Exfiltration Over Web Service', ['exfiltration'], true),
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* What an attacker does with each capability. A technique sits here only if it fits every finding
|
|
43
|
+
* that grants the capability; a finding it does not fit overrides it in its registry entry
|
|
44
|
+
* (`CapabilityEntry.techniques`).
|
|
45
|
+
*/
|
|
46
|
+
export const CAPABILITY_TECHNIQUES = {
|
|
47
|
+
'unauth-foothold': ['T1190'],
|
|
48
|
+
'low-trust-authenticated': ['T1078.004'],
|
|
49
|
+
'data-read': ['T1213.004'],
|
|
50
|
+
'data-read-bulk': ['T1213.004'],
|
|
51
|
+
'data-write': ['T1565.001'],
|
|
52
|
+
'code-exec': ['T1059.009'],
|
|
53
|
+
'credential-theft': ['T1552'],
|
|
54
|
+
'priv-esc': ['T1098.003'],
|
|
55
|
+
'org-takeover': ['T1098'],
|
|
56
|
+
'external-egress': ['T1567'],
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Detection gaps: the technique a finding leaves unobserved (RULE-108). Never a technique the
|
|
60
|
+
* finding grants, and never added to a chain step.
|
|
61
|
+
*/
|
|
62
|
+
export const DETECTION_GAP_TECHNIQUES = {
|
|
63
|
+
// SBS-MON-003/004: nobody is alerted to suspicious logins or API anomalies, so password guessing
|
|
64
|
+
// and a stolen account in use go unnoticed.
|
|
65
|
+
'siem-integration-not-detected': ['T1110', 'T1078.004'],
|
|
66
|
+
};
|
|
67
|
+
/** RULE-109: on only while every capability has a verified technique. */
|
|
68
|
+
export const ATTACK_OUTPUT_ENABLED = true;
|
|
69
|
+
function verifiedIds(ids) {
|
|
70
|
+
if (!ATTACK_OUTPUT_ENABLED || !ids)
|
|
71
|
+
return [];
|
|
72
|
+
return ids.filter((id) => ATTACK_TECHNIQUES[id]?.verified);
|
|
73
|
+
}
|
|
74
|
+
/** Verified techniques for one capability as granted by this finding id. */
|
|
75
|
+
export function techniquesForGrant(findingId, capability) {
|
|
76
|
+
const override = CAPABILITY_REGISTRY[findingId]?.techniques?.[capability];
|
|
77
|
+
return verifiedIds(override ?? CAPABILITY_TECHNIQUES[capability]);
|
|
78
|
+
}
|
|
79
|
+
/** Verified techniques for every capability the finding grants; none for capabilities it only requires. */
|
|
80
|
+
export function attackFor(finding) {
|
|
81
|
+
const out = new Set();
|
|
82
|
+
for (const cap of capabilitiesFor(finding).grants) {
|
|
83
|
+
for (const id of techniquesForGrant(finding.id, cap))
|
|
84
|
+
out.add(id);
|
|
85
|
+
}
|
|
86
|
+
return out.size ? [...out] : undefined;
|
|
87
|
+
}
|
|
88
|
+
/** Verified techniques this detection-gap finding leaves unobserved. */
|
|
89
|
+
export function detectsFor(finding) {
|
|
90
|
+
if (finding.passed || finding.inconclusive)
|
|
91
|
+
return undefined;
|
|
92
|
+
const ids = verifiedIds(DETECTION_GAP_TECHNIQUES[finding.id]);
|
|
93
|
+
return ids.length ? ids : undefined;
|
|
94
|
+
}
|
|
95
|
+
/** "T1213.004 Customer Relationship Management Software" — for text outputs. */
|
|
96
|
+
export function techniqueLabel(id) {
|
|
97
|
+
const tech = ATTACK_TECHNIQUES[id];
|
|
98
|
+
return tech ? `${tech.id} ${tech.name}` : id;
|
|
99
|
+
}
|
|
100
|
+
/** Capabilities with no verified technique; RULE-109 requires this to be empty while output is on. */
|
|
101
|
+
export function capabilitiesWithoutTechnique() {
|
|
102
|
+
return ALL_CAPABILITIES.filter((c) => !(CAPABILITY_TECHNIQUES[c] ?? []).some((id) => ATTACK_TECHNIQUES[id]?.verified));
|
|
103
|
+
}
|
|
104
|
+
/** Position of the earliest tactic among these verified techniques; undefined when there are none. */
|
|
105
|
+
export function tacticRank(ids) {
|
|
106
|
+
let best;
|
|
107
|
+
for (const id of verifiedIds(ids)) {
|
|
108
|
+
for (const tactic of ATTACK_TECHNIQUES[id].tactics) {
|
|
109
|
+
const i = ATTACK_TACTIC_ORDER.indexOf(tactic);
|
|
110
|
+
if (i >= 0 && (best === undefined || i < best))
|
|
111
|
+
best = i;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return best;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Where a step sits in tactic order: its own techniques, or, when its finding has none, the
|
|
118
|
+
* default technique of the capability it grants. The default orders the step and is never
|
|
119
|
+
* rendered on it. An inferred step has no rank of its own.
|
|
120
|
+
*/
|
|
121
|
+
export function stepTacticRank(step) {
|
|
122
|
+
if (step.capabilityInferred)
|
|
123
|
+
return undefined;
|
|
124
|
+
return tacticRank(step.techniques) ?? tacticRank(CAPABILITY_TECHNIQUES[step.capability]);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Steps in ATT&CK tactic order (RULE-116). A step without a rank takes the earliest rank in its
|
|
128
|
+
* precondition group, else the rank of the group before it, else of the step before it; ties keep
|
|
129
|
+
* their order. Sorting changes no step, only where it is listed.
|
|
130
|
+
*/
|
|
131
|
+
export function orderStepsByTactic(steps, groupOf = () => undefined) {
|
|
132
|
+
const own = steps.map((s) => stepTacticRank(s));
|
|
133
|
+
const groupRank = new Map();
|
|
134
|
+
steps.forEach((s, i) => {
|
|
135
|
+
const g = groupOf(s);
|
|
136
|
+
const r = own[i];
|
|
137
|
+
if (g === undefined || r === undefined)
|
|
138
|
+
return;
|
|
139
|
+
groupRank.set(g, Math.min(groupRank.get(g) ?? r, r));
|
|
140
|
+
});
|
|
141
|
+
const keys = [];
|
|
142
|
+
steps.forEach((s, i) => {
|
|
143
|
+
let key = own[i];
|
|
144
|
+
const g = groupOf(s);
|
|
145
|
+
if (key === undefined && g !== undefined) {
|
|
146
|
+
for (let k = g; k >= 0 && key === undefined; k--)
|
|
147
|
+
key = groupRank.get(k);
|
|
148
|
+
}
|
|
149
|
+
keys.push(key ?? (i > 0 ? keys[i - 1] : -1));
|
|
150
|
+
});
|
|
151
|
+
return steps
|
|
152
|
+
.map((s, i) => ({ s, i, key: keys[i] }))
|
|
153
|
+
.sort((a, b) => a.key - b.key || a.i - b.i)
|
|
154
|
+
.map((x) => x.s);
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=attack.js.map
|
|
@@ -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,11 @@
|
|
|
1
|
+
import type { FindingThreats } from './types.js';
|
|
2
|
+
import type { Finding } from '../findings/Finding.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 declare function threatsFor(checkId: string, inline?: FindingThreats): FindingThreats | undefined;
|
|
9
|
+
/** Adds the finding's verified ATT&CK techniques, which follow its granted capabilities, not its check (RULE-106, RULE-108). */
|
|
10
|
+
export declare function withAttack(finding: Finding, threats: FindingThreats | undefined): FindingThreats | undefined;
|
|
11
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { attackFor, detectsFor } from './attack.js';
|
|
2
|
+
import { CHECK_STRIDE_MAP } from './stride.js';
|
|
3
|
+
import { CHECK_LINDDUN_MAP } from './linddun.js';
|
|
4
|
+
/**
|
|
5
|
+
* The threat categories for a finding of this check. A category list the check set inline on the
|
|
6
|
+
* finding replaces the check-level entry for that taxonomy; the other taxonomy still comes from
|
|
7
|
+
* the maps.
|
|
8
|
+
*/
|
|
9
|
+
export function threatsFor(checkId, inline) {
|
|
10
|
+
const stride = inline?.stride ?? CHECK_STRIDE_MAP[checkId];
|
|
11
|
+
const linddun = inline?.linddun ?? CHECK_LINDDUN_MAP[checkId];
|
|
12
|
+
const out = {};
|
|
13
|
+
if (stride?.length)
|
|
14
|
+
out.stride = [...stride];
|
|
15
|
+
if (linddun?.length)
|
|
16
|
+
out.linddun = [...linddun];
|
|
17
|
+
return out.stride || out.linddun ? out : undefined;
|
|
18
|
+
}
|
|
19
|
+
/** Adds the finding's verified ATT&CK techniques, which follow its granted capabilities, not its check (RULE-106, RULE-108). */
|
|
20
|
+
export function withAttack(finding, threats) {
|
|
21
|
+
const attack = attackFor(finding);
|
|
22
|
+
const detects = detectsFor(finding);
|
|
23
|
+
if (!attack && !detects)
|
|
24
|
+
return threats;
|
|
25
|
+
return { ...threats, ...(attack ? { attack } : {}), ...(detects ? { detects } : {}) };
|
|
26
|
+
}
|
|
27
|
+
//# 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,20 @@
|
|
|
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
|
+
/** Verified ATT&CK technique ids for the capabilities the finding grants (RULE-106). */
|
|
12
|
+
attack?: string[];
|
|
13
|
+
/** Verified ATT&CK technique ids a detection gap leaves unobserved (RULE-108). */
|
|
14
|
+
detects?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare const STRIDE_CATEGORIES: readonly StrideCategory[];
|
|
17
|
+
export declare const LINDDUN_CATEGORIES: readonly LinddunCategory[];
|
|
18
|
+
export declare const STRIDE_NAMES: Record<StrideCategory, string>;
|
|
19
|
+
export declare const LINDDUN_NAMES: Record<LinddunCategory, string>;
|
|
20
|
+
//# 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.21.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,7 +46,7 @@
|
|
|
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.
|
|
49
|
+
"@cclabsnz/sf-core": "^0.12.0",
|
|
50
50
|
"@oclif/core": "^5",
|
|
51
51
|
"@salesforce/core": "^9.3.0",
|
|
52
52
|
"@salesforce/sf-plugins-core": "^13",
|
|
@@ -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
|
}
|