@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.
Files changed (133) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +168 -38
  3. package/lib/chains/namedChains.js +4 -4
  4. package/lib/checks/CheckEngine.js +1 -1
  5. package/lib/checks/impl/AnonymousApexAuditCheck.js +5 -5
  6. package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
  7. package/lib/checks/impl/ApexCrudFLSCheck.js +4 -4
  8. package/lib/checks/impl/ApexLoggingCheck.js +10 -10
  9. package/lib/checks/impl/ApexRestEndpointCheck.js +5 -5
  10. package/lib/checks/impl/ApexSharingCheck.js +3 -3
  11. package/lib/checks/impl/ApiClientPermissionCheck.js +2 -2
  12. package/lib/checks/impl/CertificateExpiryCheck.js +1 -1
  13. package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
  14. package/lib/checks/impl/ConnectedAppInactivityCheck.js +5 -5
  15. package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
  16. package/lib/checks/impl/ConnectedAppScopeCheck.js +4 -4
  17. package/lib/checks/impl/ConnectedAppsCheck.js +2 -2
  18. package/lib/checks/impl/ContentLinksCheck.js +6 -6
  19. package/lib/checks/impl/CorsAllowlistCheck.js +3 -3
  20. package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
  21. package/lib/checks/impl/CustomLabelsCredentialCheck.js +7 -7
  22. package/lib/checks/impl/DataClassificationCheck.js +6 -6
  23. package/lib/checks/impl/DebugLogAccessCheck.js +6 -6
  24. package/lib/checks/impl/DeploymentIdentityCheck.js +8 -8
  25. package/lib/checks/impl/EmailSecurityCheck.d.ts +10 -0
  26. package/lib/checks/impl/EmailSecurityCheck.js +117 -0
  27. package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
  28. package/lib/checks/impl/EnhancedDomainsCheck.js +6 -6
  29. package/lib/checks/impl/EscalationPermsCheck.js +2 -2
  30. package/lib/checks/impl/EventMonitoringCheck.js +6 -6
  31. package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
  32. package/lib/checks/impl/FailedLoginCheck.js +5 -5
  33. package/lib/checks/impl/FieldHistoryTrackingCheck.js +3 -3
  34. package/lib/checks/impl/FieldLevelSecurityCheck.js +2 -2
  35. package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
  36. package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
  37. package/lib/checks/impl/GuestUserAccessCheck.js +5 -5
  38. package/lib/checks/impl/HealthCheckCheck.js +2 -2
  39. package/lib/checks/impl/HighAssuranceSessionCheck.js +4 -4
  40. package/lib/checks/impl/InstalledPackagesCheck.js +5 -5
  41. package/lib/checks/impl/IntegrationUsersCheck.js +5 -5
  42. package/lib/checks/impl/InternalUserMfaCheck.js +2 -2
  43. package/lib/checks/impl/IpRestrictionsCheck.js +3 -3
  44. package/lib/checks/impl/LegacyApiVersionCheck.js +1 -1
  45. package/lib/checks/impl/MfaEnforcementCheck.js +3 -3
  46. package/lib/checks/impl/MfaMethodStrengthCheck.js +3 -3
  47. package/lib/checks/impl/MfaRegistrationCheck.js +2 -2
  48. package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
  49. package/lib/checks/impl/MyDomainLoginPolicyCheck.js +9 -9
  50. package/lib/checks/impl/NamedCredentialsCheck.js +3 -3
  51. package/lib/checks/impl/OutboundMessagesCheck.d.ts +10 -0
  52. package/lib/checks/impl/OutboundMessagesCheck.js +88 -0
  53. package/lib/checks/impl/PasswordSessionPolicyCheck.js +3 -3
  54. package/lib/checks/impl/PermissionsCheck.js +3 -3
  55. package/lib/checks/impl/PrivilegedAccessCheck.d.ts +11 -0
  56. package/lib/checks/impl/PrivilegedAccessCheck.js +111 -0
  57. package/lib/checks/impl/PublicContentExposureCheck.d.ts +10 -0
  58. package/lib/checks/impl/PublicContentExposureCheck.js +98 -0
  59. package/lib/checks/impl/PublicGroupSharingCheck.js +1 -1
  60. package/lib/checks/impl/ReleaseUpdatesCheck.js +2 -2
  61. package/lib/checks/impl/RemoteSitesCheck.js +1 -1
  62. package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
  63. package/lib/checks/impl/ReportFolderAccessCheck.js +4 -4
  64. package/lib/checks/impl/ScheduledApexCheck.js +1 -1
  65. package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +11 -0
  66. package/lib/checks/impl/SeparationOfDutiesCheck.js +114 -0
  67. package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
  68. package/lib/checks/impl/SharingModelCheck.js +8 -8
  69. package/lib/checks/impl/SiemIntegrationCheck.js +4 -4
  70. package/lib/checks/impl/SsoEnforcementCheck.js +5 -5
  71. package/lib/checks/impl/StandardProfilesCheck.js +2 -2
  72. package/lib/checks/impl/TransactionSecurityPolicyCheck.js +2 -2
  73. package/lib/checks/impl/TrustedIPRangesCheck.js +5 -5
  74. package/lib/checks/impl/VisualforceXssCheck.js +6 -6
  75. package/lib/checks/permCatalog.d.ts +15 -0
  76. package/lib/checks/permCatalog.js +42 -0
  77. package/lib/checks/registry.js +12 -0
  78. package/lib/commands/audit/diff.js +1 -1
  79. package/lib/commands/audit/security.d.ts +5 -0
  80. package/lib/commands/audit/security.js +33 -4
  81. package/lib/compliance/catalogs/hiso10029.d.ts +3 -0
  82. package/lib/compliance/catalogs/hiso10029.js +35 -0
  83. package/lib/compliance/catalogs/index.d.ts +4 -0
  84. package/lib/compliance/catalogs/index.js +21 -0
  85. package/lib/compliance/catalogs/iso27001.d.ts +3 -0
  86. package/lib/compliance/catalogs/iso27001.js +39 -0
  87. package/lib/compliance/catalogs/nzism.d.ts +3 -0
  88. package/lib/compliance/catalogs/nzism.js +31 -0
  89. package/lib/compliance/catalogs/owasp.d.ts +3 -0
  90. package/lib/compliance/catalogs/owasp.js +37 -0
  91. package/lib/compliance/catalogs/privacyAct.d.ts +3 -0
  92. package/lib/compliance/catalogs/privacyAct.js +17 -0
  93. package/lib/compliance/catalogs/sbs.d.ts +3 -0
  94. package/lib/compliance/catalogs/sbs.js +61 -0
  95. package/lib/compliance/catalogs/soc2.d.ts +3 -0
  96. package/lib/compliance/catalogs/soc2.js +42 -0
  97. package/lib/compliance/mapping.d.ts +2 -0
  98. package/lib/compliance/mapping.js +118 -0
  99. package/lib/compliance/resolve.d.ts +12 -0
  100. package/lib/compliance/resolve.js +49 -0
  101. package/lib/compliance/types.d.ts +13 -0
  102. package/lib/compliance/types.js +2 -0
  103. package/lib/context/AuditCache.d.ts +9 -0
  104. package/lib/findings/CheckMeta.d.ts +9 -0
  105. package/lib/findings/CheckMeta.js +72 -0
  106. package/lib/renderers/AuditRenderer.d.ts +2 -0
  107. package/lib/renderers/ClientReportRenderer.d.ts +29 -0
  108. package/lib/renderers/ClientReportRenderer.js +205 -0
  109. package/lib/renderers/DiffHtmlRenderer.js +1 -1
  110. package/lib/renderers/HistoryRenderer.js +1 -1
  111. package/lib/renderers/HtmlRenderer.js +4 -10
  112. package/lib/renderers/MarkdownRenderer.js +2 -2
  113. package/lib/renderers/html-utils.d.ts +2 -0
  114. package/lib/renderers/html-utils.js +8 -0
  115. package/lib/report/ComplianceMatrix.d.ts +19 -0
  116. package/lib/report/ComplianceMatrix.js +47 -0
  117. package/lib/report/ExecutivePriorities.d.ts +8 -0
  118. package/lib/report/ExecutivePriorities.js +22 -0
  119. package/lib/report/RemediationRoadmap.d.ts +9 -0
  120. package/lib/report/RemediationRoadmap.js +18 -0
  121. package/lib/report/branding.d.ts +18 -0
  122. package/lib/report/branding.js +19 -0
  123. package/lib/report/fonts.d.ts +2 -0
  124. package/lib/report/fonts.js +22 -0
  125. package/messages/audit.security.md +30 -2
  126. package/package.json +3 -1
  127. package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
  128. package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
  129. package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
  130. package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
  131. package/config/queries/soql.json +0 -24
  132. package/config/queries/tooling.json +0 -28
  133. package/config/scoring.json +0 -17
