@cclabsnz/sf-audit 1.1.0 → 1.3.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 +168 -38
- package/lib/chains/namedChains.js +4 -4
- package/lib/checks/CheckEngine.js +1 -1
- 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/CertificateExpiryCheck.js +1 -1
- 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/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/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 +6 -6
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
- 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/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
- 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/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/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/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/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 +12 -0
- package/lib/commands/audit/diff.js +1 -1
- package/lib/commands/audit/security.d.ts +5 -0
- package/lib/commands/audit/security.js +33 -4
- package/lib/compliance/catalogs/hiso10029.d.ts +3 -0
- package/lib/compliance/catalogs/hiso10029.js +35 -0
- package/lib/compliance/catalogs/index.d.ts +4 -0
- package/lib/compliance/catalogs/index.js +21 -0
- package/lib/compliance/catalogs/iso27001.d.ts +3 -0
- package/lib/compliance/catalogs/iso27001.js +39 -0
- package/lib/compliance/catalogs/nzism.d.ts +3 -0
- package/lib/compliance/catalogs/nzism.js +31 -0
- package/lib/compliance/catalogs/owasp.d.ts +3 -0
- package/lib/compliance/catalogs/owasp.js +37 -0
- package/lib/compliance/catalogs/privacyAct.d.ts +3 -0
- package/lib/compliance/catalogs/privacyAct.js +17 -0
- package/lib/compliance/catalogs/sbs.d.ts +3 -0
- package/lib/compliance/catalogs/sbs.js +61 -0
- package/lib/compliance/catalogs/soc2.d.ts +3 -0
- package/lib/compliance/catalogs/soc2.js +42 -0
- package/lib/compliance/mapping.d.ts +2 -0
- package/lib/compliance/mapping.js +118 -0
- package/lib/compliance/resolve.d.ts +12 -0
- package/lib/compliance/resolve.js +49 -0
- package/lib/compliance/types.d.ts +13 -0
- package/lib/compliance/types.js +2 -0
- package/lib/context/AuditCache.d.ts +9 -0
- package/lib/findings/CheckMeta.d.ts +9 -0
- package/lib/findings/CheckMeta.js +72 -0
- package/lib/renderers/AuditRenderer.d.ts +2 -0
- package/lib/renderers/ClientReportRenderer.d.ts +29 -0
- package/lib/renderers/ClientReportRenderer.js +205 -0
- package/lib/renderers/DiffHtmlRenderer.js +1 -1
- package/lib/renderers/HistoryRenderer.js +1 -1
- package/lib/renderers/HtmlRenderer.js +4 -10
- package/lib/renderers/MarkdownRenderer.js +2 -2
- package/lib/renderers/html-utils.d.ts +2 -0
- package/lib/renderers/html-utils.js +8 -0
- package/lib/report/ComplianceMatrix.d.ts +19 -0
- package/lib/report/ComplianceMatrix.js +47 -0
- package/lib/report/ExecutivePriorities.d.ts +8 -0
- package/lib/report/ExecutivePriorities.js +22 -0
- package/lib/report/RemediationRoadmap.d.ts +9 -0
- package/lib/report/RemediationRoadmap.js +18 -0
- package/lib/report/branding.d.ts +18 -0
- package/lib/report/branding.js +19 -0
- package/lib/report/fonts.d.ts +2 -0
- package/lib/report/fonts.js +22 -0
- package/messages/audit.security.md +30 -2
- package/package.json +3 -1
- package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
- package/config/queries/soql.json +0 -24
- package/config/queries/tooling.json +0 -28
- package/config/scoring.json +0 -17
|
@@ -37,8 +37,8 @@ export class ApexLoggingCheck {
|
|
|
37
37
|
category: this.category,
|
|
38
38
|
riskLevel: 'INFO',
|
|
39
39
|
inconclusive: true,
|
|
40
|
-
title: 'Apex class bodies not available
|
|
41
|
-
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache
|
|
40
|
+
title: 'Apex class bodies not available: SBS-CODE-003/004 check skipped',
|
|
41
|
+
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
42
42
|
remediation: 'Verify HardcodedCredentialsCheck is registered before ApexLoggingCheck in the check registry.',
|
|
43
43
|
});
|
|
44
44
|
return { findings };
|
|
@@ -70,7 +70,7 @@ export class ApexLoggingCheck {
|
|
|
70
70
|
category: this.category,
|
|
71
71
|
riskLevel: 'LOW',
|
|
72
72
|
passed: true,
|
|
73
|
-
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework
|
|
73
|
+
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework: SBS-CODE-003`,
|
|
74
74
|
detail: `SBS-CODE-003 requires Apex to use a persistent logging framework rather than transient System.debug calls. ${persistentLoggerClasses.length} class(es) reference a persistent logger. Examples: ${persistentLoggerClasses.slice(0, 5).join(', ')}${persistentLoggerClasses.length > 5 ? ` (+${persistentLoggerClasses.length - 5} more)` : ''}.`,
|
|
75
75
|
remediation: 'Extend persistent logging coverage to all production classes that handle significant business logic or integration operations.',
|
|
76
76
|
});
|
|
@@ -80,15 +80,15 @@ export class ApexLoggingCheck {
|
|
|
80
80
|
id: 'apex-logging-debug-only',
|
|
81
81
|
category: this.category,
|
|
82
82
|
riskLevel: scheduledDebugClasses.length > 0 ? 'MEDIUM' : 'LOW',
|
|
83
|
-
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug
|
|
84
|
-
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs
|
|
83
|
+
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug: SBS-CODE-003`,
|
|
84
|
+
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs. Persistent logging is especially important for operational visibility in background processes.` : ''}`,
|
|
85
85
|
remediation: 'Adopt a persistent logging framework (a custom Log__c object, Platform Events, or an open-source framework) and migrate System.debug calls to it for all classes handling critical business logic.',
|
|
86
86
|
affectedItems: debugOnlyClasses.slice(0, 30).map((name) => ({
|
|
87
87
|
label: name,
|
|
88
88
|
url: apexClassesUrl,
|
|
89
89
|
note: scheduledClassNames.has(name)
|
|
90
|
-
? 'scheduled/batch job
|
|
91
|
-
: 'System.debug only
|
|
90
|
+
? 'scheduled/batch job: high priority to add persistent logging'
|
|
91
|
+
: 'System.debug only: no persistent log trail',
|
|
92
92
|
})),
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -97,13 +97,13 @@ export class ApexLoggingCheck {
|
|
|
97
97
|
id: 'apex-logging-sensitive-data',
|
|
98
98
|
category: this.category,
|
|
99
99
|
riskLevel: 'HIGH',
|
|
100
|
-
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data
|
|
100
|
+
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data: SBS-CODE-004`,
|
|
101
101
|
detail: 'SBS-CODE-004 prohibits logging sensitive data (passwords, tokens, session IDs, PII) in Apex. The flagged classes appear to pass sensitive variable names or credential values directly to System.debug(), which writes them to debug logs accessible to any administrator who can view debug logs.',
|
|
102
102
|
remediation: 'Remove all logging of passwords, tokens, API keys, and PII from Apex code. Review each flagged class and mask, redact, or entirely exclude sensitive values before passing them to any logging call.',
|
|
103
103
|
affectedItems: sensitiveLogClasses.map((name) => ({
|
|
104
104
|
label: name,
|
|
105
105
|
url: apexClassesUrl,
|
|
106
|
-
note: 'Review System.debug() calls
|
|
106
|
+
note: 'Review System.debug() calls: sensitive variable names detected near logging statements',
|
|
107
107
|
})),
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -113,7 +113,7 @@ export class ApexLoggingCheck {
|
|
|
113
113
|
category: this.category,
|
|
114
114
|
riskLevel: 'LOW',
|
|
115
115
|
passed: true,
|
|
116
|
-
title: 'No System.debug-only logging or sensitive-data logging patterns found
|
|
116
|
+
title: 'No System.debug-only logging or sensitive-data logging patterns found: SBS-CODE-003/004',
|
|
117
117
|
detail: 'SBS-CODE-003 requires a persistent logging framework and SBS-CODE-004 prohibits sensitive data in logs. No violations were detected in the scanned Apex classes.',
|
|
118
118
|
remediation: 'Continue monitoring as new Apex classes are added to the org.',
|
|
119
119
|
});
|
|
@@ -21,7 +21,7 @@ export class ApexRestEndpointCheck {
|
|
|
21
21
|
category: this.category,
|
|
22
22
|
riskLevel: 'INFO',
|
|
23
23
|
inconclusive: true,
|
|
24
|
-
title: 'Apex class bodies not available
|
|
24
|
+
title: 'Apex class bodies not available: REST endpoint check skipped',
|
|
25
25
|
detail: 'Apex bodies were not cached. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
26
26
|
remediation: 'Verify registry ordering.',
|
|
27
27
|
});
|
|
@@ -51,7 +51,7 @@ export class ApexRestEndpointCheck {
|
|
|
51
51
|
affectedItems: restClasses.map(({ name }) => ({
|
|
52
52
|
label: name,
|
|
53
53
|
url: apexClassesUrl,
|
|
54
|
-
note: 'Custom REST endpoint
|
|
54
|
+
note: 'Custom REST endpoint: review access controls',
|
|
55
55
|
})),
|
|
56
56
|
});
|
|
57
57
|
// Flag endpoints declared without sharing — REST callers bypass record-level access
|
|
@@ -62,12 +62,12 @@ export class ApexRestEndpointCheck {
|
|
|
62
62
|
category: this.category,
|
|
63
63
|
riskLevel: 'HIGH',
|
|
64
64
|
title: `${withoutSharing.length} REST endpoint class(es) declared "without sharing"`,
|
|
65
|
-
detail: `Apex REST endpoints declared "without sharing" execute with elevated system privileges
|
|
65
|
+
detail: `Apex REST endpoints declared "without sharing" execute with elevated system privileges. Any authenticated (or, if the endpoint is exposed via a Community, unauthenticated) caller can retrieve or modify records regardless of the running user's sharing rules. This is a common vector for horizontal privilege escalation in Salesforce integrations.`,
|
|
66
66
|
remediation: 'Change declarations to "with sharing" so that record-level access is enforced for REST callers. Where system-level access is genuinely required (e.g. an integration service account), document the justification and ensure the endpoint is not accessible to end-user profiles.',
|
|
67
67
|
affectedItems: withoutSharing.map(({ name }) => ({
|
|
68
68
|
label: name,
|
|
69
69
|
url: apexClassesUrl,
|
|
70
|
-
note: '"without sharing" REST endpoint
|
|
70
|
+
note: '"without sharing" REST endpoint: callers bypass record sharing rules',
|
|
71
71
|
})),
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -84,7 +84,7 @@ export class ApexRestEndpointCheck {
|
|
|
84
84
|
affectedItems: noSharingDeclaration.map(({ name }) => ({
|
|
85
85
|
label: name,
|
|
86
86
|
url: apexClassesUrl,
|
|
87
|
-
note: 'No sharing declaration
|
|
87
|
+
note: 'No sharing declaration: add "with sharing" explicitly',
|
|
88
88
|
})),
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -79,15 +79,15 @@ export class ApexSharingCheck {
|
|
|
79
79
|
id: 'portal-exposed-apex-without-sharing',
|
|
80
80
|
category: this.category,
|
|
81
81
|
riskLevel: 'CRITICAL',
|
|
82
|
-
title: `${allPortalRisk.length} portal-exposed Apex class(es) (@AuraEnabled/@RemoteAction) lack "with sharing"
|
|
82
|
+
title: `${allPortalRisk.length} portal-exposed Apex class(es) (@AuraEnabled/@RemoteAction) lack "with sharing": IDOR risk`,
|
|
83
83
|
detail: 'Classes with @AuraEnabled or @RemoteAction methods that use "without sharing" or have no sharing declaration execute without record-level access control. Attackers can supply arbitrary record IDs to read or manipulate data they should not access (IDOR). SBS-CPORTAL-001 requires server-side authorization for every record accessed via portal Apex.',
|
|
84
84
|
remediation: 'Add "with sharing" to all @AuraEnabled and @RemoteAction classes. Validate user ownership or sharing on every record accessed inside these methods.',
|
|
85
85
|
affectedItems: allPortalRisk.map((name) => ({
|
|
86
86
|
label: name,
|
|
87
87
|
url: apexClassesUrl,
|
|
88
88
|
note: portalExposedWithoutSharing.includes(name)
|
|
89
|
-
? 'Uses explicit "without sharing"
|
|
90
|
-
: 'No sharing declaration
|
|
89
|
+
? 'Uses explicit "without sharing": replace with "with sharing"'
|
|
90
|
+
: 'No sharing declaration: add "with sharing"',
|
|
91
91
|
})),
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -32,7 +32,7 @@ export class ApiClientPermissionCheck {
|
|
|
32
32
|
id: 'api-client-permission-assigned',
|
|
33
33
|
category: this.category,
|
|
34
34
|
riskLevel: profileGrantors.length > 0 ? 'HIGH' : 'MEDIUM',
|
|
35
|
-
title: `${users.length} user(s) have the "Use Any API Client" permission
|
|
35
|
+
title: `${users.length} user(s) have the "Use Any API Client" permission: SBS-ACS-006`,
|
|
36
36
|
detail: 'SBS-ACS-006 requires documented justification for this permission and states it must not be granted to end-users. "Use Any API Client" bypasses API Access Control, allowing the user to connect via any third-party API client regardless of allowed-list restrictions. This significantly expands the attack surface for unauthorised data access.',
|
|
37
37
|
remediation: 'Review each assignment. Remove from all end-users. Only keep for documented technical users (integration accounts) with a recorded justification in the system of record. Prefer granting through a dedicated permission set, not a profile.',
|
|
38
38
|
affectedItems: users.map((r) => ({
|
|
@@ -48,7 +48,7 @@ export class ApiClientPermissionCheck {
|
|
|
48
48
|
category: this.category,
|
|
49
49
|
riskLevel: 'INFO',
|
|
50
50
|
inconclusive: true,
|
|
51
|
-
title: '"Use Any API Client" permission check could not run
|
|
51
|
+
title: '"Use Any API Client" permission check could not run: field may not exist in this org edition',
|
|
52
52
|
detail: 'SBS-ACS-006 requires documented justification for the "Use Any API Client" permission. This field is part of the API Access Control feature and may not be available in all Salesforce editions.',
|
|
53
53
|
remediation: 'Verify in Setup → Permission Sets whether "Use Any API Client" is available and review assignments if so.',
|
|
54
54
|
});
|
|
@@ -59,7 +59,7 @@ export class CertificateExpiryCheck {
|
|
|
59
59
|
return 'no expiry date';
|
|
60
60
|
const daysLeft = Math.ceil((new Date(cert.ExpirationDate).getTime() - now) / 86_400_000);
|
|
61
61
|
const expiryStr = new Date(cert.ExpirationDate).toISOString().split('T')[0];
|
|
62
|
-
return `${daysLeft} day(s) until expiry
|
|
62
|
+
return `${daysLeft} day(s) until expiry: expires ${expiryStr}`;
|
|
63
63
|
}
|
|
64
64
|
if (critical.length > 0) {
|
|
65
65
|
findings.push({
|
|
@@ -4,7 +4,7 @@ export declare class ConnectedAppInactivityCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "connected-app-inactivity";
|
|
5
5
|
readonly name = "Inactive Connected Apps";
|
|
6
6
|
readonly category = "App Security";
|
|
7
|
-
readonly description = "Flags connected apps with no OAuth logins in the past 90 days
|
|
7
|
+
readonly description = "Flags connected apps with no OAuth logins in the past 90 days: stale apps are unused attack surface";
|
|
8
8
|
readonly dependsOnCache: readonly ["connectedAppNames"];
|
|
9
9
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
10
|
}
|
|
@@ -2,7 +2,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
2
2
|
id = 'connected-app-inactivity';
|
|
3
3
|
name = 'Inactive Connected Apps';
|
|
4
4
|
category = 'App Security';
|
|
5
|
-
description = 'Flags connected apps with no OAuth logins in the past 90 days
|
|
5
|
+
description = 'Flags connected apps with no OAuth logins in the past 90 days: stale apps are unused attack surface';
|
|
6
6
|
dependsOnCache = ['connectedAppNames'];
|
|
7
7
|
async run(ctx) {
|
|
8
8
|
const findings = [];
|
|
@@ -41,7 +41,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
41
41
|
category: this.category,
|
|
42
42
|
riskLevel: 'INFO',
|
|
43
43
|
inconclusive: true,
|
|
44
|
-
title: 'Connected app activity could not be determined
|
|
44
|
+
title: 'Connected app activity could not be determined: LoginHistory not accessible',
|
|
45
45
|
detail: 'LoginHistory was not accessible. Connected app inactivity cannot be computed without login history.',
|
|
46
46
|
remediation: 'Grant LoginHistory read access to the audit user.',
|
|
47
47
|
});
|
|
@@ -56,12 +56,12 @@ export class ConnectedAppInactivityCheck {
|
|
|
56
56
|
category: this.category,
|
|
57
57
|
riskLevel: inactiveApps.length > 5 ? 'MEDIUM' : 'LOW',
|
|
58
58
|
title: `${inactiveApps.length} connected app(s) have had no OAuth logins in 90 days`,
|
|
59
|
-
detail: `${inactiveApps.length} of ${connectedAppNames.length} connected apps show no OAuth login activity in the past 90 days. Inactive apps still hold valid OAuth credentials and expand the attack surface
|
|
59
|
+
detail: `${inactiveApps.length} of ${connectedAppNames.length} connected apps show no OAuth login activity in the past 90 days. Inactive apps still hold valid OAuth credentials and expand the attack surface. A compromised or leaked client secret for an inactive app can be used to obtain access tokens without triggering activity alerts.`,
|
|
60
60
|
remediation: 'Review each inactive connected app. If the integration is no longer in use, delete or disable the app to revoke its OAuth credentials. Ensure active integrations are documented with an owner.',
|
|
61
61
|
affectedItems: inactiveApps.map((name) => ({
|
|
62
62
|
label: name,
|
|
63
63
|
url: setupUrl,
|
|
64
|
-
note: 'No OAuth logins in 90 days
|
|
64
|
+
note: 'No OAuth logins in 90 days: verify if still needed and delete if not',
|
|
65
65
|
})),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -76,7 +76,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
76
76
|
affectedItems: activeApps.map((name) => ({
|
|
77
77
|
label: name,
|
|
78
78
|
url: setupUrl,
|
|
79
|
-
note: 'Active
|
|
79
|
+
note: 'Active: verify documented owner and justification',
|
|
80
80
|
})),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -4,7 +4,7 @@ export declare class ConnectedAppScopeCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "connected-app-scope";
|
|
5
5
|
readonly name = "Connected App OAuth Scopes & Token Policy";
|
|
6
6
|
readonly category = "App Security";
|
|
7
|
-
readonly description = "Flags connected apps granting Full OAuth scope or using infinite refresh token policies
|
|
7
|
+
readonly description = "Flags connected apps granting Full OAuth scope or using infinite refresh token policies: both expand the blast radius of a compromised token";
|
|
8
8
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=ConnectedAppScopeCheck.d.ts.map
|
|
@@ -12,7 +12,7 @@ export class ConnectedAppScopeCheck {
|
|
|
12
12
|
id = 'connected-app-scope';
|
|
13
13
|
name = 'Connected App OAuth Scopes & Token Policy';
|
|
14
14
|
category = 'App Security';
|
|
15
|
-
description = 'Flags connected apps granting Full OAuth scope or using infinite refresh token policies
|
|
15
|
+
description = 'Flags connected apps granting Full OAuth scope or using infinite refresh token policies: both expand the blast radius of a compromised token';
|
|
16
16
|
async run(ctx) {
|
|
17
17
|
const findings = [];
|
|
18
18
|
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/ConnectedApplication/home`;
|
|
@@ -63,7 +63,7 @@ export class ConnectedAppScopeCheck {
|
|
|
63
63
|
category: this.category,
|
|
64
64
|
riskLevel: 'HIGH',
|
|
65
65
|
title: `${fullScopeApps.length} connected app(s) grant the "Full" OAuth scope`,
|
|
66
|
-
detail: 'The Full OAuth scope gives a connected app the same access rights as the authorising user
|
|
66
|
+
detail: 'The Full OAuth scope gives a connected app the same access rights as the authorising user, including Modify All Data if the user is an admin. A stolen access or refresh token from a Full-scope app can be used to read, write, and delete any record the user could access. Full scope is almost never necessary; specific scopes (Api, Web, CustomPermissions) should be used instead.',
|
|
67
67
|
remediation: 'Edit each connected app in Setup → Connected Apps → OAuth Policies and replace "Full" scope with the minimum scopes the integration actually requires. Common replacements: "Api" for REST API access, "Web" for web-based flows, "OpenID" + "Profile" for identity only. Rotating client secrets after scope changes is also recommended.',
|
|
68
68
|
affectedItems: fullScopeApps.map((app) => ({
|
|
69
69
|
label: app.Name,
|
|
@@ -97,13 +97,13 @@ export class ConnectedAppScopeCheck {
|
|
|
97
97
|
id: 'connected-app-full-scope-infinite-token',
|
|
98
98
|
category: this.category,
|
|
99
99
|
riskLevel: 'CRITICAL',
|
|
100
|
-
title: `${fullAndInfinite.length} connected app(s) combine Full scope with an infinite refresh token
|
|
100
|
+
title: `${fullAndInfinite.length} connected app(s) combine Full scope with an infinite refresh token: stolen token = permanent full access`,
|
|
101
101
|
detail: 'These apps issue never-expiring tokens that grant complete access to the org as the authorising user. A single leaked token is equivalent to a permanent credential with admin-level reach if the user is an admin. This is the highest-risk connected app configuration.',
|
|
102
102
|
remediation: 'Immediately restrict scopes to the minimum required and set an explicit refresh token expiry. If Full scope cannot be removed, at minimum set a refresh token validity period of 90 days or less and enable refresh token rotation.',
|
|
103
103
|
affectedItems: fullAndInfinite.map((app) => ({
|
|
104
104
|
label: app.Name,
|
|
105
105
|
url: setupUrl,
|
|
106
|
-
note: `Full scope + infinite refresh token
|
|
106
|
+
note: `Full scope + infinite refresh token: highest risk combination`,
|
|
107
107
|
})),
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -57,8 +57,8 @@ export class ConnectedAppsCheck {
|
|
|
57
57
|
label: app.Name,
|
|
58
58
|
url: `${baseUrl}/${app.Id}`,
|
|
59
59
|
note: app.SessionTimeout === null || app.SessionTimeout === 0
|
|
60
|
-
? 'No explicit timeout
|
|
61
|
-
: `Session timeout: ${app.SessionTimeout} min
|
|
60
|
+
? 'No explicit timeout: inherits org default (likely > 15 min)'
|
|
61
|
+
: `Session timeout: ${app.SessionTimeout} min, reduce to ≤ 15`,
|
|
62
62
|
})),
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -54,13 +54,13 @@ export class ContentLinksCheck {
|
|
|
54
54
|
id: 'content-links-no-expiry',
|
|
55
55
|
category: this.category,
|
|
56
56
|
riskLevel: noExpiry.length > 20 ? 'HIGH' : 'MEDIUM',
|
|
57
|
-
title: `${noExpiry.length} public content link(s) have no expiry date
|
|
57
|
+
title: `${noExpiry.length} public content link(s) have no expiry date: SBS-FILE-001`,
|
|
58
58
|
detail: 'SBS-FILE-001 requires all public content distribution links to have an expiry date. Links without expiry remain active indefinitely, allowing anyone with the URL to continue accessing potentially sensitive documents even after the sharing purpose has ended.',
|
|
59
59
|
remediation: 'Set an expiry date on all active public links. Establish a policy requiring expiry dates when creating new content distribution links, and configure Salesforce to enforce expiry via the Content Distribution settings.',
|
|
60
60
|
affectedItems: noExpiry.slice(0, 50).map((r) => ({
|
|
61
61
|
label: r.Name,
|
|
62
62
|
url: `${baseUrl}/${r.ContentDocumentId}`,
|
|
63
|
-
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}
|
|
63
|
+
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}, set an expiry date`,
|
|
64
64
|
})),
|
|
65
65
|
});
|
|
66
66
|
}
|
|
@@ -71,13 +71,13 @@ export class ContentLinksCheck {
|
|
|
71
71
|
id: 'content-links-no-password',
|
|
72
72
|
category: this.category,
|
|
73
73
|
riskLevel: 'LOW',
|
|
74
|
-
title: `${noPassword.length} public content link(s) are not password-protected
|
|
74
|
+
title: `${noPassword.length} public content link(s) are not password-protected: SBS-FILE-002`,
|
|
75
75
|
detail: 'SBS-FILE-002 recommends password-protecting public content sharing links, particularly for documents containing sensitive or confidential information. Links without a password can be accessed by anyone with the URL.',
|
|
76
76
|
remediation: 'Enable password protection for public content links that share sensitive content. Review each link to determine if the shared content warrants the additional protection layer.',
|
|
77
77
|
affectedItems: noPassword.slice(0, 50).map((r) => ({
|
|
78
78
|
label: r.Name,
|
|
79
79
|
url: `${baseUrl}/${r.ContentDocumentId}`,
|
|
80
|
-
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}
|
|
80
|
+
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}, assess whether password protection is needed`,
|
|
81
81
|
})),
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -88,13 +88,13 @@ export class ContentLinksCheck {
|
|
|
88
88
|
id: 'content-links-stale',
|
|
89
89
|
category: this.category,
|
|
90
90
|
riskLevel: 'MEDIUM',
|
|
91
|
-
title: `${stale.length} public content link(s) are over ${STALE_DAYS} days old with no expiry
|
|
91
|
+
title: `${stale.length} public content link(s) are over ${STALE_DAYS} days old with no expiry: SBS-FILE-003`,
|
|
92
92
|
detail: `SBS-FILE-003 requires periodic cleanup of public content sharing links. ${stale.length} link(s) were created more than ${STALE_DAYS} days ago and have no expiry date, meaning they have been publicly accessible indefinitely. These likely represent sharing relationships that are no longer active.`,
|
|
93
93
|
remediation: `Review and expire or delete all content links older than ${STALE_DAYS} days where the sharing purpose is no longer active. Establish a quarterly review process for all active content distribution links.`,
|
|
94
94
|
affectedItems: stale.slice(0, 50).map((r) => ({
|
|
95
95
|
label: r.Name,
|
|
96
96
|
url: `${baseUrl}/${r.ContentDocumentId}`,
|
|
97
|
-
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}
|
|
97
|
+
note: `created: ${new Date(r.CreatedDate).toISOString().split('T')[0]}, review and expire or delete`,
|
|
98
98
|
})),
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -47,9 +47,9 @@ export class CorsAllowlistCheck {
|
|
|
47
47
|
category: this.category,
|
|
48
48
|
riskLevel: 'HIGH',
|
|
49
49
|
title: `${wildcard.length} CORS allowlist entry(ies) use a full wildcard origin`,
|
|
50
|
-
detail: 'A wildcard CORS origin lets ANY website make authenticated cross-origin requests to your org from a logged-in user\'s browser and read the responses
|
|
50
|
+
detail: 'A wildcard CORS origin lets ANY website make authenticated cross-origin requests to your org from a logged-in user\'s browser and read the responses, enabling session-scoped data and token theft.',
|
|
51
51
|
remediation: 'Replace wildcard origins with exact, fully-qualified HTTPS origins for each trusted application.',
|
|
52
|
-
affectedItems: wildcard.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Full wildcard
|
|
52
|
+
affectedItems: wildcard.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Full wildcard: remove immediately' })),
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
if (broad.length > 0) {
|
|
@@ -60,7 +60,7 @@ export class CorsAllowlistCheck {
|
|
|
60
60
|
title: `${broad.length} CORS allowlist entry(ies) use a broad subdomain wildcard`,
|
|
61
61
|
detail: 'Subdomain-wildcard CORS origins trust every current and future subdomain, widening the set of sites that can make authenticated cross-origin requests. A single compromised or attacker-controlled subdomain can steal session-scoped data.',
|
|
62
62
|
remediation: 'Pin CORS origins to the exact subdomains that need access rather than a wildcard.',
|
|
63
|
-
affectedItems: broad.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Broad wildcard
|
|
63
|
+
affectedItems: broad.map((r) => ({ label: r.UrlPattern, url: setupUrl, note: 'Broad wildcard: narrow to exact origins' })),
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
if (wildcard.length === 0 && broad.length === 0) {
|
|
@@ -4,7 +4,7 @@ export declare class CustomLabelsCredentialCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "custom-labels-credential";
|
|
5
5
|
readonly name = "Custom Labels Credential Exposure";
|
|
6
6
|
readonly category = "Secrets Management";
|
|
7
|
-
readonly description = "Scans Custom Labels for API keys, tokens, and credentials
|
|
7
|
+
readonly description = "Scans Custom Labels for API keys, tokens, and credentials. Labels are globally readable by all authenticated users via {!$Label.X} merge fields";
|
|
8
8
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=CustomLabelsCredentialCheck.d.ts.map
|
|
@@ -6,7 +6,7 @@ export class CustomLabelsCredentialCheck {
|
|
|
6
6
|
id = 'custom-labels-credential';
|
|
7
7
|
name = 'Custom Labels Credential Exposure';
|
|
8
8
|
category = 'Secrets Management';
|
|
9
|
-
description = 'Scans Custom Labels for API keys, tokens, and credentials
|
|
9
|
+
description = 'Scans Custom Labels for API keys, tokens, and credentials. Labels are globally readable by all authenticated users via {!$Label.X} merge fields';
|
|
10
10
|
async run(ctx) {
|
|
11
11
|
const findings = [];
|
|
12
12
|
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
@@ -21,7 +21,7 @@ export class CustomLabelsCredentialCheck {
|
|
|
21
21
|
category: this.category,
|
|
22
22
|
riskLevel: 'INFO',
|
|
23
23
|
inconclusive: true,
|
|
24
|
-
title: 'Custom Labels could not be queried
|
|
24
|
+
title: 'Custom Labels could not be queried: credential scan skipped',
|
|
25
25
|
detail: 'The Tooling API ExternalString query was not accessible. This may indicate the audit user lacks Tooling API access.',
|
|
26
26
|
remediation: 'Grant Tooling API access to the audit user and re-run.',
|
|
27
27
|
});
|
|
@@ -56,12 +56,12 @@ export class CustomLabelsCredentialCheck {
|
|
|
56
56
|
category: this.category,
|
|
57
57
|
riskLevel: 'HIGH',
|
|
58
58
|
title: `${nameMatches.length} Custom Label(s) have names suggesting credential storage`,
|
|
59
|
-
detail: `Custom Labels with names like "ApiKey", "ClientSecret", or "AuthToken" strongly suggest they store sensitive credentials. This is a critical misconfiguration: Custom Labels are globally readable by every authenticated Salesforce user via the \`{!\$Label.X}\` merge field in Visualforce pages, Flows, and Apex. Any user who can query the Tooling API or view source markup containing the merge field can read the label value
|
|
60
|
-
remediation: 'Migrate these credentials to Named Credentials or Protected Custom Metadata (visibility: "Protected"). Named Credentials encrypt stored values and provide managed authentication. Protected Custom Metadata is only accessible from the managed package
|
|
59
|
+
detail: `Custom Labels with names like "ApiKey", "ClientSecret", or "AuthToken" strongly suggest they store sensitive credentials. This is a critical misconfiguration: Custom Labels are globally readable by every authenticated Salesforce user via the \`{!\$Label.X}\` merge field in Visualforce pages, Flows, and Apex. Any user who can query the Tooling API or view source markup containing the merge field can read the label value, including attacker accounts, compromised users, and over-permissioned portal users. Unlike Named Credentials or Protected Custom Metadata, Custom Labels have no access control.`,
|
|
60
|
+
remediation: 'Migrate these credentials to Named Credentials or Protected Custom Metadata (visibility: "Protected"). Named Credentials encrypt stored values and provide managed authentication. Protected Custom Metadata is only accessible from the managed package, not from arbitrary user queries.',
|
|
61
61
|
affectedItems: nameMatches.map((l) => ({
|
|
62
62
|
label: l.Name,
|
|
63
63
|
url: setupUrl,
|
|
64
|
-
note: `Name indicates credential
|
|
64
|
+
note: `Name indicates credential: migrate to Named Credential or Protected Custom Metadata`,
|
|
65
65
|
})),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -76,7 +76,7 @@ export class CustomLabelsCredentialCheck {
|
|
|
76
76
|
affectedItems: valueMatches.map((l) => ({
|
|
77
77
|
label: l.Name,
|
|
78
78
|
url: setupUrl,
|
|
79
|
-
note: `Value matches secret pattern
|
|
79
|
+
note: `Value matches secret pattern: rotate credential and migrate storage`,
|
|
80
80
|
})),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -86,7 +86,7 @@ export class CustomLabelsCredentialCheck {
|
|
|
86
86
|
category: this.category,
|
|
87
87
|
riskLevel: 'LOW',
|
|
88
88
|
passed: true,
|
|
89
|
-
title: `${labels.length} Custom Label(s) scanned
|
|
89
|
+
title: `${labels.length} Custom Label(s) scanned: no obvious credential patterns found`,
|
|
90
90
|
detail: `All ${labels.length} custom labels were scanned for name and value patterns indicating credential storage. No obvious secrets were found. Note: custom labels with obfuscated names or non-standard encoding may not be detected.`,
|
|
91
91
|
remediation: 'Maintain the practice of using Named Credentials or Protected Custom Metadata for all secrets. Periodically review Custom Labels for new entries that may inadvertently store sensitive values.',
|
|
92
92
|
});
|
|
@@ -48,7 +48,7 @@ export class DataClassificationCheck {
|
|
|
48
48
|
category: this.category,
|
|
49
49
|
riskLevel: 'INFO',
|
|
50
50
|
inconclusive: true,
|
|
51
|
-
title: 'Data classification status could not be determined
|
|
51
|
+
title: 'Data classification status could not be determined: Tooling API access needed',
|
|
52
52
|
detail: 'SBS-DATA-001 requires all data fields to be classified by sensitivity. SBS-DATA-002 requires PII fields to be explicitly identified. The Tooling API FieldDefinition query was not accessible with the current user permissions.',
|
|
53
53
|
remediation: 'Enable Tooling API access for the audit user, or manually review data classification in Setup → Data Management → Data Classification for Account, Contact, Lead, Opportunity, Case, Contract, and User.',
|
|
54
54
|
});
|
|
@@ -63,7 +63,7 @@ export class DataClassificationCheck {
|
|
|
63
63
|
category: this.category,
|
|
64
64
|
riskLevel: 'LOW',
|
|
65
65
|
passed: true,
|
|
66
|
-
title: `Data classification configured on all ${CLASSIFICATION_OBJECTS.length} key objects
|
|
66
|
+
title: `Data classification configured on all ${CLASSIFICATION_OBJECTS.length} key objects: SBS-DATA-001/002`,
|
|
67
67
|
detail: `SBS-DATA-001 requires data to be classified by sensitivity and SBS-DATA-002 requires PII to be identified. All checked objects have at least one classified field (total: ${totalClassifiedFields} classified fields across ${classifiedObjects.length} objects).`,
|
|
68
68
|
remediation: 'Extend classification to any custom objects that store sensitive or personally identifiable data.',
|
|
69
69
|
});
|
|
@@ -73,13 +73,13 @@ export class DataClassificationCheck {
|
|
|
73
73
|
id: 'data-classification-missing',
|
|
74
74
|
category: this.category,
|
|
75
75
|
riskLevel: unclassifiedObjects.length >= 4 ? 'HIGH' : 'MEDIUM',
|
|
76
|
-
title: `${unclassifiedObjects.length} of ${CLASSIFICATION_OBJECTS.length} key object(s) have no data classification
|
|
76
|
+
title: `${unclassifiedObjects.length} of ${CLASSIFICATION_OBJECTS.length} key object(s) have no data classification: SBS-DATA-001/002`,
|
|
77
77
|
detail: `SBS-DATA-001 requires all data to be classified by sensitivity and SBS-DATA-002 requires PII to be identified. ${unclassifiedObjects.length} key object(s) have no fields with a Compliance Group set: ${unclassifiedObjects.join(', ')}. ${classifiedObjects.length > 0 ? `Objects with classification already configured: ${classifiedObjects.map((o) => `${o} (${classifiedMap.get(o)} field(s))`).join(', ')}.` : ''}`,
|
|
78
78
|
remediation: 'Enable and configure the Salesforce Data Classification feature in Setup → Data Management → Data Classification. Assign compliance groups (PII, PCI, HIPAA, GDPR, etc.) to sensitive fields on all objects that store personal or regulated data. Prioritise email, phone, address, financial, and health-related fields.',
|
|
79
79
|
affectedItems: unclassifiedObjects.map((name) => ({
|
|
80
80
|
label: name,
|
|
81
81
|
url: `${baseUrl}/lightning/setup/ObjectManager/${name}/FieldsAndRelationships/view`,
|
|
82
|
-
note: 'No fields classified
|
|
82
|
+
note: 'No fields classified: configure Compliance Group via Data Classification in Setup',
|
|
83
83
|
})),
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -91,7 +91,7 @@ export class DataClassificationCheck {
|
|
|
91
91
|
category: this.category,
|
|
92
92
|
riskLevel: 'LOW',
|
|
93
93
|
passed: true,
|
|
94
|
-
title: `Shield Platform Encryption active
|
|
94
|
+
title: `Shield Platform Encryption active: ${encryptionKeyCount} encryption key(s) found (SBS-DATA-003)`,
|
|
95
95
|
detail: `SBS-DATA-003 requires sensitive data to be encrypted at rest commensurate with its classification. ${encryptionKeyCount} Shield Platform Encryption key(s) are configured, indicating encryption-at-rest is in use.`,
|
|
96
96
|
remediation: 'Verify encryption is applied to all fields classified as sensitive or PII. Review the Encryption Statistics page in Setup → Security → Platform Encryption to confirm field-level coverage.',
|
|
97
97
|
});
|
|
@@ -101,7 +101,7 @@ export class DataClassificationCheck {
|
|
|
101
101
|
id: 'data-encryption-not-detected',
|
|
102
102
|
category: this.category,
|
|
103
103
|
riskLevel: 'MEDIUM',
|
|
104
|
-
title: 'Shield Platform Encryption not detected
|
|
104
|
+
title: 'Shield Platform Encryption not detected: SBS-DATA-003',
|
|
105
105
|
detail: 'SBS-DATA-003 requires data at rest to be encrypted in line with its assigned classification. No Shield Platform Encryption keys were found, indicating either Shield is not licensed or encryption has not been configured for this org.',
|
|
106
106
|
remediation: 'Evaluate Salesforce Shield Platform Encryption for fields classified as sensitive or PII. If Shield is not available in your edition, document the compensating control (e.g., Classic Encryption for specific fields, or infrastructure-level disk encryption), and assess whether it meets the intent of SBS-DATA-003.',
|
|
107
107
|
});
|
|
@@ -24,7 +24,7 @@ export class DebugLogAccessCheck {
|
|
|
24
24
|
category: this.category,
|
|
25
25
|
riskLevel: 'INFO',
|
|
26
26
|
inconclusive: true,
|
|
27
|
-
title: 'TraceFlag records could not be retrieved
|
|
27
|
+
title: 'TraceFlag records could not be retrieved: active debug traces cannot be verified',
|
|
28
28
|
detail: 'The TraceFlag object was not accessible. This may indicate the audit user lacks API access or the required permission to manage debug logs.',
|
|
29
29
|
remediation: 'Grant "Manage Users" or "View All Data" permission to the audit user, or review active debug traces manually in Setup → Debug Logs.',
|
|
30
30
|
affectedItems: [{ label: 'Debug Log Setup', url: setupUrl }],
|
|
@@ -51,12 +51,12 @@ export class DebugLogAccessCheck {
|
|
|
51
51
|
category: this.category,
|
|
52
52
|
riskLevel: 'HIGH',
|
|
53
53
|
title: `${userDebugTraces.length} active USER_DEBUG trace flag(s) are capturing all user activity`,
|
|
54
|
-
detail: `In production, active debug traces on users should be reviewed
|
|
54
|
+
detail: `In production, active debug traces on users should be reviewed: they capture sensitive field values and are accessible to administrators. USER_DEBUG traces record all DML operations, SOQL queries, and field values for the traced user, including data from sensitive objects such as financial records, PII, and health information. Debug logs are visible to any org admin and are not access-controlled at the record level.`,
|
|
55
55
|
remediation: 'Remove all USER_DEBUG trace flags that are not actively being used for an approved troubleshooting session. Establish a policy requiring trace flags to be removed within 24 hours of creation. Consider using a dedicated sandbox for debugging rather than production.',
|
|
56
56
|
affectedItems: userDebugTraces.map((t) => ({
|
|
57
57
|
label: t.TracedEntityId,
|
|
58
58
|
url: setupUrl,
|
|
59
|
-
note: `LogType: ${t.LogType}
|
|
59
|
+
note: `LogType: ${t.LogType} (expires: ${new Date(t.ExpirationDate).toISOString().split('T')[0]}, level: ${t.DebugLevel?.DeveloperName ?? 'unknown'})`,
|
|
60
60
|
})),
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -65,13 +65,13 @@ export class DebugLogAccessCheck {
|
|
|
65
65
|
id: 'debug-log-high-level',
|
|
66
66
|
category: this.category,
|
|
67
67
|
riskLevel: 'MEDIUM',
|
|
68
|
-
title: `${highDetailTraces.length} active trace flag(s) use FINE/FINER/FINEST log level
|
|
69
|
-
detail: `Active traces with ApexCode set to FINE, FINER, or FINEST capture the maximum level of detail, including all variable values at every line of code execution. This includes any field values read or written during the traced session, potentially exposing passwords, tokens, PII, and financial data in the debug log output. In production, active debug traces on users should be reviewed
|
|
68
|
+
title: `${highDetailTraces.length} active trace flag(s) use FINE/FINER/FINEST log level: all variable values are captured`,
|
|
69
|
+
detail: `Active traces with ApexCode set to FINE, FINER, or FINEST capture the maximum level of detail, including all variable values at every line of code execution. This includes any field values read or written during the traced session, potentially exposing passwords, tokens, PII, and financial data in the debug log output. In production, active debug traces on users should be reviewed: they capture sensitive field values and are accessible to administrators.`,
|
|
70
70
|
remediation: 'Reduce log levels to ERROR or WARN for any traces that must remain active. Remove high-detail traces immediately after the debugging session is complete. Never leave FINEST-level traces active in production for extended periods.',
|
|
71
71
|
affectedItems: highDetailTraces.map((t) => ({
|
|
72
72
|
label: t.TracedEntityId,
|
|
73
73
|
url: setupUrl,
|
|
74
|
-
note: `ApexCode level: ${t.DebugLevel?.ApexCode ?? 'unknown'}
|
|
74
|
+
note: `ApexCode level: ${t.DebugLevel?.ApexCode ?? 'unknown'} (expires: ${new Date(t.ExpirationDate).toISOString().split('T')[0]})`,
|
|
75
75
|
})),
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -27,13 +27,13 @@ export class DeploymentIdentityCheck {
|
|
|
27
27
|
category: this.category,
|
|
28
28
|
riskLevel: 'LOW',
|
|
29
29
|
passed: true,
|
|
30
|
-
title: `${ciCdApps.length} CI/CD-related Connected App(s) detected
|
|
30
|
+
title: `${ciCdApps.length} CI/CD-related Connected App(s) detected: pipeline deployment likely in use`,
|
|
31
31
|
detail: 'SBS-DEP-001 requires all deployments to be performed by a designated deployment identity, not individual admin accounts. Connected Apps with CI/CD tool names indicate pipeline-based deployments are in use, which is consistent with a controlled deployment process.',
|
|
32
32
|
remediation: 'Confirm each CI/CD app authenticates as a dedicated deployment service account (not a shared admin user). Document the deployment identity and its owner in the system of record.',
|
|
33
33
|
affectedItems: ciCdApps.map((name) => ({
|
|
34
34
|
label: name,
|
|
35
35
|
url: connectedAppsUrl,
|
|
36
|
-
note: 'CI/CD Connected App
|
|
36
|
+
note: 'CI/CD Connected App: verify it uses a named, dedicated deployment user',
|
|
37
37
|
})),
|
|
38
38
|
});
|
|
39
39
|
}
|
|
@@ -56,7 +56,7 @@ export class DeploymentIdentityCheck {
|
|
|
56
56
|
category: this.category,
|
|
57
57
|
riskLevel: 'MEDIUM',
|
|
58
58
|
inconclusive: true,
|
|
59
|
-
title: 'Deployment audit trail could not be read
|
|
59
|
+
title: 'Deployment audit trail could not be read: SBS-DEP-003 unverified',
|
|
60
60
|
detail: 'SetupAuditTrail was not accessible. Deployment activity from the past 90 days cannot be analyzed for unauthorized modifications. Without this data it is impossible to determine whether deployments are performed by a single designated identity.',
|
|
61
61
|
remediation: 'Grant "View Setup and Configuration" permission to the audit user to enable audit trail analysis.',
|
|
62
62
|
});
|
|
@@ -67,7 +67,7 @@ export class DeploymentIdentityCheck {
|
|
|
67
67
|
id: 'deployment-no-activity',
|
|
68
68
|
category: this.category,
|
|
69
69
|
riskLevel: 'INFO',
|
|
70
|
-
title: 'No deployment activity detected in the last 90 days
|
|
70
|
+
title: 'No deployment activity detected in the last 90 days: SBS-DEP-001/003',
|
|
71
71
|
detail: 'SBS-DEP-001 requires a designated deployment identity. No deployment-related SetupAuditTrail entries (Change Sets, Developer Tools, Packages, Metadata sections) and no CI/CD-named Connected Apps were found. Deployments via SF CLI JWT flow or Metadata API may not appear in the audit trail.',
|
|
72
72
|
remediation: 'Verify deployment processes are documented with a designated identity. If using SF CLI with JWT, confirm the authenticating user is a dedicated service account, not an individual admin.',
|
|
73
73
|
});
|
|
@@ -99,7 +99,7 @@ export class DeploymentIdentityCheck {
|
|
|
99
99
|
id: 'deployment-multiple-identities',
|
|
100
100
|
category: this.category,
|
|
101
101
|
riskLevel: uniqueDeployers.length > 3 ? 'HIGH' : 'MEDIUM',
|
|
102
|
-
title: `${uniqueDeployers.length} distinct user(s) performed deployment actions in the last 90 days
|
|
102
|
+
title: `${uniqueDeployers.length} distinct user(s) performed deployment actions in the last 90 days: SBS-DEP-001`,
|
|
103
103
|
detail: `SBS-DEP-001 requires all deployments to be performed by a single designated deployment identity, not individual user accounts. ${uniqueDeployers.length} distinct users were found in deployment-related audit trail entries (Change Sets, Developer Tools, Packages, Metadata) over the past 90 days. Multiple deployers make it harder to audit changes and bypass change-management controls.`,
|
|
104
104
|
remediation: 'Centralise deployments through a CI/CD pipeline that authenticates as a single named service account. Revoke direct deployment access from individual admin users.',
|
|
105
105
|
affectedItems: uniqueDeployers.map(({ username, profile, count, latest }) => ({
|
|
@@ -116,7 +116,7 @@ export class DeploymentIdentityCheck {
|
|
|
116
116
|
category: this.category,
|
|
117
117
|
riskLevel: 'LOW',
|
|
118
118
|
passed: true,
|
|
119
|
-
title: 'All deployment activity in the last 90 days came from a single identity
|
|
119
|
+
title: 'All deployment activity in the last 90 days came from a single identity: SBS-DEP-001',
|
|
120
120
|
detail: `SBS-DEP-001 requires a designated deployment identity. All ${deployRecords.length} deployment-related audit trail entries over 90 days originate from the same user: ${d.username} (${d.profile}).`,
|
|
121
121
|
remediation: 'Document this identity as the designated deployment user in your system of record. Verify it is a service account and not a personal admin account.',
|
|
122
122
|
});
|
|
@@ -127,13 +127,13 @@ export class DeploymentIdentityCheck {
|
|
|
127
127
|
id: 'deployment-admin-accounts',
|
|
128
128
|
category: this.category,
|
|
129
129
|
riskLevel: 'MEDIUM',
|
|
130
|
-
title: `${adminDeployers.length} deployer(s) are admin-profile users
|
|
130
|
+
title: `${adminDeployers.length} deployer(s) are admin-profile users: SBS-DEP-003`,
|
|
131
131
|
detail: 'SBS-DEP-003 requires monitoring for unauthorized deployment modifications. Deployments performed by administrator-profile users are harder to distinguish from emergency break-glass changes and are more likely to occur outside of a change-management window.',
|
|
132
132
|
remediation: 'Replace admin-user deployments with a CI/CD pipeline using a dedicated integration user with only deployment-required permissions. Reserve individual admin accounts for emergency use only, and document any emergency deployments in the system of record.',
|
|
133
133
|
affectedItems: adminDeployers.map(({ username, profile, count }) => ({
|
|
134
134
|
label: username,
|
|
135
135
|
url: auditUrl,
|
|
136
|
-
note: `${count} deployment action(s) | profile: ${profile}
|
|
136
|
+
note: `${count} deployment action(s) | profile: ${profile} | replace with dedicated deployment service account`,
|
|
137
137
|
})),
|
|
138
138
|
});
|
|
139
139
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
export declare class EmailSecurityCheck implements SecurityCheck {
|
|
4
|
+
readonly id = "email-security";
|
|
5
|
+
readonly name = "Email Security & Spoofing";
|
|
6
|
+
readonly category = "External Connectivity";
|
|
7
|
+
readonly description = "Flags inbound email services that accept mail from any sender or run Apex without authentication, and org-wide send-as addresses available to every profile";
|
|
8
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=EmailSecurityCheck.d.ts.map
|