@cclabsnz/sf-audit 1.3.0 → 1.6.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 +193 -12
- package/lib/api/MetadataClient.d.ts +4 -0
- package/lib/api/MetadataClient.js +2 -0
- package/lib/api/MetadataClientImpl.d.ts +8 -0
- package/lib/api/MetadataClientImpl.js +22 -0
- package/lib/api/RestClient.d.ts +2 -0
- package/lib/api/RestClientImpl.d.ts +2 -0
- package/lib/api/RestClientImpl.js +33 -0
- package/lib/apps/analyzeApps.d.ts +8 -0
- package/lib/apps/analyzeApps.js +19 -0
- package/lib/apps/appResolver.d.ts +4 -0
- package/lib/apps/appResolver.js +50 -0
- package/lib/apps/grantedAccess.d.ts +4 -0
- package/lib/apps/grantedAccess.js +36 -0
- package/lib/apps/leastPrivilege.d.ts +6 -0
- package/lib/apps/leastPrivilege.js +47 -0
- package/lib/apps/renderApps.d.ts +5 -0
- package/lib/apps/renderApps.js +23 -0
- package/lib/apps/standardAppCatalog.d.ts +11 -0
- package/lib/apps/standardAppCatalog.js +14 -0
- package/lib/apps/types.d.ts +64 -0
- package/lib/apps/types.js +2 -0
- package/lib/apps/usageCollector.d.ts +9 -0
- package/lib/apps/usageCollector.js +104 -0
- package/lib/chains/CapabilityRegistry.js +19 -0
- package/lib/chains/namedChains.js +67 -0
- package/lib/checks/eventLogAccess.d.ts +14 -0
- package/lib/checks/eventLogAccess.js +33 -0
- package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +13 -0
- package/lib/checks/impl/AgentActionSurfaceCheck.js +125 -0
- package/lib/checks/impl/AgentChannelExposureCheck.d.ts +15 -0
- package/lib/checks/impl/AgentChannelExposureCheck.js +223 -0
- package/lib/checks/impl/AgentInventoryCheck.d.ts +15 -0
- package/lib/checks/impl/AgentInventoryCheck.js +228 -0
- package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +12 -0
- package/lib/checks/impl/AgentMonitoringCoverageCheck.js +97 -0
- package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +13 -0
- package/lib/checks/impl/AgentUserPrivilegeCheck.js +204 -0
- package/lib/checks/impl/AuthProvidersCheck.d.ts +17 -0
- package/lib/checks/impl/AuthProvidersCheck.js +88 -0
- package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
- package/lib/checks/impl/ClassicSitesCheck.js +65 -0
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -0
- package/lib/checks/impl/CspTrustedSitesCheck.js +10 -1
- package/lib/checks/impl/DataExportAccessCheck.d.ts +19 -0
- package/lib/checks/impl/DataExportAccessCheck.js +79 -0
- package/lib/checks/impl/EncryptionCoverageCheck.d.ts +19 -0
- package/lib/checks/impl/EncryptionCoverageCheck.js +108 -0
- package/lib/checks/impl/EventMonitoringCheck.js +8 -5
- package/lib/checks/impl/ExperienceCspCheck.d.ts +18 -0
- package/lib/checks/impl/ExperienceCspCheck.js +57 -0
- package/lib/checks/impl/ExternalCredentialsCheck.d.ts +17 -0
- package/lib/checks/impl/ExternalCredentialsCheck.js +74 -0
- package/lib/checks/impl/GuestApiAccessCheck.d.ts +19 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
- package/lib/checks/impl/GuestObjectExposureCheck.d.ts +44 -0
- package/lib/checks/impl/GuestObjectExposureCheck.js +241 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +34 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +120 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +18 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.js +92 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +23 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.js +343 -0
- package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +26 -0
- package/lib/checks/impl/LoginAccessPolicyCheck.js +117 -0
- package/lib/checks/impl/LoginAnomalyCheck.d.ts +17 -0
- package/lib/checks/impl/LoginAnomalyCheck.js +98 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +17 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
- package/lib/checks/impl/SessionHardeningCheck.d.ts +21 -0
- package/lib/checks/impl/SessionHardeningCheck.js +134 -0
- package/lib/checks/impl/ThreatDetectionCheck.d.ts +17 -0
- package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
- package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +16 -0
- package/lib/checks/impl/TrustedUrlHygieneCheck.js +198 -0
- package/lib/checks/registry.js +52 -0
- package/lib/commands/audit/apps.d.ts +16 -0
- package/lib/commands/audit/apps.js +64 -0
- package/lib/commands/audit/diff.js +9 -5
- package/lib/commands/audit/events/pull.d.ts +17 -0
- package/lib/commands/audit/events/pull.js +88 -0
- package/lib/commands/audit/security.d.ts +5 -0
- package/lib/commands/audit/security.js +47 -17
- package/lib/compliance/catalogs/index.js +2 -0
- package/lib/compliance/catalogs/owaspLlm.d.ts +3 -0
- package/lib/compliance/catalogs/owaspLlm.js +34 -0
- package/lib/compliance/mapping.js +46 -7
- package/lib/compliance/resolve.js +4 -3
- package/lib/compliance/types.d.ts +1 -1
- package/lib/context/AuditCache.d.ts +31 -0
- package/lib/context/AuditContext.d.ts +6 -0
- package/lib/events/EventBaselineStore.d.ts +16 -0
- package/lib/events/EventBaselineStore.js +55 -0
- package/lib/events/eventLogQuery.d.ts +21 -0
- package/lib/events/eventLogQuery.js +34 -0
- package/lib/events/pullEventLogs.d.ts +51 -0
- package/lib/events/pullEventLogs.js +79 -0
- package/lib/findings/CheckMeta.js +22 -0
- package/lib/lib/wire.d.ts +4 -2
- package/lib/lib/wire.js +5 -1
- package/lib/renderers/ClientReportRenderer.js +1 -1
- package/package.json +16 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Common PII-bearing fields to probe for populated, real-looking data. A count
|
|
2
|
+
// query is cheap and non-invasive (no values are read).
|
|
3
|
+
const PII_PROBES = [
|
|
4
|
+
{ object: 'Contact', where: 'Email != null' },
|
|
5
|
+
{ object: 'Lead', where: 'Email != null' },
|
|
6
|
+
{ object: 'Contact', where: 'Phone != null' },
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Advisory for sandboxes: production data copied into a sandbox and left unmasked
|
|
10
|
+
* spreads real PII/PHI into a lower-trust environment with weaker controls and
|
|
11
|
+
* broader developer access. This check runs only in sandboxes and looks for
|
|
12
|
+
* populated PII fields as a proxy for "prod data present" — it cannot prove
|
|
13
|
+
* whether Data Mask has run, so it raises an advisory to confirm masking.
|
|
14
|
+
*/
|
|
15
|
+
export class SandboxDataMaskingCheck {
|
|
16
|
+
id = 'sandbox-data-masking';
|
|
17
|
+
name = 'Sandbox Data Masking';
|
|
18
|
+
category = 'Data Security';
|
|
19
|
+
description = 'In sandboxes, flags the presence of populated PII fields (likely unmasked production data) and advises running Salesforce Data Mask';
|
|
20
|
+
async run(ctx) {
|
|
21
|
+
const findings = [];
|
|
22
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
23
|
+
if (!ctx.orgInfo.isSandbox) {
|
|
24
|
+
findings.push({
|
|
25
|
+
id: 'sandbox-data-masking-na',
|
|
26
|
+
category: this.category,
|
|
27
|
+
riskLevel: 'LOW',
|
|
28
|
+
passed: true,
|
|
29
|
+
title: 'Not a sandbox — data masking not applicable',
|
|
30
|
+
detail: 'This org is a production org, so sandbox data-masking does not apply here.',
|
|
31
|
+
remediation: 'Apply Data Mask to sandboxes seeded from this production org so PII/PHI is not copied in the clear.',
|
|
32
|
+
});
|
|
33
|
+
return { findings };
|
|
34
|
+
}
|
|
35
|
+
let probed = 0;
|
|
36
|
+
let populated = 0;
|
|
37
|
+
for (const p of PII_PROBES) {
|
|
38
|
+
try {
|
|
39
|
+
const r = await ctx.soql.query(`SELECT COUNT() FROM ${p.object} WHERE ${p.where}`);
|
|
40
|
+
probed++;
|
|
41
|
+
if (r.totalSize > 0)
|
|
42
|
+
populated++;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// object not present / not accessible — skip this probe
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (probed === 0) {
|
|
49
|
+
findings.push({
|
|
50
|
+
id: 'sandbox-data-masking-inconclusive',
|
|
51
|
+
category: this.category,
|
|
52
|
+
riskLevel: 'INFO',
|
|
53
|
+
inconclusive: true,
|
|
54
|
+
title: 'Could not probe for PII data in this sandbox',
|
|
55
|
+
detail: 'None of the PII probe objects were queryable, so the presence of unmasked production data could not be assessed.',
|
|
56
|
+
remediation: 'Confirm Data Mask has been run on this sandbox (Setup → Data Mask), independent of this check.',
|
|
57
|
+
});
|
|
58
|
+
return { findings };
|
|
59
|
+
}
|
|
60
|
+
if (populated > 0) {
|
|
61
|
+
findings.push({
|
|
62
|
+
id: 'sandbox-data-masking-pii-present',
|
|
63
|
+
category: this.category,
|
|
64
|
+
riskLevel: 'MEDIUM',
|
|
65
|
+
title: 'Sandbox contains populated PII fields — confirm Data Mask has run',
|
|
66
|
+
detail: 'This is a sandbox and PII-bearing fields (e.g. Contact/Lead email or phone) are populated, which is the footprint of a production copy. If Data Mask has not been run, real PII/PHI is sitting in a lower-trust environment with broader developer/admin access and weaker monitoring. This check cannot confirm whether masking was applied — only that sensitive fields hold data.',
|
|
67
|
+
remediation: 'Run Salesforce Data Mask on this sandbox (Setup → Data Mask) after each refresh, masking PII/PHI fields. Restrict sandbox access and treat sandbox data with the same controls as production until masking is confirmed.',
|
|
68
|
+
affectedItems: [{ label: 'Data Mask', url: `${baseUrl}/lightning/setup/DataMask/home` }],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
findings.push({
|
|
73
|
+
id: 'sandbox-data-masking-ok',
|
|
74
|
+
category: this.category,
|
|
75
|
+
riskLevel: 'LOW',
|
|
76
|
+
passed: true,
|
|
77
|
+
title: 'Sandbox shows no populated PII in the probed fields',
|
|
78
|
+
detail: `Probed ${probed} PII field(s); none were populated, consistent with a masked or data-free sandbox.`,
|
|
79
|
+
remediation: 'Continue running Data Mask after each sandbox refresh.',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return { findings };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=SandboxDataMaskingCheck.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Re-slices the Health Check risk set (populated by HealthCheckCheck, so no extra
|
|
5
|
+
* API call) to the session / clickjack / CSRF / XSS hardening domain and gives
|
|
6
|
+
* targeted, per-setting remediation. HealthCheckCheck reports a flat count; this
|
|
7
|
+
* check tells you *which* browser-session protections deviate from Salesforce's
|
|
8
|
+
* baseline and how to fix each — the "enable secure config" surface.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SessionHardeningCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "session-hardening";
|
|
12
|
+
readonly name = "Session & Clickjack Hardening";
|
|
13
|
+
readonly category = "Session Security";
|
|
14
|
+
readonly description = "Grades clickjack, CSRF, session-lock, and XSS-protection settings from Health Check and gives per-setting remediation";
|
|
15
|
+
readonly dependsOnCache: readonly ["healthCheckRisks"];
|
|
16
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
17
|
+
private static readonly FLAGS;
|
|
18
|
+
/** Authoritative evaluation from SecuritySettings metadata; null → fall back to the cache path. */
|
|
19
|
+
private evaluateFromMetadata;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=SessionHardeningCheck.d.ts.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Health Check settings that belong to the session / framing / request-forgery
|
|
2
|
+
// hardening domain. Matched case-insensitively against the risk `setting` name.
|
|
3
|
+
const SESSION_KEYWORDS = [
|
|
4
|
+
'clickjack', 'frame', 'csrf', 'cross-site request', 'session', 'timeout',
|
|
5
|
+
'xss', 'content sniffing', 'content-type', 'referrer', 'httponly', 'lock sessions',
|
|
6
|
+
'cache', 'mixed content', 'browser', 'redirect',
|
|
7
|
+
];
|
|
8
|
+
/**
|
|
9
|
+
* Re-slices the Health Check risk set (populated by HealthCheckCheck, so no extra
|
|
10
|
+
* API call) to the session / clickjack / CSRF / XSS hardening domain and gives
|
|
11
|
+
* targeted, per-setting remediation. HealthCheckCheck reports a flat count; this
|
|
12
|
+
* check tells you *which* browser-session protections deviate from Salesforce's
|
|
13
|
+
* baseline and how to fix each — the "enable secure config" surface.
|
|
14
|
+
*/
|
|
15
|
+
export class SessionHardeningCheck {
|
|
16
|
+
id = 'session-hardening';
|
|
17
|
+
name = 'Session & Clickjack Hardening';
|
|
18
|
+
category = 'Session Security';
|
|
19
|
+
description = 'Grades clickjack, CSRF, session-lock, and XSS-protection settings from Health Check and gives per-setting remediation';
|
|
20
|
+
dependsOnCache = ['healthCheckRisks'];
|
|
21
|
+
async run(ctx) {
|
|
22
|
+
const findings = [];
|
|
23
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/SessionSettings/home`;
|
|
24
|
+
// Prefer authoritative SecuritySettings (Metadata API) — it reports the actual
|
|
25
|
+
// values, not just Health Check deviations. Fall back to the Health Check risk
|
|
26
|
+
// cache when no Metadata client is available or the shape is unexpected.
|
|
27
|
+
const fromMeta = await this.evaluateFromMetadata(ctx, setupUrl);
|
|
28
|
+
if (fromMeta) {
|
|
29
|
+
findings.push(fromMeta);
|
|
30
|
+
return { findings };
|
|
31
|
+
}
|
|
32
|
+
const risks = ctx.cache.healthCheckRisks;
|
|
33
|
+
if (risks === undefined) {
|
|
34
|
+
findings.push({
|
|
35
|
+
id: 'session-hardening-inconclusive',
|
|
36
|
+
category: this.category,
|
|
37
|
+
riskLevel: 'INFO',
|
|
38
|
+
inconclusive: true,
|
|
39
|
+
title: 'Health Check risks unavailable — session hardening not evaluated',
|
|
40
|
+
detail: 'The Security Health Check risk data was not collected (Health Check check did not run or was inaccessible), so session/clickjack settings could not be graded.',
|
|
41
|
+
remediation: 'Ensure the audit user can read SecurityHealthCheckRisks (View Health Check), then re-run.',
|
|
42
|
+
});
|
|
43
|
+
return { findings };
|
|
44
|
+
}
|
|
45
|
+
const matched = risks.filter((r) => {
|
|
46
|
+
const s = (r.setting ?? '').toLowerCase();
|
|
47
|
+
return SESSION_KEYWORDS.some((k) => s.includes(k));
|
|
48
|
+
});
|
|
49
|
+
if (matched.length === 0) {
|
|
50
|
+
findings.push({
|
|
51
|
+
id: 'session-hardening-ok',
|
|
52
|
+
category: this.category,
|
|
53
|
+
riskLevel: 'LOW',
|
|
54
|
+
passed: true,
|
|
55
|
+
title: 'No session/clickjack/CSRF settings flagged by Health Check',
|
|
56
|
+
detail: 'None of the browser-session hardening settings (clickjack protection, CSRF protection, session lock, XSS protection) deviate from the Salesforce baseline in Health Check.',
|
|
57
|
+
remediation: 'Keep clickjack protection at the highest level, CSRF protection on for GET and POST, and "Lock sessions to the IP address from which they originated" enabled where feasible.',
|
|
58
|
+
});
|
|
59
|
+
return { findings };
|
|
60
|
+
}
|
|
61
|
+
const high = matched.filter((r) => r.riskType === 'HIGH_RISK');
|
|
62
|
+
const level = high.length > 0 ? 'HIGH' : 'MEDIUM';
|
|
63
|
+
findings.push({
|
|
64
|
+
id: 'session-hardening-risks',
|
|
65
|
+
category: this.category,
|
|
66
|
+
riskLevel: level,
|
|
67
|
+
title: `${matched.length} session/clickjack/CSRF setting(s) deviate from the security baseline`,
|
|
68
|
+
detail: 'These browser-session hardening settings differ from Salesforce\'s recommended values. Weak framing, CSRF, session-lock, or XSS-protection settings enable clickjacking, cross-site request forgery, session hijacking, and reflected-XSS attacks against authenticated users.',
|
|
69
|
+
remediation: 'In Setup → Session Settings (and Session Security Levels), align each flagged setting to the recommended value: highest clickjack protection for all pages, CSRF protection on GET and POST, "Lock sessions to the IP address" and "to the domain", content-sniffing and XSS protection on, and warnings on redirects to external URLs.',
|
|
70
|
+
affectedItems: matched.slice(0, 30).map((r) => ({
|
|
71
|
+
label: `${r.setting} = ${r.value} (${r.riskType})`,
|
|
72
|
+
url: setupUrl,
|
|
73
|
+
})),
|
|
74
|
+
});
|
|
75
|
+
return { findings };
|
|
76
|
+
}
|
|
77
|
+
// SecuritySettings.sessionSettings flags that should be ON (true = protected).
|
|
78
|
+
static FLAGS = [
|
|
79
|
+
{ key: 'enableClickjackNonsetupUser', label: 'Clickjack protection (customer Visualforce pages)', sev: 'HIGH' },
|
|
80
|
+
{ key: 'enableClickjackNonsetupSFDC', label: 'Clickjack protection (Salesforce pages)', sev: 'HIGH' },
|
|
81
|
+
{ key: 'enableXssProtection', label: 'XSS protection', sev: 'HIGH' },
|
|
82
|
+
{ key: 'enableCSRFOnGet', label: 'CSRF protection on GET requests', sev: 'MEDIUM' },
|
|
83
|
+
{ key: 'enableCSRFOnPost', label: 'CSRF protection on POST requests', sev: 'MEDIUM' },
|
|
84
|
+
{ key: 'enableContentSniffingProtection', label: 'Content-sniffing protection', sev: 'MEDIUM' },
|
|
85
|
+
];
|
|
86
|
+
/** Authoritative evaluation from SecuritySettings metadata; null → fall back to the cache path. */
|
|
87
|
+
async evaluateFromMetadata(ctx, setupUrl) {
|
|
88
|
+
if (!ctx.metadata)
|
|
89
|
+
return null;
|
|
90
|
+
let ss;
|
|
91
|
+
try {
|
|
92
|
+
ss = await ctx.metadata.read('SecuritySettings', 'Security');
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const s = ss?.sessionSettings;
|
|
98
|
+
if (!s || typeof s !== 'object')
|
|
99
|
+
return null;
|
|
100
|
+
const gaps = [];
|
|
101
|
+
let sawAny = false;
|
|
102
|
+
for (const f of SessionHardeningCheck.FLAGS) {
|
|
103
|
+
const v = s[f.key];
|
|
104
|
+
if (typeof v === 'boolean') {
|
|
105
|
+
sawAny = true;
|
|
106
|
+
if (!v)
|
|
107
|
+
gaps.push({ label: f.label, sev: f.sev });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!sawAny)
|
|
111
|
+
return null; // unexpected shape — defer to the Health Check cache path
|
|
112
|
+
if (gaps.length === 0) {
|
|
113
|
+
return {
|
|
114
|
+
id: 'session-hardening-ok',
|
|
115
|
+
category: this.category,
|
|
116
|
+
riskLevel: 'LOW',
|
|
117
|
+
passed: true,
|
|
118
|
+
title: 'Clickjack/CSRF/XSS protections confirmed enabled',
|
|
119
|
+
detail: 'SecuritySettings confirms clickjack, CSRF, XSS, and content-sniffing protections are enabled.',
|
|
120
|
+
remediation: 'Also confirm "Lock sessions to the IP address from which they originated" and a short session timeout in Setup → Session Settings.',
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
id: 'session-hardening-risks',
|
|
125
|
+
category: this.category,
|
|
126
|
+
riskLevel: gaps.some((g) => g.sev === 'HIGH') ? 'HIGH' : 'MEDIUM',
|
|
127
|
+
title: `${gaps.length} browser-session protection(s) are disabled`,
|
|
128
|
+
detail: 'SecuritySettings reports these session/framing protections are OFF. Disabled clickjack, CSRF, XSS, or content-sniffing protection enables clickjacking, cross-site request forgery, reflected XSS, and MIME-confusion attacks against authenticated users.',
|
|
129
|
+
remediation: 'In Setup → Session Settings, enable the disabled protections: highest clickjack protection for all page types, CSRF protection on GET and POST, XSS protection, and content-sniffing protection. Also enable "Lock sessions to the IP address" where feasible.',
|
|
130
|
+
affectedItems: gaps.map((g) => ({ label: `${g.label}: OFF (${g.sev})`, url: setupUrl })),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=SessionHardeningCheck.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Verifies that Threat Detection event storage (especially Guest User Anomaly) is
|
|
5
|
+
* available and retaining events. An empty/unavailable store means the one control
|
|
6
|
+
* that would flag anomalous guest bulk-reads is blind, so a "no anomalies" result
|
|
7
|
+
* is meaningless. This complements TransactionSecurityPolicyCheck (which looks at
|
|
8
|
+
* policies, not whether anomaly events are actually stored).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ThreatDetectionCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "threat-detection";
|
|
12
|
+
readonly name = "Threat Detection Event Storage";
|
|
13
|
+
readonly category = "Monitoring";
|
|
14
|
+
readonly description = "Verifies Real-Time Event Monitoring Threat Detection storage (Guest User Anomaly and siblings) is enabled and retaining events to detect anomalous guest bulk-access";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ThreatDetectionCheck.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Real-Time Event Monitoring Threat Detection stores. GuestUserAnomalyEventStore is
|
|
2
|
+
// the one that flags anomalous guest bulk-access (the vector in guest-data leaks).
|
|
3
|
+
const ANOMALY_STORES = [
|
|
4
|
+
'GuestUserAnomalyEventStore',
|
|
5
|
+
'ApiAnomalyEventStore',
|
|
6
|
+
'LoginAnomalyEventStore',
|
|
7
|
+
'SessionHijackingEventStore',
|
|
8
|
+
'CredentialStuffingEventStore',
|
|
9
|
+
'ReportAnomalyEventStore',
|
|
10
|
+
];
|
|
11
|
+
/**
|
|
12
|
+
* Verifies that Threat Detection event storage (especially Guest User Anomaly) is
|
|
13
|
+
* available and retaining events. An empty/unavailable store means the one control
|
|
14
|
+
* that would flag anomalous guest bulk-reads is blind, so a "no anomalies" result
|
|
15
|
+
* is meaningless. This complements TransactionSecurityPolicyCheck (which looks at
|
|
16
|
+
* policies, not whether anomaly events are actually stored).
|
|
17
|
+
*/
|
|
18
|
+
export class ThreatDetectionCheck {
|
|
19
|
+
id = 'threat-detection';
|
|
20
|
+
name = 'Threat Detection Event Storage';
|
|
21
|
+
category = 'Monitoring';
|
|
22
|
+
description = 'Verifies Real-Time Event Monitoring Threat Detection storage (Guest User Anomaly and siblings) is enabled and retaining events to detect anomalous guest bulk-access';
|
|
23
|
+
async run(ctx) {
|
|
24
|
+
const findings = [];
|
|
25
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
26
|
+
const setupUrl = `${baseUrl}/lightning/setup/EventManager/home`;
|
|
27
|
+
const queryable = [];
|
|
28
|
+
const withData = [];
|
|
29
|
+
let guestStoreQueryable = false;
|
|
30
|
+
for (const store of ANOMALY_STORES) {
|
|
31
|
+
try {
|
|
32
|
+
const rows = await ctx.soql.queryAll(`SELECT EventDate FROM ${store} WHERE EventDate = LAST_N_DAYS:180 LIMIT 1`);
|
|
33
|
+
queryable.push(store);
|
|
34
|
+
if (store === 'GuestUserAnomalyEventStore')
|
|
35
|
+
guestStoreQueryable = true;
|
|
36
|
+
if (rows.length > 0)
|
|
37
|
+
withData.push(store);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Store not present / not queryable (Threat Detection not licensed or storage off).
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (queryable.length === 0) {
|
|
44
|
+
findings.push({
|
|
45
|
+
id: 'threat-detection-unavailable',
|
|
46
|
+
category: this.category,
|
|
47
|
+
riskLevel: 'MEDIUM',
|
|
48
|
+
title: 'Threat Detection event storage is not available',
|
|
49
|
+
detail: 'No Threat Detection anomaly store (e.g. GuestUserAnomalyEventStore) is queryable. Real-Time Event Monitoring / Threat Detection is not licensed or its storage is disabled, so anomalous guest bulk-access cannot be detected or investigated.',
|
|
50
|
+
remediation: 'Enable Real-Time Event Monitoring and turn on storage for the Threat Detection events (Setup > Event Manager), especially Guest User Anomaly. Add alerting/automation on these events.',
|
|
51
|
+
affectedItems: [{ label: 'Event Manager', url: setupUrl, note: 'Enable Threat Detection event storage' }],
|
|
52
|
+
});
|
|
53
|
+
return { findings };
|
|
54
|
+
}
|
|
55
|
+
if (!guestStoreQueryable) {
|
|
56
|
+
findings.push({
|
|
57
|
+
id: 'threat-detection-guest-anomaly-missing',
|
|
58
|
+
category: this.category,
|
|
59
|
+
riskLevel: 'MEDIUM',
|
|
60
|
+
title: 'Guest User Anomaly detection store is not available',
|
|
61
|
+
detail: 'Other Threat Detection stores exist, but GuestUserAnomalyEventStore is not queryable, so anomalous guest bulk-access is not being detected or retained.',
|
|
62
|
+
remediation: 'Enable storage for the Guest User Anomaly event in Setup > Event Manager and add alerting.',
|
|
63
|
+
affectedItems: [{ label: 'Event Manager', url: setupUrl }],
|
|
64
|
+
});
|
|
65
|
+
return { findings };
|
|
66
|
+
}
|
|
67
|
+
if (withData.length === 0) {
|
|
68
|
+
findings.push({
|
|
69
|
+
id: 'threat-detection-inactive',
|
|
70
|
+
category: this.category,
|
|
71
|
+
riskLevel: 'MEDIUM',
|
|
72
|
+
title: 'Threat Detection stores are present but contain no events',
|
|
73
|
+
detail: 'The Threat Detection anomaly stores are queryable but hold no events in the last 180 days. Storage may have been enabled only recently, or detection is not generating events. Until events accumulate, "no anomalies" is not evidence of safe behaviour, and historical anomalous guest access cannot be reconstructed.',
|
|
74
|
+
remediation: 'Confirm storage is enabled for the anomaly events (Setup > Event Manager) and has been for the full retention window. Verify Transaction Security / Threat Detection policies are active and alerting.',
|
|
75
|
+
affectedItems: [{ label: 'Event Manager', url: setupUrl }],
|
|
76
|
+
});
|
|
77
|
+
return { findings };
|
|
78
|
+
}
|
|
79
|
+
findings.push({
|
|
80
|
+
id: 'threat-detection-active',
|
|
81
|
+
category: this.category,
|
|
82
|
+
riskLevel: 'LOW',
|
|
83
|
+
passed: true,
|
|
84
|
+
title: `Threat Detection storage active (${withData.length}/${queryable.length} stores have recent events)`,
|
|
85
|
+
detail: `Guest User Anomaly detection is available and Threat Detection events are being stored (${withData.join(', ')}).`,
|
|
86
|
+
remediation: 'Keep storage enabled and ensure alerting/automation acts on Guest User Anomaly events.',
|
|
87
|
+
});
|
|
88
|
+
return { findings };
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=ThreatDetectionCheck.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
export declare class TrustedUrlHygieneCheck implements SecurityCheck {
|
|
4
|
+
readonly id = "trusted-url-hygiene";
|
|
5
|
+
readonly name = "Trusted URL Hygiene";
|
|
6
|
+
readonly category = "AI & Agents";
|
|
7
|
+
readonly description = "Reviews the CSP trusted-sites allowlist for non-Salesforce domains that could be repurposed as data-exfiltration channels (the ForcedLeak pattern). With --resolve-domains, DNS-checks each domain for unresolvable or parked entries.";
|
|
8
|
+
readonly dependsOnCache: readonly ["cspTrustedSites"];
|
|
9
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
|
+
private reviewFinding;
|
|
11
|
+
private unresolvableFinding;
|
|
12
|
+
private parkedFinding;
|
|
13
|
+
private unverifiableFinding;
|
|
14
|
+
}
|
|
15
|
+
export declare function extractDomain(endpoint: string): string | null;
|
|
16
|
+
//# sourceMappingURL=TrustedUrlHygieneCheck.d.ts.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { resolve as dnsResolve } from 'node:dns/promises';
|
|
2
|
+
// Domains treated as "Salesforce family" and therefore not flagged. This is a review
|
|
3
|
+
// heuristic to cut noise, NOT an allowlist: an attacker-controlled subdomain of a
|
|
4
|
+
// look-alike is not made safe by matching one of these suffixes. Any trusted URL outside
|
|
5
|
+
// this set is surfaced for a human to confirm it is still owned and expected.
|
|
6
|
+
const SALESFORCE_FAMILY_DOMAINS = [
|
|
7
|
+
'salesforce.com',
|
|
8
|
+
'force.com',
|
|
9
|
+
'salesforce-experience.com',
|
|
10
|
+
'visualforce.com',
|
|
11
|
+
'documentforce.com',
|
|
12
|
+
'salesforceliveagent.com',
|
|
13
|
+
'sfdcstatic.com',
|
|
14
|
+
];
|
|
15
|
+
// Nameservers that indicate a domain has lapsed and been picked up by a parking /
|
|
16
|
+
// drop-catch provider. Heuristic: matched as substrings of the resolved NS hostnames.
|
|
17
|
+
// A parked trusted domain is the ForcedLeak precondition (an expired allowlisted domain
|
|
18
|
+
// re-registered by an attacker as an exfiltration channel).
|
|
19
|
+
const PARKING_NAMESERVERS = ['parkingcrew', 'sedoparking', 'bodis', 'afternic', 'dan.com'];
|
|
20
|
+
// Bound outbound DNS work so a large allowlist cannot fan out into hundreds of
|
|
21
|
+
// simultaneous lookups, and cap each individual lookup so one slow domain cannot stall
|
|
22
|
+
// the audit.
|
|
23
|
+
const DNS_CONCURRENCY = 5;
|
|
24
|
+
const DNS_TIMEOUT_MS = 3000;
|
|
25
|
+
export class TrustedUrlHygieneCheck {
|
|
26
|
+
id = 'trusted-url-hygiene';
|
|
27
|
+
name = 'Trusted URL Hygiene';
|
|
28
|
+
category = 'AI & Agents';
|
|
29
|
+
description = 'Reviews the CSP trusted-sites allowlist for non-Salesforce domains that could be repurposed as data-exfiltration channels (the ForcedLeak pattern). With --resolve-domains, DNS-checks each domain for unresolvable or parked entries.';
|
|
30
|
+
dependsOnCache = ['cspTrustedSites'];
|
|
31
|
+
async run(ctx) {
|
|
32
|
+
const sites = ctx.cache.cspTrustedSites;
|
|
33
|
+
// Cache absent: CspTrustedSitesCheck was skipped/failed. Nothing to review, stay silent.
|
|
34
|
+
if (!sites)
|
|
35
|
+
return { findings: [] };
|
|
36
|
+
// Flag every active trusted URL whose domain is not in the Salesforce family.
|
|
37
|
+
const flagged = new Map();
|
|
38
|
+
for (const s of sites) {
|
|
39
|
+
if (!s.isActive)
|
|
40
|
+
continue;
|
|
41
|
+
const domain = extractDomain(s.endpointUrl);
|
|
42
|
+
if (!domain)
|
|
43
|
+
continue;
|
|
44
|
+
if (isSalesforceFamily(domain))
|
|
45
|
+
continue;
|
|
46
|
+
if (!flagged.has(domain))
|
|
47
|
+
flagged.set(domain, s);
|
|
48
|
+
}
|
|
49
|
+
if (flagged.size === 0)
|
|
50
|
+
return { findings: [] };
|
|
51
|
+
const resolveDomains = ctx.options?.resolveDomains === true;
|
|
52
|
+
if (!resolveDomains) {
|
|
53
|
+
return { findings: [...flagged.entries()].map(([d, s]) => this.reviewFinding(d, s)) };
|
|
54
|
+
}
|
|
55
|
+
// --resolve-domains: DNS-check each flagged domain with bounded concurrency.
|
|
56
|
+
const domains = [...flagged.keys()];
|
|
57
|
+
const outcomes = await mapWithConcurrency(domains, DNS_CONCURRENCY, (d) => resolveDomain(d));
|
|
58
|
+
const findings = [];
|
|
59
|
+
domains.forEach((domain, i) => {
|
|
60
|
+
const site = flagged.get(domain);
|
|
61
|
+
const outcome = outcomes[i];
|
|
62
|
+
switch (outcome.kind) {
|
|
63
|
+
case 'unresolvable':
|
|
64
|
+
findings.push(this.unresolvableFinding(domain, site));
|
|
65
|
+
break;
|
|
66
|
+
case 'parked':
|
|
67
|
+
findings.push(this.parkedFinding(domain, site, outcome.nameservers));
|
|
68
|
+
break;
|
|
69
|
+
case 'unverifiable':
|
|
70
|
+
findings.push(this.unverifiableFinding(domain, site, outcome.reason));
|
|
71
|
+
break;
|
|
72
|
+
case 'resolved':
|
|
73
|
+
// Resolves cleanly to non-parking nameservers: still non-Salesforce, so keep the
|
|
74
|
+
// review finding rather than silently passing it.
|
|
75
|
+
findings.push(this.reviewFinding(domain, site));
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return { findings };
|
|
80
|
+
}
|
|
81
|
+
reviewFinding(domain, site) {
|
|
82
|
+
return {
|
|
83
|
+
id: `trusted-url-hygiene-review-${domain}`,
|
|
84
|
+
category: this.category,
|
|
85
|
+
riskLevel: 'LOW',
|
|
86
|
+
title: `CSP trusted site "${domain}" is a non-Salesforce domain`,
|
|
87
|
+
detail: `The CSP trusted-sites allowlist includes "${site.endpointUrl}", whose domain "${domain}" is not ` +
|
|
88
|
+
`part of the Salesforce platform. Every allowlisted domain is a place Lightning/Agentforce output can ` +
|
|
89
|
+
`send data to. In the ForcedLeak incident an expired allowlisted domain was re-registered by an attacker ` +
|
|
90
|
+
`and used as the exfiltration channel for prompt-injected data. Confirm this domain is still owned by a ` +
|
|
91
|
+
`party you trust and is still required.`,
|
|
92
|
+
remediation: 'Verify ownership and continued need for this trusted site. Remove it if it is no longer required. ' +
|
|
93
|
+
'To DNS-check the allowlist automatically, re-run with --resolve-domains.',
|
|
94
|
+
affectedItems: [{ label: site.endpointUrl, note: site.context ? `Context: ${site.context}` : undefined }],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
unresolvableFinding(domain, site) {
|
|
98
|
+
return {
|
|
99
|
+
id: `trusted-url-hygiene-unresolvable-${domain}`,
|
|
100
|
+
category: this.category,
|
|
101
|
+
riskLevel: 'CRITICAL',
|
|
102
|
+
title: `CSP trusted site "${domain}" does not resolve (unregistered/expired)`,
|
|
103
|
+
detail: `The trusted domain "${domain}" (${site.endpointUrl}) returned NXDOMAIN — it does not resolve. An ` +
|
|
104
|
+
`unregistered domain on the CSP allowlist is the literal ForcedLeak precondition: anyone can register it ` +
|
|
105
|
+
`and instantly gain an allowlisted exfiltration channel for data from Lightning components and Agentforce ` +
|
|
106
|
+
`agent output.`,
|
|
107
|
+
remediation: 'Remove this trusted site immediately, or re-register the domain under your control if it must remain allowlisted.',
|
|
108
|
+
affectedItems: [{ label: site.endpointUrl, note: site.context ? `Context: ${site.context}` : undefined }],
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
parkedFinding(domain, site, nameservers) {
|
|
112
|
+
return {
|
|
113
|
+
id: `trusted-url-hygiene-parked-${domain}`,
|
|
114
|
+
category: this.category,
|
|
115
|
+
riskLevel: 'CRITICAL',
|
|
116
|
+
title: `CSP trusted site "${domain}" appears to be a parked/dropped domain`,
|
|
117
|
+
detail: `The trusted domain "${domain}" (${site.endpointUrl}) resolves to nameservers associated with a domain ` +
|
|
118
|
+
`parking / drop-catch provider (${nameservers.join(', ')}). This strongly suggests the domain lapsed and ` +
|
|
119
|
+
`is no longer under your control — the ForcedLeak pattern, where an expired allowlisted domain is reused ` +
|
|
120
|
+
`as an exfiltration channel.`,
|
|
121
|
+
remediation: 'Remove this trusted site immediately and reclaim the domain if it must remain allowlisted.',
|
|
122
|
+
affectedItems: [{ label: site.endpointUrl, note: `Nameservers: ${nameservers.join(', ')}` }],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
unverifiableFinding(domain, site, reason) {
|
|
126
|
+
return {
|
|
127
|
+
id: `trusted-url-hygiene-unverified-${domain}`,
|
|
128
|
+
category: this.category,
|
|
129
|
+
riskLevel: 'INFO',
|
|
130
|
+
title: `Could not verify CSP trusted domain "${domain}"`,
|
|
131
|
+
detail: `A DNS lookup for the trusted domain "${domain}" (${site.endpointUrl}) could not be completed (${reason}). ` +
|
|
132
|
+
`This is not itself a finding — the domain may be healthy — but it could not be checked from the machine ` +
|
|
133
|
+
`running the audit.`,
|
|
134
|
+
remediation: 'Re-run --resolve-domains from a network with outbound DNS, or verify the domain manually.',
|
|
135
|
+
affectedItems: [{ label: site.endpointUrl, note: site.context ? `Context: ${site.context}` : undefined }],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Extract the registrable-ish domain from a CSP endpoint URL. CSP endpoints may be bare
|
|
140
|
+
// hostnames, wildcards (*.example.com), or full URLs; normalise to a lowercase hostname.
|
|
141
|
+
export function extractDomain(endpoint) {
|
|
142
|
+
let host = endpoint.trim().toLowerCase();
|
|
143
|
+
host = host.replace(/^[a-z]+:\/\//, ''); // strip scheme
|
|
144
|
+
host = host.replace(/^\*\./, ''); // strip leading wildcard label
|
|
145
|
+
host = host.split('/')[0]; // drop any path
|
|
146
|
+
host = host.split('?')[0];
|
|
147
|
+
host = host.split(':')[0]; // drop port
|
|
148
|
+
host = host.replace(/\.$/, ''); // trailing dot
|
|
149
|
+
return host.length > 0 ? host : null;
|
|
150
|
+
}
|
|
151
|
+
function isSalesforceFamily(domain) {
|
|
152
|
+
return SALESFORCE_FAMILY_DOMAINS.some((f) => domain === f || domain.endsWith(`.${f}`));
|
|
153
|
+
}
|
|
154
|
+
// Resolve one domain into a ResolveOutcome. Never throws: DNS errors are classified.
|
|
155
|
+
async function resolveDomain(domain) {
|
|
156
|
+
try {
|
|
157
|
+
const ns = await withTimeout(dnsResolve(domain, 'NS'), DNS_TIMEOUT_MS);
|
|
158
|
+
const nsHosts = ns.map((h) => h.toLowerCase());
|
|
159
|
+
const parkingHits = nsHosts.filter((h) => PARKING_NAMESERVERS.some((p) => h.includes(p)));
|
|
160
|
+
if (parkingHits.length > 0)
|
|
161
|
+
return { kind: 'parked', nameservers: nsHosts };
|
|
162
|
+
return { kind: 'resolved' };
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
const code = err?.code ?? '';
|
|
166
|
+
if (code === 'ENOTFOUND' || code === 'NXDOMAIN' || code === 'ENODATA') {
|
|
167
|
+
// ENODATA: domain exists but has no NS answer — treat as resolved-but-unverifiable
|
|
168
|
+
// only for ENODATA; NXDOMAIN/ENOTFOUND are the unregistered case.
|
|
169
|
+
if (code === 'ENODATA')
|
|
170
|
+
return { kind: 'resolved' };
|
|
171
|
+
return { kind: 'unresolvable' };
|
|
172
|
+
}
|
|
173
|
+
const reason = code || (err instanceof Error ? err.message : String(err)) || 'DNS error';
|
|
174
|
+
return { kind: 'unverifiable', reason };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// Reject with a marker error if the wrapped promise does not settle within ms.
|
|
178
|
+
function withTimeout(p, ms) {
|
|
179
|
+
return Promise.race([
|
|
180
|
+
p,
|
|
181
|
+
new Promise((_, reject) => setTimeout(() => reject(Object.assign(new Error('DNS timeout'), { code: 'ETIMEDOUT' })), ms).unref?.()),
|
|
182
|
+
]);
|
|
183
|
+
}
|
|
184
|
+
// Map over items with a fixed worker pool, preserving input order in the result.
|
|
185
|
+
async function mapWithConcurrency(items, limit, fn) {
|
|
186
|
+
const results = new Array(items.length);
|
|
187
|
+
let next = 0;
|
|
188
|
+
const worker = async () => {
|
|
189
|
+
while (next < items.length) {
|
|
190
|
+
const i = next++;
|
|
191
|
+
results[i] = await fn(items[i]);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const workers = Array.from({ length: Math.min(limit, items.length) }, () => worker());
|
|
195
|
+
await Promise.all(workers);
|
|
196
|
+
return results;
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=TrustedUrlHygieneCheck.js.map
|
package/lib/checks/registry.js
CHANGED
|
@@ -66,9 +66,34 @@ import { GuestExecutableApexCheck } from './impl/GuestExecutableApexCheck.js';
|
|
|
66
66
|
import { EmailSecurityCheck } from './impl/EmailSecurityCheck.js';
|
|
67
67
|
import { OutboundMessagesCheck } from './impl/OutboundMessagesCheck.js';
|
|
68
68
|
import { PublicContentExposureCheck } from './impl/PublicContentExposureCheck.js';
|
|
69
|
+
import { GuestObjectExposureCheck } from './impl/GuestObjectExposureCheck.js';
|
|
70
|
+
import { GuestSiteOptionsCheck } from './impl/GuestSiteOptionsCheck.js';
|
|
71
|
+
import { GuestRecordAccessPolicyCheck } from './impl/GuestRecordAccessPolicyCheck.js';
|
|
72
|
+
import { GuestTrafficAnomalyCheck } from './impl/GuestTrafficAnomalyCheck.js';
|
|
73
|
+
import { ThreatDetectionCheck } from './impl/ThreatDetectionCheck.js';
|
|
74
|
+
// Org-surface hardening checks (no cache deps)
|
|
75
|
+
import { LoginAccessPolicyCheck } from './impl/LoginAccessPolicyCheck.js';
|
|
76
|
+
import { DataExportAccessCheck } from './impl/DataExportAccessCheck.js';
|
|
77
|
+
import { ClassicSitesCheck } from './impl/ClassicSitesCheck.js';
|
|
78
|
+
import { AuthProvidersCheck } from './impl/AuthProvidersCheck.js';
|
|
79
|
+
import { GuestApiAccessCheck } from './impl/GuestApiAccessCheck.js';
|
|
80
|
+
import { ExternalCredentialsCheck } from './impl/ExternalCredentialsCheck.js';
|
|
81
|
+
import { LoginAnomalyCheck } from './impl/LoginAnomalyCheck.js';
|
|
82
|
+
import { SessionHardeningCheck } from './impl/SessionHardeningCheck.js';
|
|
83
|
+
import { EncryptionCoverageCheck } from './impl/EncryptionCoverageCheck.js';
|
|
84
|
+
import { ExperienceCspCheck } from './impl/ExperienceCspCheck.js';
|
|
85
|
+
import { SandboxDataMaskingCheck } from './impl/SandboxDataMaskingCheck.js';
|
|
69
86
|
// Access-control depth: effective-permission resolution + combination analysis
|
|
70
87
|
import { PrivilegedAccessCheck } from './impl/PrivilegedAccessCheck.js';
|
|
71
88
|
import { SeparationOfDutiesCheck } from './impl/SeparationOfDutiesCheck.js';
|
|
89
|
+
// AI & Agents — Agentforce / GenAI checks (v1.5). AgentInventoryCheck is the single point
|
|
90
|
+
// of agent queries; the dependent checks (Phase 2) read the cache keys it populates.
|
|
91
|
+
import { AgentInventoryCheck } from './impl/AgentInventoryCheck.js';
|
|
92
|
+
import { AgentUserPrivilegeCheck } from './impl/AgentUserPrivilegeCheck.js';
|
|
93
|
+
import { AgentActionSurfaceCheck } from './impl/AgentActionSurfaceCheck.js';
|
|
94
|
+
import { AgentChannelExposureCheck } from './impl/AgentChannelExposureCheck.js';
|
|
95
|
+
import { AgentMonitoringCoverageCheck } from './impl/AgentMonitoringCoverageCheck.js';
|
|
96
|
+
import { TrustedUrlHygieneCheck } from './impl/TrustedUrlHygieneCheck.js';
|
|
72
97
|
// Order matters: a check's dependsOnCache must be satisfied by a preceding check's populatesCache.
|
|
73
98
|
// CheckEngine.validateCacheOrdering() enforces this at startup.
|
|
74
99
|
export const CHECKS = [
|
|
@@ -127,7 +152,25 @@ export const CHECKS = [
|
|
|
127
152
|
new EmailSecurityCheck(), // inbound email services + send-as spoofing
|
|
128
153
|
new OutboundMessagesCheck(), // outbound message session-id leak + cleartext endpoints
|
|
129
154
|
new PublicContentExposureCheck(), // externally available Documents + public static resources
|
|
155
|
+
new GuestObjectExposureCheck(), // auto-discovered guest bulk-read surface (UI API) + ownership-defeats-OWD
|
|
156
|
+
new GuestSiteOptionsCheck(), // guest file access + guest member visibility on Experience sites
|
|
157
|
+
new GuestRecordAccessPolicyCheck(), // "Secure guest user record access" enforcement (ownership-defeats-OWD guardrail)
|
|
158
|
+
new ThreatDetectionCheck(), // Guest User Anomaly / Threat Detection event storage enabled
|
|
159
|
+
new LoginAccessPolicyCheck(), // delegated admin + login-as impersonation paths
|
|
160
|
+
new DataExportAccessCheck(), // Weekly Export / API+ViewAll bulk-exfil capability
|
|
161
|
+
new ClassicSitesCheck(), // classic Visualforce Force.com Sites (unauth surface)
|
|
162
|
+
new AuthProvidersCheck(), // external Auth Providers / SAML IdP federation review
|
|
163
|
+
new GuestApiAccessCheck(), // guest users with API Enabled / Bulk API Hard Delete
|
|
164
|
+
new ExternalCredentialsCheck(), // External Credential weak/no authentication
|
|
165
|
+
new LoginAnomalyCheck(), // successful logins from many distinct IPs
|
|
166
|
+
new SessionHardeningCheck(), // reads healthCheckRisks — clickjack/CSRF/session-lock/XSS
|
|
167
|
+
new EncryptionCoverageCheck(), // classified sensitive fields not encrypted at rest
|
|
168
|
+
new ExperienceCspCheck(), // Experience Cloud CSP / Lightning Web Security advisory
|
|
169
|
+
new SandboxDataMaskingCheck(), // sandbox with populated (likely unmasked) PII
|
|
130
170
|
new PrivilegedAccessCheck(), // writes: effectivePermissions; shadow-admin detection
|
|
171
|
+
// AI & Agents block (v1.5) — Agentforce / GenAI. AgentInventoryCheck writes agentInventory,
|
|
172
|
+
// agentUsers, agentAccess; the Phase 2 dependent checks are registered after it.
|
|
173
|
+
new AgentInventoryCheck(), // writes: agentInventory, agentUsers, agentAccess
|
|
131
174
|
// Cache-dependent checks — must come after their producers
|
|
132
175
|
new DeploymentIdentityCheck(), // reads connectedAppNames
|
|
133
176
|
new ApexLoggingCheck(), // reads apexBodies + scheduledApexClassNames
|
|
@@ -137,10 +180,19 @@ export const CHECKS = [
|
|
|
137
180
|
new ApexRestEndpointCheck(), // reads apexBodies
|
|
138
181
|
new VisualforceXssCheck(), // writes vfPageBodies
|
|
139
182
|
new EventMonitoringCheck(), // writes eventLogSummary
|
|
183
|
+
new GuestTrafficAnomalyCheck(), // reads eventLogSummary — anonymizer IPs, bursts, GraphQL recon in guest logs
|
|
140
184
|
new MfaRegistrationCheck(), // writes mfaRegistrations
|
|
141
185
|
new SiemIntegrationCheck(), // reads namedCredentialEndpoints, remoteSiteUrls,
|
|
142
186
|
// connectedAppNames, scheduledApexClassNames, eventLogSummary
|
|
143
187
|
new MfaMethodStrengthCheck(), // reads mfaRegistrations
|
|
144
188
|
new SeparationOfDutiesCheck(), // reads effectivePermissions — toxic permission combinations
|
|
189
|
+
// AI & Agents dependent checks (v1.5) — registered after all their cache producers:
|
|
190
|
+
// AgentInventoryCheck (agentInventory/agentUsers/agentAccess) above, EventMonitoringCheck
|
|
191
|
+
// (eventLogSummary) and CspTrustedSitesCheck (cspTrustedSites) earlier in the list.
|
|
192
|
+
new AgentUserPrivilegeCheck(), // reads agentUsers, agentAccess
|
|
193
|
+
new AgentActionSurfaceCheck(), // reads agentInventory, agentAccess
|
|
194
|
+
new AgentChannelExposureCheck(), // reads agentInventory, agentAccess
|
|
195
|
+
new AgentMonitoringCoverageCheck(), // reads agentInventory, agentAccess, eventLogSummary
|
|
196
|
+
new TrustedUrlHygieneCheck(), // reads cspTrustedSites (runs even without Agentforce)
|
|
145
197
|
];
|
|
146
198
|
//# sourceMappingURL=registry.js.map
|