@@ -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 — 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.',
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 };
@@ -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 — SBS-AUTH-004 not applicable',
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 — SBS-AUTH-004`,
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} — assign MFA permission set`,
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 — MfaRegistrationCheck must run first',
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} — methods: ${u.methods.join(', ') || 'none'}`,
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} — methods: ${u.methods.join(', ') || 'none'}`,
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 — MFA registration status cannot be verified',
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 — ${registeredCount} registered — ${unregisteredCount} unregistered`,
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 \u2014 stops SSO bypass";
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 — stops SSO bypass';
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 — required for SSO enforcement' }],
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 — My Domain login policy unverified',
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 — SSO not enforced',
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 — disable password login to enforce SSO',
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 — 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.`,
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 — password login disabled',
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 — AuthConfig not accessible',
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} — verify if still required, delete if orphaned`,
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} — migrate to HTTPS`,
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} — verify that no authentication is required`,
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} — update in Setup → Password Policies`,
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} — update in Setup → Session Settings`,
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} — enable MFA in Setup → Identity → Multi-Factor Authentication`,
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.',
@@ -75,7 +75,7 @@ export class PermissionsCheck {
75
75
  riskLevel: 'INFO',
76
76
  inconclusive: true,
77
77
  title: 'Unassigned permission set check could not be completed',
78
- detail: 'The semi-join query to identify unassigned permission sets failed — this can occur in orgs with very large numbers of permission set assignments (governor limit on semi-join subqueries). Review orphaned permission sets manually.',
78
+ detail: 'The semi-join query to identify unassigned permission sets failed. This can occur in orgs with very large numbers of permission set assignments (governor limit on semi-join subqueries). Review orphaned permission sets manually.',
79
79
  remediation: 'In Setup → Permission Sets, sort by Last Modified and review sets that appear to have no user assignments.',
80
80
  });
