@cclabsnz/sf-audit 1.2.0 → 1.4.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/LICENSE +201 -0
- package/README.md +135 -31
- 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 +1 -0
- package/lib/api/RestClientImpl.d.ts +1 -0
- package/lib/api/RestClientImpl.js +6 -0
- package/lib/chains/CapabilityRegistry.js +19 -0
- package/lib/chains/namedChains.js +26 -4
- package/lib/checks/eventLogAccess.d.ts +14 -0
- package/lib/checks/eventLogAccess.js +33 -0
- package/lib/checks/impl/AnonymousApexAuditCheck.js +5 -5
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.js +4 -4
- package/lib/checks/impl/ApexLoggingCheck.js +10 -10
- package/lib/checks/impl/ApexRestEndpointCheck.js +5 -5
- package/lib/checks/impl/ApexSharingCheck.js +3 -3
- package/lib/checks/impl/ApiClientPermissionCheck.js +2 -2
- package/lib/checks/impl/AuthProvidersCheck.d.ts +17 -0
- package/lib/checks/impl/AuthProvidersCheck.js +88 -0
- package/lib/checks/impl/CertificateExpiryCheck.js +1 -1
- package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
- package/lib/checks/impl/ClassicSitesCheck.js +65 -0
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppInactivityCheck.js +5 -5
- package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppScopeCheck.js +4 -4
- package/lib/checks/impl/ConnectedAppsCheck.js +2 -2
- package/lib/checks/impl/ContentLinksCheck.js +6 -6
- package/lib/checks/impl/CorsAllowlistCheck.js +3 -3
- package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
- package/lib/checks/impl/CustomLabelsCredentialCheck.js +7 -7
- package/lib/checks/impl/DataClassificationCheck.js +6 -6
- package/lib/checks/impl/DataExportAccessCheck.d.ts +19 -0
- package/lib/checks/impl/DataExportAccessCheck.js +79 -0
- package/lib/checks/impl/DebugLogAccessCheck.js +6 -6
- package/lib/checks/impl/DeploymentIdentityCheck.js +8 -8
- package/lib/checks/impl/EmailSecurityCheck.d.ts +10 -0
- package/lib/checks/impl/EmailSecurityCheck.js +117 -0
- package/lib/checks/impl/EncryptionCoverageCheck.d.ts +19 -0
- package/lib/checks/impl/EncryptionCoverageCheck.js +108 -0
- package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.js +6 -6
- package/lib/checks/impl/EscalationPermsCheck.js +2 -2
- package/lib/checks/impl/EventMonitoringCheck.js +14 -11
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
- 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/FailedLoginCheck.js +5 -5
- package/lib/checks/impl/FieldHistoryTrackingCheck.js +3 -3
- package/lib/checks/impl/FieldLevelSecurityCheck.js +2 -2
- package/lib/checks/impl/GuestApiAccessCheck.d.ts +19 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
- 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/GuestUserAccessCheck.js +5 -5
- package/lib/checks/impl/HealthCheckCheck.js +2 -2
- package/lib/checks/impl/HighAssuranceSessionCheck.js +4 -4
- package/lib/checks/impl/InstalledPackagesCheck.js +5 -5
- package/lib/checks/impl/IntegrationUsersCheck.js +5 -5
- package/lib/checks/impl/InternalUserMfaCheck.js +2 -2
- package/lib/checks/impl/IpRestrictionsCheck.js +3 -3
- package/lib/checks/impl/LegacyApiVersionCheck.js +1 -1
- 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/MfaEnforcementCheck.js +3 -3
- package/lib/checks/impl/MfaMethodStrengthCheck.js +3 -3
- package/lib/checks/impl/MfaRegistrationCheck.js +2 -2
- package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/MyDomainLoginPolicyCheck.js +9 -9
- package/lib/checks/impl/NamedCredentialsCheck.js +3 -3
- package/lib/checks/impl/OutboundMessagesCheck.d.ts +10 -0
- package/lib/checks/impl/OutboundMessagesCheck.js +88 -0
- package/lib/checks/impl/PasswordSessionPolicyCheck.js +3 -3
- package/lib/checks/impl/PermissionsCheck.js +3 -3
- package/lib/checks/impl/PrivilegedAccessCheck.d.ts +11 -0
- package/lib/checks/impl/PrivilegedAccessCheck.js +111 -0
- package/lib/checks/impl/PublicContentExposureCheck.d.ts +10 -0
- package/lib/checks/impl/PublicContentExposureCheck.js +98 -0
- package/lib/checks/impl/PublicGroupSharingCheck.js +1 -1
- package/lib/checks/impl/ReleaseUpdatesCheck.js +2 -2
- package/lib/checks/impl/RemoteSitesCheck.js +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.js +4 -4
- package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +17 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
- package/lib/checks/impl/ScheduledApexCheck.js +1 -1
- package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +11 -0
- package/lib/checks/impl/SeparationOfDutiesCheck.js +114 -0
- package/lib/checks/impl/SessionHardeningCheck.d.ts +21 -0
- package/lib/checks/impl/SessionHardeningCheck.js +134 -0
- package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
- package/lib/checks/impl/SharingModelCheck.js +8 -8
- package/lib/checks/impl/SiemIntegrationCheck.js +4 -4
- package/lib/checks/impl/SsoEnforcementCheck.js +5 -5
- package/lib/checks/impl/StandardProfilesCheck.js +2 -2
- package/lib/checks/impl/ThreatDetectionCheck.d.ts +17 -0
- package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
- package/lib/checks/impl/TransactionSecurityPolicyCheck.js +2 -2
- package/lib/checks/impl/TrustedIPRangesCheck.js +5 -5
- package/lib/checks/impl/VisualforceXssCheck.js +6 -6
- package/lib/checks/permCatalog.d.ts +15 -0
- package/lib/checks/permCatalog.js +42 -0
- package/lib/checks/registry.js +45 -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 +4 -0
- package/lib/commands/audit/security.js +41 -17
- package/lib/compliance/mapping.js +34 -7
- package/lib/context/AuditCache.d.ts +12 -0
- package/lib/context/AuditContext.d.ts +2 -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 +24 -3
- package/lib/lib/wire.d.ts +2 -0
- package/lib/lib/wire.js +3 -0
- package/lib/renderers/ClientReportRenderer.js +4 -4
- package/lib/renderers/DiffHtmlRenderer.js +1 -1
- package/lib/renderers/HistoryRenderer.js +1 -1
- package/lib/renderers/HtmlRenderer.js +3 -3
- package/lib/renderers/MarkdownRenderer.js +2 -2
- package/messages/audit.security.md +30 -2
- package/package.json +14 -2
|
@@ -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
|
|
@@ -4,7 +4,7 @@ export declare class SharingModelCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "sharing-model";
|
|
5
5
|
readonly name = "Org-Wide Defaults (OWD) Sharing Model";
|
|
6
6
|
readonly category = "Data Access Control";
|
|
7
|
-
readonly description = "Checks OWD sharing settings for Account, Contact, Opportunity, Case, and Lead
|
|
7
|
+
readonly description = "Checks OWD sharing settings for Account, Contact, Opportunity, Case, and Lead, covering both internal and external (portal) sharing models";
|
|
8
8
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=SharingModelCheck.d.ts.map
|
|
@@ -5,7 +5,7 @@ export class SharingModelCheck {
|
|
|
5
5
|
id = 'sharing-model';
|
|
6
6
|
name = 'Org-Wide Defaults (OWD) Sharing Model';
|
|
7
7
|
category = 'Data Access Control';
|
|
8
|
-
description = 'Checks OWD sharing settings for Account, Contact, Opportunity, Case, and Lead
|
|
8
|
+
description = 'Checks OWD sharing settings for Account, Contact, Opportunity, Case, and Lead, covering both internal and external (portal) sharing models';
|
|
9
9
|
async run(ctx) {
|
|
10
10
|
const findings = [];
|
|
11
11
|
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
@@ -58,12 +58,12 @@ export class SharingModelCheck {
|
|
|
58
58
|
category: this.category,
|
|
59
59
|
riskLevel: 'CRITICAL',
|
|
60
60
|
title: `${externalWriteObjects.length} object(s) have Public Read/Write OWD for external/portal users`,
|
|
61
|
-
detail: 'An external OWD of Public Read/Write exposes all records to Experience Cloud portal users and guest users. Any low-trust or unauthenticated portal user can read and modify every record. This is a critical data exposure vector frequently overlooked when configuring portal sites
|
|
62
|
-
remediation: 'Set external OWD to Private for all sensitive objects immediately. Grant portal access via sharing sets, sharing rules, or Apex managed sharing
|
|
61
|
+
detail: 'An external OWD of Public Read/Write exposes all records to Experience Cloud portal users and guest users. Any low-trust or unauthenticated portal user can read and modify every record. This is a critical data exposure vector frequently overlooked when configuring portal sites. Attackers who create or compromise a portal account gain unrestricted write access to the entire dataset.',
|
|
62
|
+
remediation: 'Set external OWD to Private for all sensitive objects immediately. Grant portal access via sharing sets, sharing rules, or Apex managed sharing, never via open OWD.',
|
|
63
63
|
affectedItems: externalWriteObjects.map((o) => ({
|
|
64
64
|
label: o.name,
|
|
65
65
|
url: owdUrl,
|
|
66
|
-
note: `External OWD: ${o.model}
|
|
66
|
+
note: `External OWD: ${o.model}, immediate action required`,
|
|
67
67
|
})),
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -74,12 +74,12 @@ export class SharingModelCheck {
|
|
|
74
74
|
category: this.category,
|
|
75
75
|
riskLevel: 'HIGH',
|
|
76
76
|
title: `${externalReadObjects.length} object(s) have Public Read OWD for external/portal users`,
|
|
77
|
-
detail: 'An external OWD of Public Read exposes all records to any Experience Cloud portal user. Attackers who create or compromise a portal account can enumerate the entire dataset for reconnaissance and data theft
|
|
77
|
+
detail: 'An external OWD of Public Read exposes all records to any Experience Cloud portal user. Attackers who create or compromise a portal account can enumerate the entire dataset for reconnaissance and data theft. Even without write access, bulk record exposure violates data minimisation principles and enables targeted attacks.',
|
|
78
78
|
remediation: 'Set external OWD to Private and use sharing sets or sharing rules to grant portal users access only to their own records.',
|
|
79
79
|
affectedItems: externalReadObjects.map((o) => ({
|
|
80
80
|
label: o.name,
|
|
81
81
|
url: owdUrl,
|
|
82
|
-
note: `External OWD: ${o.model}
|
|
82
|
+
note: `External OWD: ${o.model}, portal users can read all records`,
|
|
83
83
|
})),
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -96,7 +96,7 @@ export class SharingModelCheck {
|
|
|
96
96
|
affectedItems: internalWriteObjects.map((o) => ({
|
|
97
97
|
label: o.name,
|
|
98
98
|
url: owdUrl,
|
|
99
|
-
note: `Internal OWD: ${o.model}
|
|
99
|
+
note: `Internal OWD: ${o.model}, change to Private or Public Read Only`,
|
|
100
100
|
})),
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -112,7 +112,7 @@ export class SharingModelCheck {
|
|
|
112
112
|
affectedItems: internalReadObjects.map((o) => ({
|
|
113
113
|
label: o.name,
|
|
114
114
|
url: owdUrl,
|
|
115
|
-
note: `Internal OWD: ${o.model}
|
|
115
|
+
note: `Internal OWD: ${o.model}, all internal users can read all records`,
|
|
116
116
|
})),
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -62,7 +62,7 @@ export class SiemIntegrationCheck {
|
|
|
62
62
|
category: this.category,
|
|
63
63
|
riskLevel: 'LOW',
|
|
64
64
|
passed: true,
|
|
65
|
-
title: `${totalSignals} SIEM/monitoring integration signal(s) detected
|
|
65
|
+
title: `${totalSignals} SIEM/monitoring integration signal(s) detected: SBS-MON-003/004`,
|
|
66
66
|
detail: `SBS-MON-003 requires suspicious login activity to be monitored and alerted on. SBS-MON-004 requires API activity anomalies to be detected. Both controls require integration with an external monitoring system. ${totalSignals} signal(s) suggest external monitoring is in place. Sources: ${signalSummary}.`,
|
|
67
67
|
remediation: 'Verify the integration is actively receiving and alerting on Login, API, and DataExport events. Confirm alert thresholds cover: multiple failed logins, off-hours access, bulk data export, and unusual geographic login patterns (SBS-MON-003). Confirm API anomaly detection is configured (SBS-MON-004).',
|
|
68
68
|
affectedItems: signalSources.map((s) => ({
|
|
@@ -77,7 +77,7 @@ export class SiemIntegrationCheck {
|
|
|
77
77
|
id: 'siem-integration-not-detected',
|
|
78
78
|
category: this.category,
|
|
79
79
|
riskLevel: 'HIGH',
|
|
80
|
-
title: 'No SIEM or external monitoring integration detected
|
|
80
|
+
title: 'No SIEM or external monitoring integration detected: SBS-MON-003/004',
|
|
81
81
|
detail: 'SBS-MON-003 requires suspicious login activity to be monitored and alerted on. SBS-MON-004 requires API activity anomalies to be detected. No signals of an external monitoring or SIEM integration were found across Named Credentials, Remote Sites, Connected Apps, or Scheduled Apex jobs. Without external log forwarding, Event Monitoring data remains unanalysed and no automated alerts can be generated.',
|
|
82
82
|
remediation: 'Integrate Salesforce Event Monitoring with a SIEM platform (Splunk, Datadog, Sumo Logic, Microsoft Sentinel, etc.) using the EventLogFile API or Salesforce Shield Event Streaming. Configure alerts for: repeated failed logins, off-hours API access, bulk data export events, and unusual login geolocations (SBS-MON-003). Enable API usage anomaly detection (SBS-MON-004).',
|
|
83
83
|
});
|
|
@@ -90,8 +90,8 @@ export class SiemIntegrationCheck {
|
|
|
90
90
|
id: 'siem-retention-gap',
|
|
91
91
|
category: this.category,
|
|
92
92
|
riskLevel: 'MEDIUM',
|
|
93
|
-
title: `Event logs cover only ${daysCovered} day(s) in Salesforce
|
|
94
|
-
detail: 'SBS-INT-004 requires 30 days of API event log retention. Without a SIEM or log archival process ingesting logs daily, native Salesforce retention may be insufficient
|
|
93
|
+
title: `Event logs cover only ${daysCovered} day(s) in Salesforce: SIEM ingestion needed for SBS-INT-004 compliance`,
|
|
94
|
+
detail: 'SBS-INT-004 requires 30 days of API event log retention. Without a SIEM or log archival process ingesting logs daily, native Salesforce retention may be insufficient. Logs older than the native retention window will be permanently lost.',
|
|
95
95
|
remediation: `Configure a SIEM or log archival process to ingest EventLogFile records at least daily. This ensures the 30-day retention requirement is met independent of Salesforce's native retention window.`,
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -46,13 +46,13 @@ export class SsoEnforcementCheck {
|
|
|
46
46
|
id: 'sso-password-logins-detected',
|
|
47
47
|
category: this.category,
|
|
48
48
|
riskLevel: 'HIGH',
|
|
49
|
-
title: `${uniqueUsers.length} user(s) logged in with username-password credentials in the last 30 days
|
|
49
|
+
title: `${uniqueUsers.length} user(s) logged in with username-password credentials in the last 30 days: SBS-AUTH-001/002`,
|
|
50
50
|
detail: `SBS-AUTH-001 requires production orgs to enable the org-level setting that disables Salesforce credential logins for all users. SBS-AUTH-002 requires that any users permitted to bypass SSO be explicitly authorised and documented. Found ${records.length} password-based login(s) across ${uniqueUsers.length} unique user(s) in the past 30 days, indicating SSO is either not enforced org-wide or users have undocumented SSO bypass.`,
|
|
51
51
|
remediation: 'Enable "Prevent Login with Salesforce Credentials" in Setup → Single Sign-On Settings (SBS-AUTH-001). For any users who legitimately need credential login (break-glass accounts), document their authorisation in the system of record (SBS-AUTH-002) and restrict their profile IP ranges.',
|
|
52
52
|
affectedItems: uniqueUsers.map(([userId, info]) => ({
|
|
53
53
|
label: info.username,
|
|
54
54
|
url: `${baseUrl}/${userId}`,
|
|
55
|
-
note: `${info.count} credential login(s)
|
|
55
|
+
note: `${info.count} credential login(s), last: ${new Date(info.latest).toISOString().split('T')[0]}`,
|
|
56
56
|
})),
|
|
57
57
|
});
|
|
58
58
|
// Advisory: flag users who appear to be SSO-exempt service accounts
|
|
@@ -62,13 +62,13 @@ export class SsoEnforcementCheck {
|
|
|
62
62
|
id: 'sso-frequent-bypass-users',
|
|
63
63
|
category: this.category,
|
|
64
64
|
riskLevel: 'MEDIUM',
|
|
65
|
-
title: `${highFrequency.length} user(s) logged in with credentials >10 times
|
|
65
|
+
title: `${highFrequency.length} user(s) logged in with credentials >10 times, likely undocumented SSO exemptions (SBS-AUTH-002)`,
|
|
66
66
|
detail: 'SBS-AUTH-002 requires all users permitted to bypass SSO to be explicitly documented. High-frequency credential logins suggest these are regular exemptions rather than emergency break-glass access.',
|
|
67
67
|
remediation: 'Document each user in the system of record with a justified reason for SSO bypass. Consider converting service accounts to Connected App OAuth flows instead.',
|
|
68
68
|
affectedItems: highFrequency.map(([userId, info]) => ({
|
|
69
69
|
label: info.username,
|
|
70
70
|
url: `${baseUrl}/${userId}`,
|
|
71
|
-
note: `${info.count} credential logins in 30 days
|
|
71
|
+
note: `${info.count} credential logins in 30 days, document or remove exemption`,
|
|
72
72
|
})),
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -79,7 +79,7 @@ export class SsoEnforcementCheck {
|
|
|
79
79
|
category: this.category,
|
|
80
80
|
riskLevel: 'INFO',
|
|
81
81
|
inconclusive: true,
|
|
82
|
-
title: 'SSO enforcement status could not be determined
|
|
82
|
+
title: 'SSO enforcement status could not be determined: LoginHistory not accessible',
|
|
83
83
|
detail: 'SBS-AUTH-001/002 require SSO enforcement configuration to be verified. LoginHistory was not accessible with current permissions.',
|
|
84
84
|
remediation: 'Manually verify in Setup → Single Sign-On Settings that "Prevent Login with Salesforce Credentials" is enabled.',
|
|
85
85
|
});
|
|
@@ -54,12 +54,12 @@ export class StandardProfilesCheck {
|
|
|
54
54
|
category: this.category,
|
|
55
55
|
riskLevel: 'HIGH',
|
|
56
56
|
title: `${totalAffected} active user(s) assigned to standard out-of-the-box Salesforce profiles`,
|
|
57
|
-
detail: `SBS-ACS-005 requires all active users be assigned custom profiles
|
|
57
|
+
detail: `SBS-ACS-005 requires all active users be assigned custom profiles: standard profiles must not be used in production. Standard profiles grant broad, poorly-audited permissions and cannot be tailored to least-privilege requirements. Affected profile(s): ${profileSummary}.`,
|
|
58
58
|
remediation: 'Create custom profiles based on minimum required permissions and migrate all active users. Remove access to standard profiles in production. Standard profiles cannot be edited so they often grant more than needed.',
|
|
59
59
|
affectedItems: users.slice(0, 50).map((u) => ({
|
|
60
60
|
label: u.Username,
|
|
61
61
|
url: `${baseUrl}/${u.Id}`,
|
|
62
|
-
note: `Profile: ${u.Profile.Name}
|
|
62
|
+
note: `Profile: ${u.Profile.Name}, migrate to a custom profile`,
|
|
63
63
|
})),
|
|
64
64
|
});
|
|
65
65
|
return { findings };
|
|
@@ -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
|
|
@@ -30,12 +30,12 @@ export class TransactionSecurityPolicyCheck {
|
|
|
30
30
|
riskLevel: 'HIGH',
|
|
31
31
|
title: 'No Transaction Security Policies are enabled',
|
|
32
32
|
detail: 'Transaction Security Policies provide automated, real-time threat detection and response within Salesforce. With no policies enabled, the org has no automated defence against: credential stuffing and brute-force attacks, impossible-travel logins (e.g. login from two countries within minutes), bulk data downloads and mass API queries, concurrent session anomalies, and privilege escalation attempts. An attacker who compromises any credential can operate without triggering any automated response.',
|
|
33
|
-
remediation: 'Enable Transaction Security (Setup → Transaction Security Policies) and create policies for at minimum: (1) Login anomalies
|
|
33
|
+
remediation: 'Enable Transaction Security (Setup → Transaction Security Policies) and create policies for at minimum: (1) Login anomalies: impossible travel, concurrent sessions from different IPs; (2) Data export: block or notify on bulk Report/List View exports; (3) API anomalies: high-volume REST/SOAP queries. Recommended actions: Block + Notify for critical events; Notify for informational events.',
|
|
34
34
|
affectedItems: [
|
|
35
35
|
{
|
|
36
36
|
label: 'Transaction Security Policies',
|
|
37
37
|
url: setupUrl,
|
|
38
|
-
note: 'No policies enabled
|
|
38
|
+
note: 'No policies enabled: real-time threat response is completely absent',
|
|
39
39
|
},
|
|
40
40
|
],
|
|
41
41
|
});
|
|
@@ -40,7 +40,7 @@ export class TrustedIPRangesCheck {
|
|
|
40
40
|
category: this.category,
|
|
41
41
|
riskLevel: 'LOW',
|
|
42
42
|
passed: true,
|
|
43
|
-
title: 'No trusted IP ranges configured
|
|
43
|
+
title: 'No trusted IP ranges configured: MFA applies to all login locations',
|
|
44
44
|
detail: 'No NetworkAccess (trusted IP range) records are configured. All users are subject to MFA and login challenge enforcement regardless of their network location.',
|
|
45
45
|
remediation: 'Continue to avoid configuring trusted IP ranges unless there is a documented, justified business requirement with compensating controls.',
|
|
46
46
|
});
|
|
@@ -60,7 +60,7 @@ export class TrustedIPRangesCheck {
|
|
|
60
60
|
category: this.category,
|
|
61
61
|
riskLevel: 'HIGH',
|
|
62
62
|
title: `${broadRanges.length} trusted IP range(s) cover more than 65,536 hosts (broader than /16)`,
|
|
63
|
-
detail: 'Trusted IP ranges completely bypass Salesforce MFA
|
|
63
|
+
detail: 'Trusted IP ranges completely bypass Salesforce MFA. Any user logging in from a trusted IP is not challenged for a second factor. Ranges broader than /16 cover entire enterprise network blocks or ISP ranges, creating an extremely large MFA bypass surface. If an attacker or insider gains access to any host within that range, they can log in without MFA.',
|
|
64
64
|
remediation: 'Narrow each trusted IP range to the minimum required set of specific host addresses or subnets. Remove overly broad ranges immediately. If broad ranges are required, document the business justification and ensure compensating controls (network-level MFA, VPN enforcement, EDR) are in place.',
|
|
65
65
|
affectedItems: broadRanges.map((r) => {
|
|
66
66
|
let size;
|
|
@@ -73,7 +73,7 @@ export class TrustedIPRangesCheck {
|
|
|
73
73
|
return {
|
|
74
74
|
label: `${r.StartAddress}–${r.EndAddress}`,
|
|
75
75
|
url: setupUrl,
|
|
76
|
-
note: `${r.Description ?? 'no description'}
|
|
76
|
+
note: `${r.Description ?? 'no description'}, ${size} hosts`,
|
|
77
77
|
};
|
|
78
78
|
}),
|
|
79
79
|
});
|
|
@@ -82,7 +82,7 @@ export class TrustedIPRangesCheck {
|
|
|
82
82
|
id: 'trusted-ip-exists',
|
|
83
83
|
category: this.category,
|
|
84
84
|
riskLevel: 'MEDIUM',
|
|
85
|
-
title: `${ranges.length} trusted IP range(s) configured
|
|
85
|
+
title: `${ranges.length} trusted IP range(s) configured: MFA is bypassed for logins from these addresses`,
|
|
86
86
|
detail: 'Trusted IP ranges in Salesforce completely bypass MFA enforcement. Any user authenticating from a listed IP address is not required to provide a second factor. Each range must have documented justification and be reviewed regularly. Without this review, ranges can accumulate and silently expand the MFA bypass surface over time.',
|
|
87
87
|
remediation: 'Review each trusted IP range and confirm it has a documented business justification. Remove any ranges that are no longer required or cannot be justified. Ensure compensating network controls (VPN with MFA, NAC, EDR) protect the trusted network segments.',
|
|
88
88
|
affectedItems: ranges.map((r) => {
|
|
@@ -96,7 +96,7 @@ export class TrustedIPRangesCheck {
|
|
|
96
96
|
return {
|
|
97
97
|
label: `${r.StartAddress}–${r.EndAddress}`,
|
|
98
98
|
url: setupUrl,
|
|
99
|
-
note: `${r.Description ?? 'no description'}
|
|
99
|
+
note: `${r.Description ?? 'no description'}, ${size} hosts`,
|
|
100
100
|
};
|
|
101
101
|
}),
|
|
102
102
|
});
|
|
@@ -37,7 +37,7 @@ export class VisualforceXssCheck {
|
|
|
37
37
|
category: this.category,
|
|
38
38
|
riskLevel: 'INFO',
|
|
39
39
|
inconclusive: true,
|
|
40
|
-
title: 'Visualforce page markup could not be accessed
|
|
40
|
+
title: 'Visualforce page markup could not be accessed: XSS check skipped',
|
|
41
41
|
detail: 'The Tooling API ApexPage query was not accessible. This may indicate the audit user lacks Tooling API access.',
|
|
42
42
|
remediation: 'Grant Tooling API access to the audit user and re-run.',
|
|
43
43
|
});
|
|
@@ -50,7 +50,7 @@ export class VisualforceXssCheck {
|
|
|
50
50
|
category: this.category,
|
|
51
51
|
riskLevel: 'INFO',
|
|
52
52
|
inconclusive: true,
|
|
53
|
-
title: `Visualforce XSS scan incomplete
|
|
53
|
+
title: `Visualforce XSS scan incomplete: only ${pages.length} of ${effectiveTotal} pages scanned (API LIMIT 500)`,
|
|
54
54
|
detail: `This org has ${effectiveTotal} Visualforce pages, but the Tooling API imposes a hard LIMIT of 500 rows per query. The remaining ${effectiveTotal - pages.length} pages were not analysed for XSS patterns. Findings below reflect only the scanned subset and may understate the true exposure.`,
|
|
55
55
|
remediation: 'Use the Salesforce CLI (sf apex list page) or a dedicated SAST tool (PMD, CodeScan) to perform a complete scan of all Visualforce pages outside the 500-row API limit.',
|
|
56
56
|
});
|
|
@@ -91,13 +91,13 @@ export class VisualforceXssCheck {
|
|
|
91
91
|
id: 'visualforce-xss-escape-false',
|
|
92
92
|
category: this.category,
|
|
93
93
|
riskLevel: 'HIGH',
|
|
94
|
-
title: `${escapeFalsePages.length} Visualforce page(s) use escape="false"
|
|
94
|
+
title: `${escapeFalsePages.length} Visualforce page(s) use escape="false": XSS risk`,
|
|
95
95
|
detail: `\`escape="false"\` on \`<apex:outputText>\` or similar components disables Salesforce's automatic HTML encoding. If the rendered value contains user-controlled content, an attacker can inject arbitrary JavaScript into the page, leading to stored or reflected XSS. Salesforce defaults to \`escape="true"\` specifically to prevent this.`,
|
|
96
96
|
remediation: 'Remove `escape="false"` unless the value being rendered is fully trusted (e.g., hardcoded HTML from a developer). For user-controlled content, ensure it is sanitised before storage and rely on the default escaping. Replace with HTMLENCODE() if explicit encoding is needed.',
|
|
97
97
|
affectedItems: escapeFalsePages.map((name) => ({
|
|
98
98
|
label: name,
|
|
99
99
|
url: setupUrl,
|
|
100
|
-
note: 'escape="false" found
|
|
100
|
+
note: 'escape="false" found: review all output components for user-controlled content',
|
|
101
101
|
})),
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -113,7 +113,7 @@ export class VisualforceXssCheck {
|
|
|
113
113
|
affectedItems: jsUncodedPages.map((name) => ({
|
|
114
114
|
label: name,
|
|
115
115
|
url: setupUrl,
|
|
116
|
-
note: '{!var} in <script> block without JSENCODE
|
|
116
|
+
note: '{!var} in <script> block without JSENCODE: wrap with {!JSENCODE(var)}',
|
|
117
117
|
})),
|
|
118
118
|
});
|
|
119
119
|
}
|
|
@@ -129,7 +129,7 @@ export class VisualforceXssCheck {
|
|
|
129
129
|
affectedItems: attrUncodedPages.map((name) => ({
|
|
130
130
|
label: name,
|
|
131
131
|
url: setupUrl,
|
|
132
|
-
note: '{!var} in href/src/action without URLENCODE
|
|
132
|
+
note: '{!var} in href/src/action without URLENCODE: encode or validate',
|
|
133
133
|
})),
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type PermTier = 'CRITICAL' | 'HIGH' | 'MEDIUM';
|
|
2
|
+
export interface DangerousPerm {
|
|
3
|
+
/** Stable short key used in the effective-permission cache and combo rules. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** PermissionSet.Permissions* API field name. */
|
|
6
|
+
field: string;
|
|
7
|
+
/** Human-readable label. */
|
|
8
|
+
label: string;
|
|
9
|
+
tier: PermTier;
|
|
10
|
+
/** One-line abuse rationale. */
|
|
11
|
+
why: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const DANGEROUS_PERMS: DangerousPerm[];
|
|
14
|
+
export declare const PERM_BY_KEY: Record<string, DangerousPerm>;
|
|
15
|
+
//# sourceMappingURL=permCatalog.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Shared vocabulary of high-risk Salesforce user permissions, used by the
|
|
2
|
+
// access-control checks (PrivilegedAccessCheck builds the effective-permission
|
|
3
|
+
// cache from these; SeparationOfDutiesCheck reasons over combinations of them).
|
|
4
|
+
//
|
|
5
|
+
// IMPORTANT: every `field` below is a PermissionSet.Permissions* API name that is
|
|
6
|
+
// already queried elsewhere in this codebase (EscalationPermsCheck, UsersAndAdmins,
|
|
7
|
+
// ApiClientPermission), so it is known-valid. A single invalid field name would
|
|
8
|
+
// make the whole PermissionSetAssignment query fail with INVALID_FIELD.
|
|
9
|
+
export const DANGEROUS_PERMS = [
|
|
10
|
+
{ key: 'ModifyAllData', field: 'PermissionsModifyAllData', label: 'Modify All Data', tier: 'CRITICAL',
|
|
11
|
+
why: 'Read, edit, and delete every record in the org, bypassing sharing.' },
|
|
12
|
+
{ key: 'ManageUsers', field: 'PermissionsManageUsers', label: 'Manage Users', tier: 'CRITICAL',
|
|
13
|
+
why: 'Create users and reset passwords: a direct account-takeover lever.' },
|
|
14
|
+
{ key: 'ViewAllData', field: 'PermissionsViewAllData', label: 'View All Data', tier: 'HIGH',
|
|
15
|
+
why: 'Read every record in the org, bypassing sharing: mass data exposure.' },
|
|
16
|
+
{ key: 'AuthorApex', field: 'PermissionsAuthorApex', label: 'Author Apex', tier: 'HIGH',
|
|
17
|
+
why: 'Deploy and run arbitrary Apex, which executes without sharing by default.' },
|
|
18
|
+
{ key: 'CustomizeApplication', field: 'PermissionsCustomizeApplication', label: 'Customize Application', tier: 'HIGH',
|
|
19
|
+
why: 'Change org metadata and configuration, including security settings.' },
|
|
20
|
+
{ key: 'ModifyMetadata', field: 'PermissionsModifyMetadata', label: 'Modify Metadata', tier: 'HIGH',
|
|
21
|
+
why: 'Change metadata via the API, enabling stealthy configuration tampering.' },
|
|
22
|
+
{ key: 'ManageInternalUsers', field: 'PermissionsManageInternalUsers', label: 'Manage Internal Users', tier: 'HIGH',
|
|
23
|
+
why: 'Administer internal user accounts, including password resets.' },
|
|
24
|
+
{ key: 'AssignPermissionSets', field: 'PermissionsAssignPermissionSets', label: 'Assign Permission Sets', tier: 'HIGH',
|
|
25
|
+
why: 'Grant permission sets: can be used to self-escalate to any access.' },
|
|
26
|
+
{ key: 'ManageAuthProviders', field: 'PermissionsManageAuthProviders', label: 'Manage Auth. Providers', tier: 'HIGH',
|
|
27
|
+
why: 'Control SSO / auth providers, enabling identity-provider takeover.' },
|
|
28
|
+
{ key: 'ManageConnectedApps', field: 'PermissionsManageConnectedApps', label: 'Manage Connected Apps', tier: 'HIGH',
|
|
29
|
+
why: 'Control OAuth connected apps, a persistent external-access channel.' },
|
|
30
|
+
{ key: 'UseAnyApiClient', field: 'PermissionsUseAnyApiClient', label: 'Use Any API Client', tier: 'HIGH',
|
|
31
|
+
why: 'Bypass API Access Control to reach the org from any tool.' },
|
|
32
|
+
{ key: 'ManageEventLogFiles', field: 'PermissionsManageEventLogFiles', label: 'Manage Event Log Files', tier: 'MEDIUM',
|
|
33
|
+
why: 'Access detailed monitoring/event data across the org.' },
|
|
34
|
+
{ key: 'ManageSession', field: 'PermissionsManageSession', label: 'Manage Session Permission Set Activations', tier: 'MEDIUM',
|
|
35
|
+
why: 'Activate session-based permission sets, elevating access on demand.' },
|
|
36
|
+
{ key: 'ViewAllUsers', field: 'PermissionsViewAllUsers', label: 'View All Users', tier: 'MEDIUM',
|
|
37
|
+
why: 'Enumerate every user in the org: reconnaissance for targeting.' },
|
|
38
|
+
{ key: 'PasswordNeverExpires', field: 'PermissionsPasswordNeverExpires', label: 'Password Never Expires', tier: 'MEDIUM',
|
|
39
|
+
why: 'Exempt the account from password rotation, weakening credential hygiene.' },
|
|
40
|
+
];
|
|
41
|
+
export const PERM_BY_KEY = Object.fromEntries(DANGEROUS_PERMS.map((p) => [p.key, p]));
|
|
42
|
+
//# sourceMappingURL=permCatalog.js.map
|