@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
|
@@ -72,7 +72,7 @@ export class IpRestrictionsCheck {
|
|
|
72
72
|
affectedItems: unrestrictedAdmins.map((u) => ({
|
|
73
73
|
label: u.Username,
|
|
74
74
|
url: `${baseUrl}/${u.Id}`,
|
|
75
|
-
note: `Profile: ${u.Profile.Name}
|
|
75
|
+
note: `Profile: ${u.Profile.Name}: add IP ranges in Setup → Profiles → Login IP Ranges`,
|
|
76
76
|
})),
|
|
77
77
|
detail: 'Administrator accounts without IP login restrictions can be accessed from any network, increasing exposure to credential-stuffing attacks.',
|
|
78
78
|
remediation: 'Add IP login ranges to all admin profiles in Setup → Profiles → Login IP Ranges, or enable MFA as a compensating control.',
|
|
@@ -87,7 +87,7 @@ export class IpRestrictionsCheck {
|
|
|
87
87
|
affectedItems: ipBypassingApps.map((app) => ({
|
|
88
88
|
label: app.name,
|
|
89
89
|
url: `${baseUrl}/lightning/setup/ConnectedApplication/page`,
|
|
90
|
-
note: 'IP Relaxation = All
|
|
90
|
+
note: 'IP Relaxation = All: change to "Enforce IP Restrictions" or "Relax IP Restrictions" to reinstate controls',
|
|
91
91
|
})),
|
|
92
92
|
detail: `Connected apps configured with IP Relaxation set to "All" allow API access from any IP address for any user, completely overriding profile-level IP restrictions. An attacker with a stolen OAuth token or credential can authenticate from anywhere regardless of org-level IP policies.`,
|
|
93
93
|
remediation: 'Set IP Relaxation to "Enforce IP Restrictions" (WhiteList) for all connected apps unless there is a documented, audited business requirement for remote access. Review each app and confirm the relaxation setting is intentional.',
|
|
@@ -102,7 +102,7 @@ export class IpRestrictionsCheck {
|
|
|
102
102
|
affectedItems: ipRelaxingApps.map((app) => ({
|
|
103
103
|
label: app.name,
|
|
104
104
|
url: `${baseUrl}/lightning/setup/ConnectedApplication/page`,
|
|
105
|
-
note: 'IP Relaxation = Relax
|
|
105
|
+
note: 'IP Relaxation = Relax: confirm documented justification exists',
|
|
106
106
|
})),
|
|
107
107
|
detail: `Connected apps configured with IP Relaxation set to "Relax" allow the app's users to access the org from outside the IP ranges defined on their profile when using this app. This weakens the IP restriction control for API access.`,
|
|
108
108
|
remediation: 'Set IP Relaxation to "Enforce IP Restrictions" unless the integration genuinely requires access from IP addresses outside the corporate network. Document any justified relaxations in the system of record.',
|
|
@@ -82,7 +82,7 @@ export class LegacyApiVersionCheck {
|
|
|
82
82
|
category: this.category,
|
|
83
83
|
riskLevel: 'INFO',
|
|
84
84
|
title: 'Inbound SOAP API usage: manual review required via Event Monitoring',
|
|
85
|
-
detail: 'Salesforce does not expose inbound SOAP API call details in SOQL-queryable objects
|
|
85
|
+
detail: 'Salesforce does not expose inbound SOAP API call details in SOQL-queryable objects. They are captured only in EventLogFile with EventType = "API". The API_TYPE column in those log files distinguishes SOAP callers: "E" = Enterprise WSDL, "P" = Partner WSDL. LoginHistory cannot make this distinction; SOAP login() calls and UI logins both appear as LoginType = "Application". If external systems are calling this org via the Enterprise or Partner WSDL, those callers should be migrated to REST API or connected-app-governed OAuth flows.',
|
|
86
86
|
remediation: 'In Setup → Event Monitoring, download an API event log and filter on API_TYPE = "E" or "P" to identify active SOAP callers. For each SOAP caller, work with the integration owner to migrate to REST API using a connected app with appropriate OAuth scopes and IP restrictions.',
|
|
87
87
|
});
|
|
88
88
|
return { findings };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Surfaces impersonation / delegated-administration paths that bypass a user's
|
|
5
|
+
* own credentials:
|
|
6
|
+
* - Delegated Administration groups (`DelegateGroup`): members can manage users
|
|
7
|
+
* and assign permissions within a scope — a lateral-movement / priv-esc path
|
|
8
|
+
* that admin-focused monitoring often misses.
|
|
9
|
+
* - "Administrators Can Log In as Any User" (org Login Access Policy): when on,
|
|
10
|
+
* any admin can impersonate any user and read all their data with no consent.
|
|
11
|
+
* This toggle is not cleanly API-exposed, so it is raised as an advisory.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LoginAccessPolicyCheck implements SecurityCheck {
|
|
14
|
+
readonly id = "login-access-policy";
|
|
15
|
+
readonly name = "Login-As & Delegated Administration";
|
|
16
|
+
readonly category = "Access Control";
|
|
17
|
+
readonly description = "Flags delegated-administration groups and the org login-as policy, which allow user impersonation and scoped admin escalation that bypass normal credentials";
|
|
18
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
19
|
+
/**
|
|
20
|
+
* "Administrators Can Log In as Any User". Read authoritatively from
|
|
21
|
+
* SecuritySettings metadata when a Metadata client is available; otherwise fall
|
|
22
|
+
* back to a manual-verification advisory.
|
|
23
|
+
*/
|
|
24
|
+
private addLoginAsPolicyFinding;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=LoginAccessPolicyCheck.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surfaces impersonation / delegated-administration paths that bypass a user's
|
|
3
|
+
* own credentials:
|
|
4
|
+
* - Delegated Administration groups (`DelegateGroup`): members can manage users
|
|
5
|
+
* and assign permissions within a scope — a lateral-movement / priv-esc path
|
|
6
|
+
* that admin-focused monitoring often misses.
|
|
7
|
+
* - "Administrators Can Log In as Any User" (org Login Access Policy): when on,
|
|
8
|
+
* any admin can impersonate any user and read all their data with no consent.
|
|
9
|
+
* This toggle is not cleanly API-exposed, so it is raised as an advisory.
|
|
10
|
+
*/
|
|
11
|
+
export class LoginAccessPolicyCheck {
|
|
12
|
+
id = 'login-access-policy';
|
|
13
|
+
name = 'Login-As & Delegated Administration';
|
|
14
|
+
category = 'Access Control';
|
|
15
|
+
description = 'Flags delegated-administration groups and the org login-as policy, which allow user impersonation and scoped admin escalation that bypass normal credentials';
|
|
16
|
+
async run(ctx) {
|
|
17
|
+
const findings = [];
|
|
18
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
19
|
+
let groups;
|
|
20
|
+
try {
|
|
21
|
+
groups = await ctx.soql.queryAll('SELECT Id, DeveloperName FROM DelegateGroup');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
findings.push({
|
|
25
|
+
id: 'login-access-policy-inconclusive',
|
|
26
|
+
category: this.category,
|
|
27
|
+
riskLevel: 'INFO',
|
|
28
|
+
inconclusive: true,
|
|
29
|
+
title: 'Delegated administration could not be queried (insufficient access)',
|
|
30
|
+
detail: 'DelegateGroup was not accessible, so delegated-admin escalation paths could not be evaluated.',
|
|
31
|
+
remediation: 'Grant the audit user View Setup and Configuration, then re-run. Also manually verify Setup → Login Access Policies.',
|
|
32
|
+
});
|
|
33
|
+
return { findings };
|
|
34
|
+
}
|
|
35
|
+
if (groups.length > 0) {
|
|
36
|
+
findings.push({
|
|
37
|
+
id: 'login-access-policy-delegated-admins',
|
|
38
|
+
category: this.category,
|
|
39
|
+
riskLevel: 'MEDIUM',
|
|
40
|
+
title: `${groups.length} delegated administration group(s) configured`,
|
|
41
|
+
detail: 'Delegated administration groups let non-system-administrators manage users, reset passwords, and assign permission sets within a scope. Membership and the assignable permission sets are a privilege-escalation and lateral-movement path that is easy to overlook because these users are not full admins.',
|
|
42
|
+
remediation: 'Review each delegated group in Setup → Delegated Administration: confirm the delegated users are trusted, the manageable roles/objects are minimal, and the assignable permission sets do not include privileged permissions. Remove unused groups.',
|
|
43
|
+
affectedItems: groups.slice(0, 30).map((g) => ({
|
|
44
|
+
label: g.DeveloperName,
|
|
45
|
+
url: `${baseUrl}/lightning/setup/DelegateGroups/home`,
|
|
46
|
+
})),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
findings.push({
|
|
51
|
+
id: 'login-access-policy-ok',
|
|
52
|
+
category: this.category,
|
|
53
|
+
riskLevel: 'LOW',
|
|
54
|
+
passed: true,
|
|
55
|
+
title: 'No delegated administration groups configured',
|
|
56
|
+
detail: 'No DelegateGroup records exist, so there is no delegated-admin escalation surface.',
|
|
57
|
+
remediation: 'If delegated administration is introduced, scope each group minimally and review assignable permission sets.',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
await this.addLoginAsPolicyFinding(ctx, findings);
|
|
61
|
+
return { findings };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* "Administrators Can Log In as Any User". Read authoritatively from
|
|
65
|
+
* SecuritySettings metadata when a Metadata client is available; otherwise fall
|
|
66
|
+
* back to a manual-verification advisory.
|
|
67
|
+
*/
|
|
68
|
+
async addLoginAsPolicyFinding(ctx, findings) {
|
|
69
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
70
|
+
const setupUrl = `${baseUrl}/lightning/setup/LoginAccessPolicies/home`;
|
|
71
|
+
if (ctx.metadata) {
|
|
72
|
+
let ss = null;
|
|
73
|
+
try {
|
|
74
|
+
ss = await ctx.metadata.read('SecuritySettings', 'Security');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
ss = null;
|
|
78
|
+
}
|
|
79
|
+
if (ss && typeof ss.enableAdminLoginAsAnyUser === 'boolean') {
|
|
80
|
+
if (ss.enableAdminLoginAsAnyUser) {
|
|
81
|
+
findings.push({
|
|
82
|
+
id: 'login-access-policy-login-as-enabled',
|
|
83
|
+
category: this.category,
|
|
84
|
+
riskLevel: 'HIGH',
|
|
85
|
+
title: '"Administrators Can Log In as Any User" is ENABLED',
|
|
86
|
+
detail: 'The org policy "Administrators Can Log In as Any User" is enabled (confirmed from SecuritySettings). Any administrator can impersonate any user — including reading all of their records — with no per-session consent from that user, and the impersonation is easy to miss in monitoring.',
|
|
87
|
+
remediation: 'Disable "Administrators Can Log In as Any User" in Setup → Login Access Policies unless there is a documented support requirement. Require users to grant time-boxed login access instead, and alert on LoginAs events via Event Monitoring.',
|
|
88
|
+
affectedItems: [{ label: 'Login Access Policies', url: setupUrl }],
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
findings.push({
|
|
93
|
+
id: 'login-access-policy-login-as-disabled',
|
|
94
|
+
category: this.category,
|
|
95
|
+
riskLevel: 'LOW',
|
|
96
|
+
passed: true,
|
|
97
|
+
title: '"Administrators Can Log In as Any User" is disabled',
|
|
98
|
+
detail: 'SecuritySettings confirms administrators cannot log in as arbitrary users without their consent.',
|
|
99
|
+
remediation: 'Keep this disabled; grant login access per-user and time-boxed when support needs it.',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// No Metadata client, or the field was not present — advisory fallback.
|
|
106
|
+
findings.push({
|
|
107
|
+
id: 'login-access-policy-login-as-advisory',
|
|
108
|
+
category: this.category,
|
|
109
|
+
riskLevel: 'INFO',
|
|
110
|
+
title: 'Verify the "Administrators Can Log In as Any User" policy manually',
|
|
111
|
+
detail: 'When "Administrators Can Log In as Any User" is enabled (Setup → Login Access Policies), any administrator can impersonate any user and access all of their data with no per-session consent. This run could not read SecuritySettings, so the policy must be confirmed manually.',
|
|
112
|
+
remediation: 'In Setup → Login Access Policies, disable "Administrators Can Log In as Any User" unless there is a documented support need, and require users to grant time-boxed login access instead.',
|
|
113
|
+
affectedItems: [{ label: 'Login Access Policies', url: setupUrl }],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=LoginAccessPolicyCheck.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Complements `failed-login-detection` (which only sees failures) by looking at
|
|
5
|
+
* SUCCESSFUL logins for a compromise signature: one user authenticating from an
|
|
6
|
+
* unusually large number of distinct source IPs in a short window — the footprint
|
|
7
|
+
* of credential sharing, a leaked token replayed from many egress nodes, or an
|
|
8
|
+
* account being driven from attacker infrastructure.
|
|
9
|
+
*/
|
|
10
|
+
export declare class LoginAnomalyCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "login-anomaly";
|
|
12
|
+
readonly name = "Anomalous Successful Logins";
|
|
13
|
+
readonly category = "Threat Detection";
|
|
14
|
+
readonly description = "Flags user accounts with successful logins from an unusually high number of distinct source IPs (credential-sharing / account-compromise signature)";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=LoginAnomalyCheck.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// A single account authenticating successfully from this many distinct source IPs
|
|
2
|
+
// in the window is a proxy for credential sharing or account compromise (a real
|
|
3
|
+
// person logs in from a small, stable set of networks).
|
|
4
|
+
const DISTINCT_IP_THRESHOLD = 8;
|
|
5
|
+
const MAX_ROWS = 20000;
|
|
6
|
+
/**
|
|
7
|
+
* Complements `failed-login-detection` (which only sees failures) by looking at
|
|
8
|
+
* SUCCESSFUL logins for a compromise signature: one user authenticating from an
|
|
9
|
+
* unusually large number of distinct source IPs in a short window — the footprint
|
|
10
|
+
* of credential sharing, a leaked token replayed from many egress nodes, or an
|
|
11
|
+
* account being driven from attacker infrastructure.
|
|
12
|
+
*/
|
|
13
|
+
export class LoginAnomalyCheck {
|
|
14
|
+
id = 'login-anomaly';
|
|
15
|
+
name = 'Anomalous Successful Logins';
|
|
16
|
+
category = 'Threat Detection';
|
|
17
|
+
description = 'Flags user accounts with successful logins from an unusually high number of distinct source IPs (credential-sharing / account-compromise signature)';
|
|
18
|
+
async run(ctx) {
|
|
19
|
+
const findings = [];
|
|
20
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/OrgLoginHistory/home`;
|
|
21
|
+
let rows;
|
|
22
|
+
try {
|
|
23
|
+
rows = await ctx.soql.queryAll(`SELECT UserId, SourceIp, LoginTime FROM LoginHistory
|
|
24
|
+
WHERE Status = 'Success' AND LoginTime = LAST_N_DAYS:7
|
|
25
|
+
ORDER BY LoginTime DESC LIMIT ${MAX_ROWS}`);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
findings.push({
|
|
29
|
+
id: 'login-anomaly-inconclusive',
|
|
30
|
+
category: this.category,
|
|
31
|
+
riskLevel: 'INFO',
|
|
32
|
+
inconclusive: true,
|
|
33
|
+
title: 'LoginHistory could not be queried — anomalous-login analysis skipped',
|
|
34
|
+
detail: 'LoginHistory was not accessible. This may indicate the audit user lacks "View All Users"/"Manage Users" or the org restricts login history.',
|
|
35
|
+
remediation: 'Grant the audit user access to LoginHistory and re-run.',
|
|
36
|
+
});
|
|
37
|
+
return { findings };
|
|
38
|
+
}
|
|
39
|
+
if (rows.length === 0) {
|
|
40
|
+
findings.push({
|
|
41
|
+
id: 'login-anomaly-none',
|
|
42
|
+
category: this.category,
|
|
43
|
+
riskLevel: 'LOW',
|
|
44
|
+
passed: true,
|
|
45
|
+
title: 'No successful logins in the last 7 days',
|
|
46
|
+
detail: 'LoginHistory returned no successful logins in the window, so no login-distribution anomaly could be computed.',
|
|
47
|
+
remediation: 'Re-run after normal activity; forward LoginHistory to a SIEM for continuous anomaly detection.',
|
|
48
|
+
});
|
|
49
|
+
return { findings };
|
|
50
|
+
}
|
|
51
|
+
const ipsByUser = new Map();
|
|
52
|
+
for (const r of rows) {
|
|
53
|
+
if (!r.SourceIp)
|
|
54
|
+
continue;
|
|
55
|
+
const set = ipsByUser.get(r.UserId) ?? new Set();
|
|
56
|
+
set.add(r.SourceIp);
|
|
57
|
+
ipsByUser.set(r.UserId, set);
|
|
58
|
+
}
|
|
59
|
+
const anomalous = [...ipsByUser.entries()].filter(([, ips]) => ips.size >= DISTINCT_IP_THRESHOLD);
|
|
60
|
+
if (rows.length >= MAX_ROWS) {
|
|
61
|
+
findings.push({
|
|
62
|
+
id: 'login-anomaly-truncated',
|
|
63
|
+
category: this.category,
|
|
64
|
+
riskLevel: 'INFO',
|
|
65
|
+
title: `Login history truncated at ${MAX_ROWS} rows — analysis is partial`,
|
|
66
|
+
detail: `The last-7-day successful-login volume exceeded ${MAX_ROWS} rows, so this analysis covers only the most recent window. Some per-user IP spread may be undercounted.`,
|
|
67
|
+
remediation: 'Forward LoginHistory to a SIEM for complete, continuous analysis rather than point-in-time sampling.',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (anomalous.length > 0) {
|
|
71
|
+
findings.push({
|
|
72
|
+
id: 'login-anomaly-multi-ip',
|
|
73
|
+
category: this.category,
|
|
74
|
+
riskLevel: 'MEDIUM',
|
|
75
|
+
title: `${anomalous.length} account(s) logged in from ${DISTINCT_IP_THRESHOLD}+ distinct source IPs in 7 days`,
|
|
76
|
+
detail: 'These accounts authenticated successfully from an unusually large number of distinct source IPs in a week. That pattern is consistent with credential sharing, a leaked session/token being replayed from many egress nodes, or an account driven from distributed attacker infrastructure.',
|
|
77
|
+
remediation: 'Investigate these accounts: confirm the logins are legitimate, reset credentials and revoke sessions if not, and enforce MFA + login IP ranges. Consider a Transaction Security Policy that alerts on logins from new geographies/IPs.',
|
|
78
|
+
affectedItems: anomalous
|
|
79
|
+
.sort((a, b) => b[1].size - a[1].size)
|
|
80
|
+
.slice(0, 30)
|
|
81
|
+
.map(([userId, ips]) => ({ label: `${userId} — ${ips.size} distinct IPs`, url: setupUrl })),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
findings.push({
|
|
86
|
+
id: 'login-anomaly-ok',
|
|
87
|
+
category: this.category,
|
|
88
|
+
riskLevel: 'LOW',
|
|
89
|
+
passed: true,
|
|
90
|
+
title: 'No accounts with an anomalous login-IP spread',
|
|
91
|
+
detail: `Across ${rows.length} successful login(s) in 7 days, no account authenticated from ${DISTINCT_IP_THRESHOLD}+ distinct source IPs.`,
|
|
92
|
+
remediation: 'Continue forwarding LoginHistory to a SIEM for continuous anomaly detection.',
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { findings };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=LoginAnomalyCheck.js.map
|
|
@@ -23,7 +23,7 @@ export class MfaEnforcementCheck {
|
|
|
23
23
|
category: this.category,
|
|
24
24
|
riskLevel: 'LOW',
|
|
25
25
|
passed: true,
|
|
26
|
-
title: 'No active external/portal users found
|
|
26
|
+
title: 'No active external/portal users found: SBS-AUTH-004 not applicable',
|
|
27
27
|
detail: 'SBS-AUTH-004 applies to external users with substantial access to sensitive data. No active portal user types were found in this org.',
|
|
28
28
|
remediation: 'If Experience Cloud sites are added in future, ensure SBS-AUTH-004 MFA requirements are met for external users.',
|
|
29
29
|
});
|
|
@@ -61,13 +61,13 @@ export class MfaEnforcementCheck {
|
|
|
61
61
|
id: 'mfa-portal-users-without-enforcement',
|
|
62
62
|
category: this.category,
|
|
63
63
|
riskLevel,
|
|
64
|
-
title: `${withoutMfa.length} of ${allPortalUsers.length} external/portal user(s) do not have MFA enforced
|
|
64
|
+
title: `${withoutMfa.length} of ${allPortalUsers.length} external/portal user(s) do not have MFA enforced: SBS-AUTH-004`,
|
|
65
65
|
detail: `SBS-AUTH-004 requires all external human users with substantial access to sensitive data to enforce MFA including at least one strong authentication factor. ${withoutMfa.length} active portal user(s) lack the "Multi-Factor Authentication for User Interface Logins" permission. ${withMfa.length > 0 ? `${withMfa.length} user(s) already have MFA enforced.` : ''}`,
|
|
66
66
|
remediation: 'Assign the "Multi-Factor Authentication for User Interface Logins" permission to all Experience Cloud users with access to sensitive data. Create a permission set for this purpose and assign it to all in-scope portal profiles.',
|
|
67
67
|
affectedItems: withoutMfa.slice(0, 50).map((u) => ({
|
|
68
68
|
label: u.Username,
|
|
69
69
|
url: `${baseUrl}/${u.Id}`,
|
|
70
|
-
note: `UserType: ${u.UserType} | Profile: ${u.Profile.Name}
|
|
70
|
+
note: `UserType: ${u.UserType} | Profile: ${u.Profile.Name} | assign MFA permission set`,
|
|
71
71
|
})),
|
|
72
72
|
});
|
|
73
73
|
return { findings };
|
|
@@ -31,7 +31,7 @@ export class MfaMethodStrengthCheck {
|
|
|
31
31
|
category: this.category,
|
|
32
32
|
riskLevel: 'INFO',
|
|
33
33
|
inconclusive: true,
|
|
34
|
-
title: 'No MFA registration data available
|
|
34
|
+
title: 'No MFA registration data available: MfaRegistrationCheck must run first',
|
|
35
35
|
detail: 'The mfaRegistrations cache is empty. Either MfaRegistrationCheck did not run, or TwoFactorInfo was not accessible. MFA method strength analysis cannot be performed without this data.',
|
|
36
36
|
remediation: 'Ensure MfaRegistrationCheck runs before this check. Grant "Manage Multi-Factor Authentication in API" permission to the audit user.',
|
|
37
37
|
});
|
|
@@ -79,7 +79,7 @@ export class MfaMethodStrengthCheck {
|
|
|
79
79
|
affectedItems: adminWeakUsers.map((u) => ({
|
|
80
80
|
label: u.username,
|
|
81
81
|
url: setupUrl,
|
|
82
|
-
note: `profile: ${u.profileName}
|
|
82
|
+
note: `profile: ${u.profileName} | methods: ${u.methods.join(', ') || 'none'}`,
|
|
83
83
|
})),
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -94,7 +94,7 @@ export class MfaMethodStrengthCheck {
|
|
|
94
94
|
affectedItems: nonAdminWeakUsers.slice(0, 30).map((u) => ({
|
|
95
95
|
label: u.username,
|
|
96
96
|
url: setupUrl,
|
|
97
|
-
note: `profile: ${u.profileName}
|
|
97
|
+
note: `profile: ${u.profileName} | methods: ${u.methods.join(', ') || 'none'}`,
|
|
98
98
|
})),
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -32,7 +32,7 @@ export class MfaRegistrationCheck {
|
|
|
32
32
|
category: this.category,
|
|
33
33
|
riskLevel: 'INFO',
|
|
34
34
|
inconclusive: true,
|
|
35
|
-
title: 'TwoFactorInfo could not be queried
|
|
35
|
+
title: 'TwoFactorInfo could not be queried: MFA registration status cannot be verified',
|
|
36
36
|
detail: 'The TwoFactorInfo object was not accessible. This may indicate the audit user lacks the "Manage Multi-Factor Authentication in API" permission or the org edition does not support this query.',
|
|
37
37
|
remediation: 'Grant "Manage Multi-Factor Authentication in API" permission to the audit user. Review MFA registration status manually in Setup → Identity → Identity Verification.',
|
|
38
38
|
affectedItems: [{ label: 'Identity Verification Setup', url: setupUrl }],
|
|
@@ -85,7 +85,7 @@ export class MfaRegistrationCheck {
|
|
|
85
85
|
{
|
|
86
86
|
label: `${unregisteredCount} unregistered user(s)`,
|
|
87
87
|
url: setupUrl,
|
|
88
|
-
note: `${totalActiveUsers} total active users
|
|
88
|
+
note: `${totalActiveUsers} total active users (${registeredCount} registered, ${unregisteredCount} unregistered)`,
|
|
89
89
|
},
|
|
90
90
|
],
|
|
91
91
|
});
|
|
@@ -4,7 +4,7 @@ export declare class MyDomainLoginPolicyCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "my-domain-login-policy";
|
|
5
5
|
readonly name = "My Domain Login Policy";
|
|
6
6
|
readonly category = "Authentication";
|
|
7
|
-
readonly description = "Checks that My Domain is configured and login from login.salesforce.com is prevented
|
|
7
|
+
readonly description = "Checks that My Domain is configured and login from login.salesforce.com is prevented: stops SSO bypass";
|
|
8
8
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=MyDomainLoginPolicyCheck.d.ts.map
|
|
@@ -2,7 +2,7 @@ export class MyDomainLoginPolicyCheck {
|
|
|
2
2
|
id = 'my-domain-login-policy';
|
|
3
3
|
name = 'My Domain Login Policy';
|
|
4
4
|
category = 'Authentication';
|
|
5
|
-
description = 'Checks that My Domain is configured and login from login.salesforce.com is prevented
|
|
5
|
+
description = 'Checks that My Domain is configured and login from login.salesforce.com is prevented: stops SSO bypass';
|
|
6
6
|
async run(ctx) {
|
|
7
7
|
const findings = [];
|
|
8
8
|
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
@@ -21,7 +21,7 @@ export class MyDomainLoginPolicyCheck {
|
|
|
21
21
|
title: 'My Domain is not configured',
|
|
22
22
|
detail: `My Domain is required to enforce SSO and to control the login experience. Without My Domain, users can authenticate directly via \`login.salesforce.com\` bypassing any identity provider restrictions. My Domain is also a prerequisite for Lightning Experience, SSO, and Enhanced Domains.`,
|
|
23
23
|
remediation: 'Configure My Domain in Setup → My Domain. After deployment, set the login policy to "Prevent login from login.salesforce.com" to ensure all logins go through your identity provider.',
|
|
24
|
-
affectedItems: [{ label: 'My Domain Setup', url: domainSetupUrl, note: 'My Domain not configured
|
|
24
|
+
affectedItems: [{ label: 'My Domain Setup', url: domainSetupUrl, note: 'My Domain not configured: required for SSO enforcement' }],
|
|
25
25
|
});
|
|
26
26
|
return { findings };
|
|
27
27
|
}
|
|
@@ -45,7 +45,7 @@ export class MyDomainLoginPolicyCheck {
|
|
|
45
45
|
id: 'my-domain-auth-config-empty',
|
|
46
46
|
category: this.category,
|
|
47
47
|
riskLevel: 'MEDIUM',
|
|
48
|
-
title: 'No active AuthConfig found
|
|
48
|
+
title: 'No active AuthConfig found: My Domain login policy unverified',
|
|
49
49
|
detail: 'The My Domain login policy (which controls whether users can log in with Salesforce credentials or must use SSO) could not be read from AuthConfig. The login policy may allow credential-based login even when SSO is configured.',
|
|
50
50
|
remediation: 'Manually verify in Setup → My Domain → Authentication Configuration that "Prevent Login from login.salesforce.com" is enabled.',
|
|
51
51
|
affectedItems: [{ label: myDomain, url: domainSetupUrl, note: 'Verify authentication configuration manually' }],
|
|
@@ -60,13 +60,13 @@ export class MyDomainLoginPolicyCheck {
|
|
|
60
60
|
id: 'my-domain-password-login-allowed',
|
|
61
61
|
category: this.category,
|
|
62
62
|
riskLevel: 'HIGH',
|
|
63
|
-
title: 'My Domain allows username-password login
|
|
63
|
+
title: 'My Domain allows username-password login: SSO not enforced',
|
|
64
64
|
detail: `The AuthConfig for this org allows users to log in with Salesforce username and password, meaning SSO via your identity provider is not the only authentication path. Users can bypass SSO (and its MFA, conditional access, and session controls) by using direct credentials. Affected authentication configuration(s): ${passwordAllowed.map((c) => c.DeveloperName).join(', ')}.`,
|
|
65
65
|
remediation: 'In Setup → My Domain → Authentication Configuration, disable "Login Page" (Salesforce credentials) as an authentication option. Ensure SAML/SSO is the only allowed method. Also enable "Prevent Login from login.salesforce.com" in My Domain settings.',
|
|
66
66
|
affectedItems: passwordAllowed.map((c) => ({
|
|
67
67
|
label: c.DeveloperName,
|
|
68
68
|
url: domainSetupUrl,
|
|
69
|
-
note: 'AuthOptionsUsernamePassword = true
|
|
69
|
+
note: 'AuthOptionsUsernamePassword = true: disable password login to enforce SSO',
|
|
70
70
|
})),
|
|
71
71
|
});
|
|
72
72
|
}
|
|
@@ -76,13 +76,13 @@ export class MyDomainLoginPolicyCheck {
|
|
|
76
76
|
category: this.category,
|
|
77
77
|
riskLevel: 'LOW',
|
|
78
78
|
passed: true,
|
|
79
|
-
title: 'My Domain is configured to require SSO
|
|
80
|
-
detail: `The AuthConfig for this org has SAML enabled and password login disabled, indicating SSO is enforced via My Domain. Users cannot log in with Salesforce credentials
|
|
79
|
+
title: 'My Domain is configured to require SSO: password login disabled',
|
|
80
|
+
detail: `The AuthConfig for this org has SAML enabled and password login disabled, indicating SSO is enforced via My Domain. Users cannot log in with Salesforce credentials. They must authenticate through the configured identity provider.`,
|
|
81
81
|
remediation: 'Verify that the SAML configuration points to the correct identity provider and that the IdP enforces MFA.',
|
|
82
82
|
affectedItems: ssoEnforced.map((c) => ({
|
|
83
83
|
label: c.DeveloperName,
|
|
84
84
|
url: ssoSetupUrl,
|
|
85
|
-
note: 'SAML only
|
|
85
|
+
note: 'SAML only: password login disabled',
|
|
86
86
|
})),
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -94,7 +94,7 @@ export class MyDomainLoginPolicyCheck {
|
|
|
94
94
|
category: this.category,
|
|
95
95
|
riskLevel: 'MEDIUM',
|
|
96
96
|
inconclusive: true,
|
|
97
|
-
title: 'My Domain login policy could not be verified
|
|
97
|
+
title: 'My Domain login policy could not be verified: AuthConfig not accessible',
|
|
98
98
|
detail: 'The Tooling API AuthConfig query was not accessible. The My Domain login policy (credential login vs SSO-only) cannot be automatically verified.',
|
|
99
99
|
remediation: 'Manually verify in Setup → My Domain → Authentication Configuration that "Login Page" is disabled and "Prevent Login from login.salesforce.com" is enabled.',
|
|
100
100
|
});
|
|
@@ -84,7 +84,7 @@ export class NamedCredentialsCheck {
|
|
|
84
84
|
affectedItems: unusedCredentials.map((r) => ({
|
|
85
85
|
label: r.MasterLabel,
|
|
86
86
|
url: setupUrl,
|
|
87
|
-
note: `${r.Endpoint}
|
|
87
|
+
note: `${r.Endpoint}: verify if still required, delete if orphaned`,
|
|
88
88
|
})),
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -101,7 +101,7 @@ export class NamedCredentialsCheck {
|
|
|
101
101
|
affectedItems: httpEndpoints.map((r) => ({
|
|
102
102
|
label: r.MasterLabel,
|
|
103
103
|
url: setupUrl,
|
|
104
|
-
note: `${r.Endpoint}
|
|
104
|
+
note: `${r.Endpoint}: migrate to HTTPS`,
|
|
105
105
|
})),
|
|
106
106
|
});
|
|
107
107
|
}
|
|
@@ -119,7 +119,7 @@ export class NamedCredentialsCheck {
|
|
|
119
119
|
affectedItems: anonymousCreds.map((r) => ({
|
|
120
120
|
label: r.MasterLabel,
|
|
121
121
|
url: setupUrl,
|
|
122
|
-
note: `${r.Endpoint}
|
|
122
|
+
note: `${r.Endpoint}: verify that no authentication is required`,
|
|
123
123
|
})),
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
export declare class OutboundMessagesCheck implements SecurityCheck {
|
|
4
|
+
readonly id = "outbound-messages";
|
|
5
|
+
readonly name = "Workflow Outbound Messages";
|
|
6
|
+
readonly category = "External Connectivity";
|
|
7
|
+
readonly description = "Flags workflow outbound messages that include a Salesforce session ID or post to cleartext (http://) endpoints: session-hijack and exfiltration vectors";
|
|
8
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=OutboundMessagesCheck.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export class OutboundMessagesCheck {
|
|
2
|
+
id = 'outbound-messages';
|
|
3
|
+
name = 'Workflow Outbound Messages';
|
|
4
|
+
category = 'External Connectivity';
|
|
5
|
+
description = 'Flags workflow outbound messages that include a Salesforce session ID or post to cleartext (http://) endpoints: session-hijack and exfiltration vectors';
|
|
6
|
+
async run(ctx) {
|
|
7
|
+
const findings = [];
|
|
8
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/WorkflowOutboundMessaging/home`;
|
|
9
|
+
let rows;
|
|
10
|
+
try {
|
|
11
|
+
rows = await ctx.tooling.query('SELECT Id, Name, EndpointUrl, IncludeSessionId FROM WorkflowOutboundMessage');
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
15
|
+
findings.push({
|
|
16
|
+
id: 'outbound-messages-inaccessible',
|
|
17
|
+
category: this.category,
|
|
18
|
+
riskLevel: 'INFO',
|
|
19
|
+
inconclusive: true,
|
|
20
|
+
title: 'Workflow outbound messages could not be read',
|
|
21
|
+
detail: `The WorkflowOutboundMessage Tooling query was not accessible: ${msg}`,
|
|
22
|
+
remediation: 'Grant the audit user "View Setup and Configuration", then re-run the audit.',
|
|
23
|
+
});
|
|
24
|
+
return { findings };
|
|
25
|
+
}
|
|
26
|
+
if (rows.length === 0) {
|
|
27
|
+
findings.push({
|
|
28
|
+
id: 'outbound-messages-none',
|
|
29
|
+
category: this.category,
|
|
30
|
+
riskLevel: 'LOW',
|
|
31
|
+
passed: true,
|
|
32
|
+
title: 'No workflow outbound messages configured',
|
|
33
|
+
detail: 'No outbound messages are defined, so there is no automated POST of org data to external endpoints to review.',
|
|
34
|
+
remediation: 'If outbound messages are added later, use HTTPS endpoints and avoid including the session ID.',
|
|
35
|
+
});
|
|
36
|
+
return { findings };
|
|
37
|
+
}
|
|
38
|
+
const isCleartext = (url) => /^http:\/\//i.test(url.trim());
|
|
39
|
+
const sessionId = rows.filter((r) => r.IncludeSessionId);
|
|
40
|
+
const cleartext = rows.filter((r) => isCleartext(r.EndpointUrl));
|
|
41
|
+
if (sessionId.length > 0) {
|
|
42
|
+
findings.push({
|
|
43
|
+
id: 'outbound-messages-session-id',
|
|
44
|
+
category: this.category,
|
|
45
|
+
riskLevel: 'HIGH',
|
|
46
|
+
title: `${sessionId.length} outbound message(s) send a Salesforce session ID to an external endpoint`,
|
|
47
|
+
detail: 'Outbound messages with "Include Session ID" enabled deliver a live, API-capable Salesforce session ID to the configured endpoint with every fire. If that endpoint is attacker-controlled, compromised, or simply logs payloads, the session ID can be replayed to access the org as the integration user: a direct session-hijack and data-exfiltration path.',
|
|
48
|
+
remediation: 'Disable "Include Session ID" on every outbound message unless absolutely required. Prefer Named Credentials or OAuth for callbacks that need to authenticate to Salesforce.',
|
|
49
|
+
affectedItems: sessionId.map((r) => ({
|
|
50
|
+
label: r.Name,
|
|
51
|
+
url: setupUrl,
|
|
52
|
+
note: `${r.EndpointUrl}: disable Include Session ID`,
|
|
53
|
+
})),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (cleartext.length > 0) {
|
|
57
|
+
findings.push({
|
|
58
|
+
id: 'outbound-messages-cleartext',
|
|
59
|
+
category: this.category,
|
|
60
|
+
riskLevel: 'HIGH',
|
|
61
|
+
title: `${cleartext.length} outbound message(s) post to a cleartext http:// endpoint`,
|
|
62
|
+
detail: 'Outbound messages to plain http:// endpoints transmit record data (and the session ID, if included) unencrypted over the network, where it can be intercepted in transit.',
|
|
63
|
+
remediation: 'Change each endpoint to HTTPS and confirm the receiving service presents a valid certificate.',
|
|
64
|
+
affectedItems: cleartext.map((r) => ({
|
|
65
|
+
label: r.Name,
|
|
66
|
+
url: setupUrl,
|
|
67
|
+
note: `${r.EndpointUrl}: switch to HTTPS`,
|
|
68
|
+
})),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
findings.push({
|
|
72
|
+
id: 'outbound-messages-inventory',
|
|
73
|
+
category: this.category,
|
|
74
|
+
riskLevel: sessionId.length === 0 && cleartext.length === 0 ? 'LOW' : 'INFO',
|
|
75
|
+
passed: sessionId.length === 0 && cleartext.length === 0 ? true : undefined,
|
|
76
|
+
title: `${rows.length} workflow outbound message(s) configured (${sessionId.length} include session ID, ${cleartext.length} cleartext)`,
|
|
77
|
+
detail: 'Outbound messages POST record data to external endpoints automatically. Each destination should be a reviewed, currently-used HTTPS integration.',
|
|
78
|
+
remediation: 'Audit each outbound message endpoint to confirm it is still used and points to a trusted HTTPS destination. Remove unused entries.',
|
|
79
|
+
affectedItems: rows.map((r) => ({
|
|
80
|
+
label: r.Name,
|
|
81
|
+
url: setupUrl,
|
|
82
|
+
note: `${r.EndpointUrl}${r.IncludeSessionId ? ' ⚠ session ID included' : ''}`,
|
|
83
|
+
})),
|
|
84
|
+
});
|
|
85
|
+
return { findings };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=OutboundMessagesCheck.js.map
|
|
@@ -48,7 +48,7 @@ export class PasswordSessionPolicyCheck {
|
|
|
48
48
|
affectedItems: passwordRisks.map((r) => ({
|
|
49
49
|
label: r.setting,
|
|
50
50
|
url: `${baseUrl}/lightning/setup/SecurityPasswordPolicies/page`,
|
|
51
|
-
note: `Current: ${r.value}
|
|
51
|
+
note: `Current: ${r.value}. Update in Setup → Password Policies`,
|
|
52
52
|
})),
|
|
53
53
|
detail: 'Password policy settings deviate from CIS Salesforce Benchmark recommendations. Weak password policies increase the risk of credential-based attacks.',
|
|
54
54
|
remediation: 'Review each flagged password policy setting in Setup → Security Controls → Password Policies and align with CIS benchmarks.',
|
|
@@ -63,7 +63,7 @@ export class PasswordSessionPolicyCheck {
|
|
|
63
63
|
affectedItems: sessionRisks.map((r) => ({
|
|
64
64
|
label: r.setting,
|
|
65
65
|
url: `${baseUrl}/lightning/setup/SessionSettings/page`,
|
|
66
|
-
note: `Current: ${r.value}
|
|
66
|
+
note: `Current: ${r.value}. Update in Setup → Session Settings`,
|
|
67
67
|
})),
|
|
68
68
|
detail: 'Session security settings deviate from recommended values. This can expose users to session hijacking or cross-site request forgery attacks.',
|
|
69
69
|
remediation: 'Review session security settings in Setup → Security Controls → Session Settings.',
|
|
@@ -78,7 +78,7 @@ export class PasswordSessionPolicyCheck {
|
|
|
78
78
|
affectedItems: mfaRisks.map((r) => ({
|
|
79
79
|
label: r.setting,
|
|
80
80
|
url: `${baseUrl}/lightning/setup/MultiFactorAuthentication/page`,
|
|
81
|
-
note: `Current: ${r.value}
|
|
81
|
+
note: `Current: ${r.value}. Enable MFA in Setup → Identity → Multi-Factor Authentication`,
|
|
82
82
|
})),
|
|
83
83
|
detail: 'MFA enforcement protects against credential-based attacks. Gaps in MFA policy leave accounts vulnerable even if passwords are compromised.',
|
|
84
84
|
remediation: 'Enable MFA for all users in Setup → Identity → Multi-Factor Authentication. Use Salesforce Authenticator or a compatible authenticator app.',
|