81
81
  }
@@ -112,12 +112,12 @@ export class PermissionsCheck {
112
112
  ...profileGrantors.map((r) => ({
113
113
  label: r.Name,
114
114
  url: `${baseUrl}/${r.Id}`,
115
- note: 'Granted via Profile — prefer moving to a permission set for finer control',
115
+ note: 'Granted via Profile: prefer moving to a permission set for finer control',
116
116
  })),
117
117
  ...psGrantors.map((r) => ({
118
118
  label: r.Name,
119
119
  url: `${baseUrl}/${r.Id}`,
120
- note: 'Permission Set — document justification in system of record',
120
+ note: 'Permission Set: document justification in system of record',
121
121
  })),
122
122
  ],
123
123
  });
@@ -0,0 +1,11 @@
1
+ import type { AuditContext } from '../../context/AuditContext.js';
2
+ import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
3
+ export declare class PrivilegedAccessCheck implements SecurityCheck {
4
+ readonly id = "privileged-access";
5
+ readonly name = "Privileged Access & Shadow Admins";
6
+ readonly category = "Permissions";
7
+ readonly description = "Resolves each active user's effective high-risk permissions (profile + permission sets + groups) and flags admin-equivalent users who are not on the System Administrator profile";
8
+ readonly populatesCache: readonly ["effectivePermissions"];
9
+ run(ctx: AuditContext): Promise<CheckResult>;
10
+ }
11
+ //# sourceMappingURL=PrivilegedAccessCheck.d.ts.map
@@ -0,0 +1,111 @@
1
+ import { DANGEROUS_PERMS } from '../permCatalog.js';
2
+ const ADMIN_PROFILE = 'System Administrator';
3
+ /** Admin-equivalent = holds Modify All Data, OR can self-escalate to it (Manage Users + Assign Permission Sets). */
4
+ function isAdminEquivalent(perms) {
5
+ return perms.has('ModifyAllData') || (perms.has('ManageUsers') && perms.has('AssignPermissionSets'));
6
+ }
7
+ export class PrivilegedAccessCheck {
8
+ id = 'privileged-access';
9
+ name = 'Privileged Access & Shadow Admins';
10
+ category = 'Permissions';
11
+ description = 'Resolves each active user\'s effective high-risk permissions (profile + permission sets + groups) and flags admin-equivalent users who are not on the System Administrator profile';
12
+ populatesCache = ['effectivePermissions'];
13
+ async run(ctx) {
14
+ const findings = [];
15
+ const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/ManageUsers/home`;
16
+ const permFields = DANGEROUS_PERMS.map((p) => `PermissionSet.${p.field}`).join(', ');
17
+ const permWhere = DANGEROUS_PERMS.map((p) => `PermissionSet.${p.field} = true`).join(' OR ');
18
+ let rows;
19
+ try {
20
+ rows = await ctx.soql.queryAll(`SELECT AssigneeId, Assignee.Username, Assignee.Name, Assignee.Profile.Name, ${permFields}
21
+ FROM PermissionSetAssignment
22
+ WHERE (${permWhere}) AND Assignee.IsActive = true`);
23
+ }
24
+ catch (err) {
25
+ const msg = err instanceof Error ? err.message : String(err);
26
+ findings.push({
27
+ id: 'privileged-access-inaccessible',
28
+ category: this.category,
29
+ riskLevel: 'INFO',
30
+ inconclusive: true,
31
+ title: 'Effective-permission resolution could not be completed',
32
+ detail: `The PermissionSetAssignment query was not accessible: ${msg}`,
33
+ remediation: 'Grant the audit user "View Setup and Configuration" and "View All Users", then re-run the audit.',
34
+ });
35
+ return { findings };
36
+ }
37
+ // Aggregate per user: a user's effective high-risk permissions are the union across
38
+ // all of their PermissionSetAssignment rows (profile permset + permsets + PSG aggregate).
39
+ const byUser = new Map();
40
+ for (const row of rows) {
41
+ const ps = row.PermissionSet ?? {};
42
+ const held = DANGEROUS_PERMS.filter((p) => ps[p.field]).map((p) => p.key);
43
+ if (held.length === 0)
44
+ continue;
45
+ let g = byUser.get(row.AssigneeId);
46
+ if (!g) {
47
+ g = {
48
+ userId: row.AssigneeId,
49
+ username: row.Assignee?.Username ?? row.AssigneeId,
50
+ name: row.Assignee?.Name ?? row.Assignee?.Username ?? row.AssigneeId,
51
+ profileName: row.Assignee?.Profile?.Name ?? 'Unknown',
52
+ perms: [],
53
+ };
54
+ byUser.set(row.AssigneeId, g);
55
+ }
56
+ for (const k of held)
57
+ if (!g.perms.includes(k))
58
+ g.perms.push(k);
59
+ }
60
+ const grants = [...byUser.values()];
61
+ ctx.cache.effectivePermissions = grants;
62
+ const shadowAdmins = grants.filter((g) => g.profileName !== ADMIN_PROFILE && isAdminEquivalent(new Set(g.perms)));
63
+ if (shadowAdmins.length > 0) {
64
+ findings.push({
65
+ id: 'privileged-access-shadow-admins',
66
+ category: this.category,
67
+ riskLevel: 'CRITICAL',
68
+ title: `${shadowAdmins.length} user(s) hold admin-equivalent access without the System Administrator profile`,
69
+ detail: 'These active users have accumulated effective permissions equivalent to a System Administrator (either "Modify All Data" directly, or "Manage Users" combined with "Assign Permission Sets", which lets them grant themselves anything) but sit on a different profile. Such "shadow admins" are easy to miss in profile-based reviews, yet a takeover of any one grants full org control. The access is reached via the user\'s profile, assigned permission sets, or permission set groups combined.',
70
+ remediation: 'Review each user\'s permission sets and profile. Remove "Modify All Data" / the Manage Users + Assign Permission Sets pairing unless the role genuinely requires org administration, and consolidate true admins onto a controlled admin profile.',
71
+ affectedItems: shadowAdmins.map((g) => ({
72
+ label: g.username,
73
+ url: setupUrl,
74
+ note: `Profile: ${g.profileName}, effective: ${g.perms.join(', ')}`,
75
+ })),
76
+ });
77
+ }
78
+ else {
79
+ findings.push({
80
+ id: 'privileged-access-no-shadow-admins',
81
+ category: this.category,
82
+ riskLevel: 'LOW',
83
+ passed: true,
84
+ title: 'No shadow admins detected',
85
+ detail: 'No active user holds admin-equivalent effective permissions outside the System Administrator profile.',
86
+ remediation: 'Continue to keep administrative permissions on a controlled admin profile.',
87
+ });
88
+ }
89
+ // Informational inventory of privileged users (does not affect the grade beyond the above).
90
+ if (grants.length > 0) {
91
+ findings.push({
92
+ id: 'privileged-access-inventory',
93
+ category: this.category,
94
+ riskLevel: 'INFO',
95
+ title: `${grants.length} active user(s) hold at least one high-risk permission`,
96
+ detail: 'Inventory of active users whose effective permissions include one or more catalogued high-risk permissions. Use this as the privileged-access baseline for least-privilege review.',
97
+ remediation: 'Periodically confirm each privileged user still requires their high-risk permissions; remove any that are no longer needed.',
98
+ affectedItems: grants
99
+ .slice()
100
+ .sort((a, b) => b.perms.length - a.perms.length)
101
+ .map((g) => ({
102
+ label: g.username,
103
+ url: setupUrl,
104
+ note: `Profile: ${g.profileName}, ${g.perms.length} high-risk perm(s): ${g.perms.join(', ')}`,
105
+ })),
106
+ });
107
+ }
108
+ return { findings };
109
+ }
110
+ }
111
+ //# sourceMappingURL=PrivilegedAccessCheck.js.map
@@ -0,0 +1,10 @@
1
+ import type { AuditContext } from '../../context/AuditContext.js';
2
+ import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
3
+ export declare class PublicContentExposureCheck implements SecurityCheck {
4
+ readonly id = "public-content-exposure";
5
+ readonly name = "Public Static Resources & Documents";
6
+ readonly category = "File Security";
7
+ readonly description = "Flags Documents marked externally available (retrievable without authentication) and static resources cached publicly";
8
+ run(ctx: AuditContext): Promise<CheckResult>;
9
+ }
10
+ //# sourceMappingURL=PublicContentExposureCheck.d.ts.map
@@ -0,0 +1,98 @@
1
+ export class PublicContentExposureCheck {
2
+ id = 'public-content-exposure';
3
+ name = 'Public Static Resources & Documents';
4
+ category = 'File Security';
5
+ description = 'Flags Documents marked externally available (retrievable without authentication) and static resources cached publicly';
6
+ async run(ctx) {
7
+ const findings = [];
8
+ const baseUrl = ctx.orgInfo.instanceUrl;
9
+ const docUrl = `${baseUrl}/lightning/setup/DocumentManagement/home`;
10
+ const resUrl = `${baseUrl}/lightning/setup/StaticResources/home`;
11
+ // 1. Documents flagged "Externally Available Image" (IsPublic) — anonymous URL access.
12
+ try {
13
+ const docs = await ctx.soql.queryAll('SELECT Id, Name, IsPublic, Folder.Name FROM Document WHERE IsPublic = true');
14
+ if (docs.length > 0) {
15
+ findings.push({
16
+ id: 'public-content-public-documents',
17
+ category: this.category,
18
+ riskLevel: 'HIGH',
19
+ title: `${docs.length} Document(s) are marked externally available (public)`,
20
+ detail: 'A Document with "Externally Available Image" enabled is served from a stable, guessable URL with no authentication. Anyone who obtains or guesses the URL (including search-engine crawlers) can download the file. Documents are frequently used to store images, but also exported reports, spreadsheets, and other data that should not be world-readable.',
21
+ remediation: 'Review each public Document and clear "Externally Available Image" unless the file is genuinely intended for anonymous access. Move sensitive files to authenticated storage (Files/ContentVersion).',
22
+ affectedItems: docs.map((d) => ({
23
+ label: d.Name,
24
+ url: docUrl,
25
+ note: `Folder: ${d.Folder?.Name ?? 'unknown'}: clear "Externally Available Image" if not intended`,
26
+ })),
27
+ });
28
+ }
29
+ else {
30
+ findings.push({
31
+ id: 'public-content-documents-ok',
32
+ category: this.category,
33
+ riskLevel: 'LOW',
34
+ passed: true,
35
+ title: 'No externally available Documents found',
36
+ detail: 'No Document is marked "Externally Available Image", so none are retrievable without authentication.',
37
+ remediation: 'Continue to keep Documents private unless anonymous access is explicitly required.',
38
+ });
39
+ }
40
+ }
41
+ catch (err) {
42
+ const msg = err instanceof Error ? err.message : String(err);
43
+ findings.push({
44
+ id: 'public-content-documents-inaccessible',
45
+ category: this.category,
46
+ riskLevel: 'INFO',
47
+ inconclusive: true,
48
+ title: 'Public Documents could not be read',
49
+ detail: `The Document query was not accessible: ${msg}`,
50
+ remediation: 'Grant the audit user read access to Documents, then re-run the audit.',
51
+ });
52
+ }
53
+ // 2. Static resources with public cache control — cacheable by shared/CDN caches.
54
+ try {
55
+ const resources = await ctx.tooling.query("SELECT Id, Name, CacheControl, ContentType FROM StaticResource WHERE CacheControl = 'Public'");
56
+ if (resources.length > 0) {
57
+ findings.push({
58
+ id: 'public-content-public-static-resources',
59
+ category: this.category,
60
+ riskLevel: 'MEDIUM',
61
+ title: `${resources.length} static resource(s) use Public cache control`,
62
+ detail: 'A static resource set to "Public" cache control is served with caching headers that allow shared and CDN caches to store it, and it is reachable by guest users on Experience Cloud sites. Static resources commonly bundle JavaScript, config, and occasionally secrets (API keys, endpoints); a Public resource widens who can retrieve those contents.',
63
+ remediation: 'Set cache control to "Private" for any static resource that is not deliberately public, and remove embedded secrets from static resource contents.',
64
+ affectedItems: resources.map((r) => ({
65
+ label: r.Name,
66
+ url: resUrl,
67
+ note: `${r.ContentType ?? 'unknown type'}: set cache control to Private if not intentionally public`,
68
+ })),
69
+ });
70
+ }
71
+ else {
72
+ findings.push({
73
+ id: 'public-content-static-resources-ok',
74
+ category: this.category,
75
+ riskLevel: 'LOW',
76
+ passed: true,
77
+ title: 'No static resources use Public cache control',
78
+ detail: 'All static resources use Private cache control or none exist.',
79
+ remediation: 'Continue to keep static resources Private unless public delivery is required.',
80
+ });
81
+ }
82
+ }
83
+ catch (err) {
84
+ const msg = err instanceof Error ? err.message : String(err);
85
+ findings.push({
86
+ id: 'public-content-static-resources-inaccessible',
87
+ category: this.category,
88
+ riskLevel: 'INFO',
89
+ inconclusive: true,
90
+ title: 'Static resource cache settings could not be read',
91
+ detail: `The StaticResource Tooling query was not accessible: ${msg}`,
92
+ remediation: 'Grant the audit user "View Setup and Configuration", then re-run the audit.',
93
+ });
94
+ }
95
+ return { findings };
96
+ }
97
+ }
98
+ //# sourceMappingURL=PublicContentExposureCheck.js.map
@@ -58,7 +58,7 @@ export class PublicGroupSharingCheck {
58
58
  affectedItems: exposures.map((e) => ({
59
59
  label: `${e.shareTable} → ${e.groupName}`,
60
60
  url: sharingRulesUrl,
61
- note: `${e.count} sharing rule(s) — replace with targeted group or role-based sharing`,
61
+ note: `${e.count} sharing rule(s): replace with targeted group or role-based sharing`,
62
62
  })),
63
63
  detail: 'Sharing rules targeting "All Internal Users" expose records to every active internal user in the org.',
64
64
  remediation: 'Replace "All Internal Users" sharing rules with more targeted public groups or role-based sharing.',
@@ -18,7 +18,7 @@ export class ReleaseUpdatesCheck {
18
18
  riskLevel: 'INFO',
19
19
  inconclusive: true,
20
20
  title: 'Pending release updates check could not be completed',
21
- detail: 'The CriticalUpdate Tooling API object was not accessible — this can occur if the audit user lacks the "Customize Application" permission or if the org is on a restricted edition.',
21
+ detail: 'The CriticalUpdate Tooling API object was not accessible. This can occur if the audit user lacks the "Customize Application" permission or if the org is on a restricted edition.',
22
22
  remediation: 'Review pending Release Updates manually in Setup → Release Updates.',
23
23
  });
24
24
  return { findings };
@@ -61,7 +61,7 @@ export class ReleaseUpdatesCheck {
61
61
  category: this.category,
62
62
  riskLevel: 'HIGH',
63
63
  title: `${overdueUpdates.length} release update(s) are past their auto-activation date and still not enabled`,
64
- detail: 'These updates were scheduled for automatic activation by Salesforce but remain disabled. Running without them may leave the org exposed to security issues or deprecated behaviors that Salesforce has already addressed. In some cases Salesforce may have already force-activated them — verify current status in Setup.',
64
+ detail: 'These updates were scheduled for automatic activation by Salesforce but remain disabled. Running without them may leave the org exposed to security issues or deprecated behaviors that Salesforce has already addressed. In some cases Salesforce may have already force-activated them. Verify current status in Setup.',
65
65
  remediation: 'Enable these updates immediately in Setup → Release Updates. Test each one in a sandbox first. Check whether Salesforce has already force-activated any of these entries, in which case they may already be enforced despite showing as disabled.',
66
66
  affectedItems: overdueUpdates.map((u) => ({
67
67
  label: u.Name,
@@ -27,7 +27,7 @@ export class RemoteSitesCheck {
27
27
  affectedItems: insecureSites.map((r) => ({
28
28
  label: r.SiteName,
29
29
  url: setupUrl,
30
- note: `${r.EndpointUrl} — enable HTTPS and re-enable protocol security`,
30
+ note: `${r.EndpointUrl}: enable HTTPS and re-enable protocol security`,
31
31
  })),
32
32
  });
33
33
  }