@cclabsnz/sf-audit 1.8.1 → 1.9.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/CHANGELOG.md +199 -0
- package/README.md +138 -758
- package/lib/chains/CapabilityRegistry.d.ts +6 -2
- package/lib/chains/CapabilityRegistry.js +48 -2
- package/lib/chains/namedChains.js +140 -7
- package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +1 -1
- package/lib/checks/impl/AgentChannelExposureCheck.d.ts +1 -1
- package/lib/checks/impl/AgentChannelExposureCheck.js +52 -10
- package/lib/checks/impl/AgentInventoryCheck.d.ts +1 -1
- package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +1 -1
- package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.js +3 -3
- package/lib/checks/impl/ApexLoggingCheck.d.ts +1 -1
- package/lib/checks/impl/ApexRestEndpointCheck.d.ts +1 -1
- package/lib/checks/impl/ApexRestEndpointCheck.js +0 -3
- package/lib/checks/impl/ApexSharingCheck.d.ts +1 -1
- package/lib/checks/impl/CodeSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppsCheck.d.ts +1 -1
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -1
- package/lib/checks/impl/CustomLabelsCredentialCheck.js +1 -1
- package/lib/checks/impl/DataClassificationCheck.js +15 -1
- package/lib/checks/impl/DeploymentIdentityCheck.d.ts +1 -1
- package/lib/checks/impl/EventMonitoringCheck.d.ts +1 -1
- package/lib/checks/impl/FailedLoginCheck.js +16 -1
- package/lib/checks/impl/FieldLevelSecurityCheck.js +29 -16
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +1 -1
- package/lib/checks/impl/GuestUserAccessCheck.d.ts +1 -1
- package/lib/checks/impl/GuestUserVisibilityCheck.d.ts +35 -0
- package/lib/checks/impl/GuestUserVisibilityCheck.js +168 -0
- package/lib/checks/impl/HardcodedCredentialsCheck.d.ts +2 -2
- package/lib/checks/impl/HardcodedCredentialsCheck.js +0 -1
- package/lib/checks/impl/HealthCheckCheck.d.ts +1 -1
- package/lib/checks/impl/HealthCheckCheck.js +1 -3
- package/lib/checks/impl/IntegrationLeastPrivilegeCheck.d.ts +42 -0
- package/lib/checks/impl/IntegrationLeastPrivilegeCheck.js +467 -0
- package/lib/checks/impl/IntegrationUsersCheck.js +48 -52
- package/lib/checks/impl/InternalUserMfaCheck.js +0 -1
- package/lib/checks/impl/IpRestrictionsCheck.js +39 -5
- package/lib/checks/impl/MfaMethodStrengthCheck.d.ts +1 -1
- package/lib/checks/impl/MfaRegistrationCheck.d.ts +1 -1
- package/lib/checks/impl/NamedCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/PrivilegedAccessCheck.d.ts +1 -1
- package/lib/checks/impl/PublicGroupSharingCheck.d.ts +1 -1
- package/lib/checks/impl/PublicGroupSharingCheck.js +21 -2
- package/lib/checks/impl/RemoteSitesCheck.d.ts +1 -1
- package/lib/checks/impl/ScheduledApexCheck.d.ts +1 -1
- package/lib/checks/impl/ScheduledApexCheck.js +0 -1
- package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +1 -1
- package/lib/checks/impl/SessionHardeningCheck.d.ts +1 -1
- package/lib/checks/impl/SiemIntegrationCheck.d.ts +1 -1
- package/lib/checks/impl/SoapLoginApiAuthCheck.d.ts +10 -0
- package/lib/checks/impl/SoapLoginApiAuthCheck.js +151 -0
- package/lib/checks/impl/SsoEnforcementCheck.js +0 -1
- package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +1 -1
- package/lib/checks/impl/TrustedUrlHygieneCheck.js +3 -1
- package/lib/checks/impl/VisualforceXssCheck.d.ts +1 -1
- package/lib/checks/registry.js +4 -0
- package/lib/checks/support/integrationAccounts.d.ts +35 -0
- package/lib/checks/support/integrationAccounts.js +209 -0
- package/lib/commands/audit/security.d.ts +12 -1
- package/lib/commands/audit/security.js +32 -9
- package/lib/compliance/catalogs/gdpr.d.ts +3 -0
- package/lib/compliance/catalogs/gdpr.js +54 -0
- package/lib/compliance/catalogs/hipaa.d.ts +3 -0
- package/lib/compliance/catalogs/hipaa.js +97 -0
- package/lib/compliance/catalogs/index.js +4 -0
- package/lib/compliance/mapping.js +111 -36
- package/lib/findings/CheckMeta.js +2 -0
- package/lib/findings/exitCode.d.ts +28 -0
- package/lib/findings/exitCode.js +46 -0
- package/lib/findings/loadScoringConfig.js +5 -5
- package/lib/renderers/HtmlRenderer.js +1 -1
- package/messages/audit.security.md +6 -0
- package/package.json +16 -11
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Maps each check id to the compliance control ids it relates to.
|
|
2
|
-
// Migrated from the former ComplianceMapping.
|
|
3
|
-
// until their catalogs land (later plan). A08/A10 are mapped precisely:
|
|
2
|
+
// Migrated from the former ComplianceMapping. A08/A10 are mapped precisely:
|
|
4
3
|
// A10 (SSRF) → egress controls (remote-sites, csp-trusted-sites, named-credentials)
|
|
5
4
|
// A08 (Software & Data Integrity) → installed-packages, deployment-identity
|
|
6
5
|
// NZ pack control ids (HISO/NZISM/Privacy Act) are layered on by domain via NZ_CROSSWALK below.
|
|
@@ -33,6 +32,7 @@ const BASE_CHECK_CONTROL_MAP = {
|
|
|
33
32
|
'mfa-enforcement': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-004'],
|
|
34
33
|
'api-client-permission': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.8.3', 'SBS-ACS-006'],
|
|
35
34
|
'integration-users': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-007', 'SBS-ACS-008', 'SBS-ACS-009'],
|
|
35
|
+
'integration-least-privilege': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-008', 'SBS-ACS-009'],
|
|
36
36
|
'content-links': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.14', 'SBS-FILE-001', 'SBS-FILE-002', 'SBS-FILE-003'],
|
|
37
37
|
'field-history-tracking': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-DATA-004'],
|
|
38
38
|
'data-classification': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.12', 'SBS-DATA-001', 'SBS-DATA-002'],
|
|
@@ -81,6 +81,7 @@ const BASE_CHECK_CONTROL_MAP = {
|
|
|
81
81
|
'classic-sites': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-003'],
|
|
82
82
|
'auth-providers': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-001'],
|
|
83
83
|
'guest-api-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
|
|
84
|
+
'guest-user-visibility': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
|
|
84
85
|
'external-credentials': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.3', 'SBS-INT-003'],
|
|
85
86
|
'login-anomaly': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003'],
|
|
86
87
|
'session-hardening': ['OWASP-A05', 'SOC2-CC6.1', 'ISO-A.8.26'],
|
|
@@ -107,50 +108,124 @@ const BASE_CHECK_CONTROL_MAP = {
|
|
|
107
108
|
'agent-monitoring-coverage': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'LLM02'],
|
|
108
109
|
'trusted-url-hygiene': ['OWASP-A05', 'OWASP-A10', 'SOC2-CC6.6', 'ISO-A.8.26', 'LLM01', 'LLM05'],
|
|
109
110
|
};
|
|
110
|
-
//
|
|
111
|
-
// layered onto
|
|
112
|
-
//
|
|
111
|
+
// Domain groupings. Each check belongs to exactly one domain, and a domain's control ids are
|
|
112
|
+
// layered onto every base entry in it. Shared by the NZ pack and the HIPAA/GDPR crosswalk below
|
|
113
|
+
// so the two cannot drift apart in which checks they consider part of a domain.
|
|
114
|
+
const DOMAIN = {
|
|
115
|
+
accessControl: ['users-and-admins', 'permissions', 'sharing-model', 'public-group-sharing', 'guest-user-access',
|
|
116
|
+
'field-level-security', 'standard-profiles', 'api-client-permission', 'integration-users',
|
|
117
|
+
'integration-least-privilege',
|
|
118
|
+
'escalation-perms', 'report-folder-access', 'apex-crud-fls', 'apex-rest-endpoint',
|
|
119
|
+
'guest-executable-apex', 'experience-cloud-site', 'content-links', 'apex-sharing', 'flows-without-sharing',
|
|
120
|
+
'public-content-exposure', 'privileged-access', 'separation-of-duties',
|
|
121
|
+
'guest-object-exposure', 'guest-site-options', 'guest-record-access-policy',
|
|
122
|
+
'login-access-policy', 'data-export-access', 'classic-sites', 'guest-api-access',
|
|
123
|
+
'guest-user-visibility'],
|
|
124
|
+
authentication: ['login-session', 'ip-restrictions', 'password-session-policy', 'sso-enforcement', 'mfa-enforcement',
|
|
125
|
+
'trusted-ip-ranges', 'my-domain-login-policy', 'high-assurance-session', 'internal-user-mfa',
|
|
126
|
+
'mfa-registration', 'mfa-method-strength', 'failed-login-detection', 'enhanced-domains',
|
|
127
|
+
'auth-providers'],
|
|
128
|
+
crypto: ['named-credentials', 'hardcoded-credentials', 'custom-settings', 'certificate-expiry', 'custom-labels-credential', 'external-credentials', 'encryption-coverage'],
|
|
129
|
+
logging: ['audit-trail', 'apex-logging', 'event-monitoring', 'siem-integration', 'anonymous-apex-audit',
|
|
130
|
+
'debug-log-access', 'transaction-security-policy', 'threat-detection', 'guest-traffic-anomaly',
|
|
131
|
+
'login-anomaly'],
|
|
132
|
+
devSecurity: ['code-security', 'visualforce-xss', 'scheduled-apex'],
|
|
133
|
+
network: ['remote-sites', 'csp-trusted-sites', 'connected-apps', 'connected-app-scope', 'connected-app-inactivity', 'cors-allowlist',
|
|
134
|
+
'email-security', 'outbound-messages', 'experience-csp'],
|
|
135
|
+
dataGovernance: ['data-classification', 'field-history-tracking', 'sandbox-data-masking'],
|
|
136
|
+
configGovernance: ['health-check', 'api-limits', 'release-updates', 'legacy-api-version', 'installed-packages', 'deployment-identity', 'session-hardening'],
|
|
137
|
+
accountLifecycle: ['inactive-users'],
|
|
138
|
+
// Agentforce / GenAI. The NZ pack does not map these (HISO/NZISM predate agentic platforms and
|
|
139
|
+
// have no chapter that fits); HIPAA and GDPR do, because an over-privileged agent user reading
|
|
140
|
+
// PHI or personal data is squarely an access-control and security-of-processing question.
|
|
141
|
+
aiAgents: ['agent-inventory', 'agent-user-privilege', 'agent-action-surface', 'agent-channel-exposure',
|
|
142
|
+
'agent-monitoring-coverage', 'trusted-url-hygiene'],
|
|
143
|
+
};
|
|
144
|
+
// NZ pack crosswalk — HISO/NZISM are domain/chapter-level; Privacy Act IPPs are statute-level.
|
|
113
145
|
const NZ_CROSSWALK = [
|
|
114
|
-
{ controls: ['HISO-AC', 'NZISM-AC', 'PRIVACY-IPP5'],
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{ controls: ['
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
{ controls: ['
|
|
139
|
-
checks:
|
|
140
|
-
{ controls: ['
|
|
141
|
-
checks:
|
|
142
|
-
{ controls: ['
|
|
143
|
-
checks:
|
|
146
|
+
{ controls: ['HISO-AC', 'NZISM-AC', 'PRIVACY-IPP5'], checks: DOMAIN.accessControl },
|
|
147
|
+
{ controls: ['HISO-AUTH', 'NZISM-AUTH', 'PRIVACY-IPP5'], checks: DOMAIN.authentication },
|
|
148
|
+
{ controls: ['HISO-CRYPTO', 'NZISM-CRYPTO', 'PRIVACY-IPP5'], checks: DOMAIN.crypto },
|
|
149
|
+
{ controls: ['HISO-LOG', 'NZISM-LOG'], checks: DOMAIN.logging },
|
|
150
|
+
{ controls: ['HISO-DEV', 'NZISM-SW'], checks: DOMAIN.devSecurity },
|
|
151
|
+
{ controls: ['HISO-COMM', 'NZISM-NET', 'PRIVACY-IPP12'], checks: DOMAIN.network },
|
|
152
|
+
{ controls: ['HISO-DATA', 'PRIVACY-IPP5'], checks: DOMAIN.dataGovernance },
|
|
153
|
+
{ controls: ['HISO-GOV', 'NZISM-CONFIG'], checks: DOMAIN.configGovernance },
|
|
154
|
+
{ controls: ['PRIVACY-IPP9'], checks: DOMAIN.accountLifecycle },
|
|
155
|
+
];
|
|
156
|
+
// HIPAA / GDPR crosswalk — the domain-wide obligations. Anything narrower than a whole domain is
|
|
157
|
+
// mapped per check in REGULATORY_PRECISE below rather than swept across the domain, because these
|
|
158
|
+
// ids name a specific implementation specification or article paragraph: claiming "automatic
|
|
159
|
+
// logoff" against all fourteen authentication checks would be the imprecision the sourced catalog
|
|
160
|
+
// exists to avoid.
|
|
161
|
+
const REGULATORY_CROSSWALK = [
|
|
162
|
+
{ controls: ['HIPAA-164.312(a)(1)', 'HIPAA-164.308(a)(4)', 'GDPR-Art5(1)(f)', 'GDPR-Art25', 'GDPR-Art32(1)(b)'],
|
|
163
|
+
checks: DOMAIN.accessControl },
|
|
164
|
+
{ controls: ['HIPAA-164.312(d)', 'GDPR-Art5(1)(f)', 'GDPR-Art32(1)(b)'],
|
|
165
|
+
checks: DOMAIN.authentication },
|
|
166
|
+
{ controls: ['HIPAA-164.312(a)(2)(iv)', 'GDPR-Art32(1)(a)', 'GDPR-Art5(1)(f)'],
|
|
167
|
+
checks: DOMAIN.crypto },
|
|
168
|
+
{ controls: ['HIPAA-164.312(b)', 'HIPAA-164.308(a)(1)(ii)(D)', 'GDPR-Art32(1)(b)', 'GDPR-Art33'],
|
|
169
|
+
checks: DOMAIN.logging },
|
|
170
|
+
{ controls: ['HIPAA-164.312(c)(1)', 'GDPR-Art25', 'GDPR-Art32(1)(b)'],
|
|
171
|
+
checks: DOMAIN.devSecurity },
|
|
172
|
+
{ controls: ['HIPAA-164.312(e)(1)', 'GDPR-Art44', 'GDPR-Art32(1)(b)'],
|
|
173
|
+
checks: DOMAIN.network },
|
|
174
|
+
{ controls: ['HIPAA-164.308(a)(1)(ii)(A)', 'HIPAA-164.312(c)(1)', 'GDPR-Art30', 'GDPR-Art5(1)(f)'],
|
|
175
|
+
checks: DOMAIN.dataGovernance },
|
|
176
|
+
{ controls: ['HIPAA-164.308(a)(1)(ii)(B)', 'HIPAA-164.308(a)(8)', 'GDPR-Art32(1)(d)'],
|
|
177
|
+
checks: DOMAIN.configGovernance },
|
|
178
|
+
{ controls: ['HIPAA-164.308(a)(3)', 'GDPR-Art5(1)(f)'],
|
|
179
|
+
checks: DOMAIN.accountLifecycle },
|
|
144
180
|
];
|
|
181
|
+
// Per-check HIPAA/GDPR additions, where the obligation is narrower than its domain.
|
|
182
|
+
const REGULATORY_PRECISE = {
|
|
183
|
+
// Shared/service identities vs "assign a unique name and/or number for identifying and tracking user identity".
|
|
184
|
+
'integration-users': ['HIPAA-164.312(a)(2)(i)'],
|
|
185
|
+
// Session inactivity timeout is the automatic-logoff specification; password rules are their own.
|
|
186
|
+
'password-session-policy': ['HIPAA-164.312(a)(2)(iii)', 'HIPAA-164.308(a)(5)(ii)(D)'],
|
|
187
|
+
'session-hardening': ['HIPAA-164.312(a)(2)(iii)'],
|
|
188
|
+
// Monitoring log-in attempts and reporting discrepancies.
|
|
189
|
+
'login-session': ['HIPAA-164.308(a)(5)(ii)(C)'],
|
|
190
|
+
'failed-login-detection': ['HIPAA-164.308(a)(5)(ii)(C)'],
|
|
191
|
+
'login-anomaly': ['HIPAA-164.308(a)(5)(ii)(C)'],
|
|
192
|
+
// Identifying and responding to suspected or known security incidents.
|
|
193
|
+
'transaction-security-policy': ['HIPAA-164.308(a)(6)'],
|
|
194
|
+
'threat-detection': ['HIPAA-164.308(a)(6)'],
|
|
195
|
+
'guest-traffic-anomaly': ['HIPAA-164.308(a)(6)'],
|
|
196
|
+
// Cleartext transport of PHI/personal data — encryption in transmission.
|
|
197
|
+
'remote-sites': ['HIPAA-164.312(e)(2)(ii)'],
|
|
198
|
+
'csp-trusted-sites': ['HIPAA-164.312(e)(2)(ii)'],
|
|
199
|
+
'outbound-messages': ['HIPAA-164.312(e)(2)(ii)'],
|
|
200
|
+
'email-security': ['HIPAA-164.312(e)(2)(ii)'],
|
|
201
|
+
'experience-csp': ['HIPAA-164.312(e)(2)(ii)'],
|
|
202
|
+
// Data Mask is pseudonymisation in the Art. 32(1)(a) sense; unmasked prod data in a sandbox is
|
|
203
|
+
// also a by-default-accessibility failure under Art. 25.
|
|
204
|
+
'sandbox-data-masking': ['GDPR-Art32(1)(a)', 'GDPR-Art25'],
|
|
205
|
+
// Agentforce / GenAI — see DOMAIN.aiAgents.
|
|
206
|
+
'agent-inventory': ['HIPAA-164.308(a)(4)', 'GDPR-Art30'],
|
|
207
|
+
'agent-user-privilege': ['HIPAA-164.312(a)(1)', 'HIPAA-164.308(a)(4)', 'GDPR-Art5(1)(f)', 'GDPR-Art32(1)(b)'],
|
|
208
|
+
'agent-action-surface': ['HIPAA-164.312(a)(1)', 'HIPAA-164.312(c)(1)', 'GDPR-Art25'],
|
|
209
|
+
'agent-channel-exposure': ['HIPAA-164.312(a)(1)', 'GDPR-Art25', 'GDPR-Art5(1)(f)'],
|
|
210
|
+
'agent-monitoring-coverage': ['HIPAA-164.312(b)', 'HIPAA-164.308(a)(1)(ii)(D)', 'GDPR-Art33'],
|
|
211
|
+
'trusted-url-hygiene': ['HIPAA-164.312(e)(1)', 'GDPR-Art44'],
|
|
212
|
+
};
|
|
145
213
|
function buildCheckControlMap() {
|
|
146
214
|
const map = {};
|
|
147
215
|
for (const [check, ids] of Object.entries(BASE_CHECK_CONTROL_MAP))
|
|
148
216
|
map[check] = [...ids];
|
|
149
|
-
for (const group of NZ_CROSSWALK) {
|
|
217
|
+
for (const group of [...NZ_CROSSWALK, ...REGULATORY_CROSSWALK]) {
|
|
150
218
|
for (const check of group.checks) {
|
|
151
219
|
(map[check] ??= []).push(...group.controls);
|
|
152
220
|
}
|
|
153
221
|
}
|
|
222
|
+
for (const [check, ids] of Object.entries(REGULATORY_PRECISE)) {
|
|
223
|
+
(map[check] ??= []).push(...ids);
|
|
224
|
+
}
|
|
225
|
+
// A control can arrive from both a crosswalk and a precise entry; a compliance matrix must not
|
|
226
|
+
// render the same control twice for one check.
|
|
227
|
+
for (const check of Object.keys(map))
|
|
228
|
+
map[check] = [...new Set(map[check])];
|
|
154
229
|
return map;
|
|
155
230
|
}
|
|
156
231
|
export const CHECK_CONTROL_MAP = buildCheckControlMap();
|
|
@@ -27,6 +27,7 @@ export const CHECK_META = {
|
|
|
27
27
|
'mfa-enforcement': { effort: 'quick', impact: 'Portal/external users without MFA let a stolen password reach customer or partner data directly.' },
|
|
28
28
|
'api-client-permission': { effort: 'quick', impact: '“Use Any API Client” bypasses API Access Control, letting a user reach the org from any tool.' },
|
|
29
29
|
'integration-users': { effort: 'moderate', impact: 'Over-privileged service accounts are prime targets: one stolen key grants broad, unattended access.' },
|
|
30
|
+
'integration-least-privilege': { effort: 'moderate', impact: 'An integration account keeps whatever it was granted at go-live: long-lived credentials, no interactive user to notice misuse, and frequently outside MFA and IP restrictions. Every permission it is not using is standing privilege waiting on a leaked key.' },
|
|
30
31
|
'content-links': { effort: 'quick', impact: 'Public file links without expiry or password leak documents to anyone who finds the URL.' },
|
|
31
32
|
'field-history-tracking': { effort: 'quick', impact: 'Without field history, tampering with sensitive records can’t be reconstructed after an incident.' },
|
|
32
33
|
'data-classification': { effort: 'moderate', impact: 'Unclassified sensitive data can’t be protected or encrypted consistently, increasing exposure.' },
|
|
@@ -75,6 +76,7 @@ export const CHECK_META = {
|
|
|
75
76
|
'classic-sites': { effort: 'moderate', impact: 'Active classic Visualforce sites expose a second unauthenticated guest surface that the Experience Cloud checks never inspect.' },
|
|
76
77
|
'auth-providers': { effort: 'moderate', impact: 'Unvetted social/SAML identity providers with just-in-time provisioning can let attackers federate in or auto-create over-privileged users.' },
|
|
77
78
|
'guest-api-access': { effort: 'quick', impact: 'A guest user with API access can drive the raw REST/Bulk API, turning readable objects into scriptable mass extraction (and Hard Delete into irreversible destruction) without login.' },
|
|
79
|
+
'guest-user-visibility': { effort: 'quick', impact: 'A guest holding View All Users, or a public external OWD on User, hands unauthenticated visitors the full staff roster — a ready-made target list for phishing and credential stuffing against named admins.' },
|
|
78
80
|
'external-credentials': { effort: 'moderate', impact: 'Callouts with no or custom authentication can be spoofed or leak a static secret, exposing the integrated system and the data crossing it.' },
|
|
79
81
|
'login-anomaly': { effort: 'quick', impact: 'An account logging in from many distinct IPs signals credential sharing or compromise; caught late, it means an attacker already has a working session.' },
|
|
80
82
|
'session-hardening': { effort: 'quick', impact: 'Weak clickjack/CSRF/session-lock/XSS settings let attackers hijack authenticated sessions via framing, forged requests, or injected script.' },
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RiskLevel } from '@cclabsnz/sf-core';
|
|
2
|
+
import type { Finding } from './Finding.js';
|
|
3
|
+
/** Audit completed; nothing the caller asked to fail on. */
|
|
4
|
+
export declare const EXIT_OK = 0;
|
|
5
|
+
/** Findings at or above the --fail-on threshold. */
|
|
6
|
+
export declare const EXIT_FINDINGS = 1;
|
|
7
|
+
/** Audit ran, but checks could not gather evidence. Only when --fail-on-inconclusive is set. */
|
|
8
|
+
export declare const EXIT_INCONCLUSIVE = 3;
|
|
9
|
+
export interface ExitOptions {
|
|
10
|
+
failOn?: RiskLevel;
|
|
11
|
+
failOnInconclusive?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Findings at or above `failOn`.
|
|
15
|
+
*
|
|
16
|
+
* Ranks are compared only after confirming the level is gateable. Testing
|
|
17
|
+
* `ORDER.indexOf(level) <= threshold` alone treats INFO (index -1) as more severe
|
|
18
|
+
* than CRITICAL, which made every passing check a violation.
|
|
19
|
+
*/
|
|
20
|
+
export declare function violationsFor(findings: Finding[], failOn: RiskLevel): Finding[];
|
|
21
|
+
/**
|
|
22
|
+
* The process exit code for a completed audit.
|
|
23
|
+
*
|
|
24
|
+
* A definite finding outranks unknown coverage: when both apply the caller gets
|
|
25
|
+
* EXIT_FINDINGS, and the inconclusive count is still carried in the report body.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveExitCode(findings: Finding[], opts: ExitOptions): number;
|
|
28
|
+
//# sourceMappingURL=exitCode.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** Audit completed; nothing the caller asked to fail on. */
|
|
2
|
+
export const EXIT_OK = 0;
|
|
3
|
+
/** Findings at or above the --fail-on threshold. */
|
|
4
|
+
export const EXIT_FINDINGS = 1;
|
|
5
|
+
/** Audit ran, but checks could not gather evidence. Only when --fail-on-inconclusive is set. */
|
|
6
|
+
export const EXIT_INCONCLUSIVE = 3;
|
|
7
|
+
/**
|
|
8
|
+
* Severity order, most severe first. INFO is deliberately absent: it is not a
|
|
9
|
+
* severity a caller can gate on, it is the level carried by passing and
|
|
10
|
+
* inconclusive findings.
|
|
11
|
+
*/
|
|
12
|
+
const ORDER = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'];
|
|
13
|
+
/**
|
|
14
|
+
* Findings at or above `failOn`.
|
|
15
|
+
*
|
|
16
|
+
* Ranks are compared only after confirming the level is gateable. Testing
|
|
17
|
+
* `ORDER.indexOf(level) <= threshold` alone treats INFO (index -1) as more severe
|
|
18
|
+
* than CRITICAL, which made every passing check a violation.
|
|
19
|
+
*/
|
|
20
|
+
export function violationsFor(findings, failOn) {
|
|
21
|
+
const threshold = ORDER.indexOf(failOn);
|
|
22
|
+
if (threshold < 0)
|
|
23
|
+
return [];
|
|
24
|
+
return findings.filter((f) => {
|
|
25
|
+
if (f.passed === true || f.inconclusive === true)
|
|
26
|
+
return false;
|
|
27
|
+
const rank = ORDER.indexOf(f.riskLevel);
|
|
28
|
+
return rank >= 0 && rank <= threshold;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The process exit code for a completed audit.
|
|
33
|
+
*
|
|
34
|
+
* A definite finding outranks unknown coverage: when both apply the caller gets
|
|
35
|
+
* EXIT_FINDINGS, and the inconclusive count is still carried in the report body.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveExitCode(findings, opts) {
|
|
38
|
+
if (opts.failOn !== undefined && violationsFor(findings, opts.failOn).length > 0) {
|
|
39
|
+
return EXIT_FINDINGS;
|
|
40
|
+
}
|
|
41
|
+
if (opts.failOnInconclusive === true && findings.some((f) => f.inconclusive === true)) {
|
|
42
|
+
return EXIT_INCONCLUSIVE;
|
|
43
|
+
}
|
|
44
|
+
return EXIT_OK;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=exitCode.js.map
|
|
@@ -33,11 +33,11 @@ export function loadScoringConfig(filePath, knownCheckIds, warn) {
|
|
|
33
33
|
riskScores: validated.riskScores ?? DEFAULT_SCORING_CONFIG.riskScores,
|
|
34
34
|
checkWeights: safeCheckWeights,
|
|
35
35
|
gradeThresholds: {
|
|
36
|
-
A: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.A, ...
|
|
37
|
-
B: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.B, ...
|
|
38
|
-
C: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.C, ...
|
|
39
|
-
D: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.D, ...
|
|
40
|
-
F: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.F, ...
|
|
36
|
+
A: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.A, ...validated.gradeThresholds?.A },
|
|
37
|
+
B: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.B, ...validated.gradeThresholds?.B },
|
|
38
|
+
C: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.C, ...validated.gradeThresholds?.C },
|
|
39
|
+
D: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.D, ...validated.gradeThresholds?.D },
|
|
40
|
+
F: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.F, ...validated.gradeThresholds?.F },
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
}
|
|
@@ -165,7 +165,7 @@ export class HtmlRenderer {
|
|
|
165
165
|
.map((c) => {
|
|
166
166
|
const conf = c.confidence === 'named' ? '' : ' (potential)';
|
|
167
167
|
const steps = c.steps
|
|
168
|
-
.map((s
|
|
168
|
+
.map((s) => `<li><strong>${escStr(s.title ?? s.findingId)}</strong> (${escStr(s.severity ?? '—')}): grants <code>${escStr(s.capability)}</code></li>`)
|
|
169
169
|
.join('');
|
|
170
170
|
return `<div class="attack-chain severity-${c.severity.toLowerCase()}">
|
|
171
171
|
<h3>[${escStr(c.severity)}] ${escStr(c.title)}${conf}</h3>
|
|
@@ -22,6 +22,12 @@ Directory to write the report file. Defaults to the current directory.
|
|
|
22
22
|
Exit with code 1 if any finding is at or above this severity level.
|
|
23
23
|
Options: CRITICAL, HIGH, MEDIUM, LOW
|
|
24
24
|
|
|
25
|
+
## fail-on-inconclusive
|
|
26
|
+
|
|
27
|
+
Exit with code 3 if any check could not gather evidence because the audit user lacked
|
|
28
|
+
the required permission. Off by default, so existing pipelines are unaffected. A finding
|
|
29
|
+
at or above `--fail-on` takes precedence and still exits 1.
|
|
30
|
+
|
|
25
31
|
## checks
|
|
26
32
|
|
|
27
33
|
Comma-separated check IDs to run instead of all checks (e.g. `hardcoded-credentials,apex-sharing`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Read-only Salesforce security audit for the sf CLI: 88 checks, attack-chain correlation, A-F risk grading, and compliance mapping to OWASP, SOC 2, ISO 27001, NZISM and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salesforce",
|
|
@@ -27,28 +27,32 @@
|
|
|
27
27
|
"main": "lib/index.js",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "tsc -p tsconfig.json",
|
|
30
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests",
|
|
31
|
-
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --passWithNoTests",
|
|
30
|
+
"test": "npm run typecheck && node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests",
|
|
31
|
+
"test:unit": "npm run typecheck && node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --passWithNoTests",
|
|
32
32
|
"prepack": "npm run build",
|
|
33
33
|
"clean": "rm -rf lib",
|
|
34
|
-
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true"
|
|
34
|
+
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.test.json",
|
|
36
|
+
"lint": "oxlint src test",
|
|
37
|
+
"test:jest": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
40
|
+
"@cclabsnz/sf-core": "^0.3.0",
|
|
37
41
|
"@oclif/core": "^4",
|
|
38
42
|
"@salesforce/core": "^9",
|
|
39
43
|
"@salesforce/sf-plugins-core": "^13",
|
|
40
44
|
"chart.js": "^4.5.1",
|
|
41
|
-
"zod": "^4"
|
|
42
|
-
"@cclabsnz/sf-core": "^0.3.0"
|
|
45
|
+
"zod": "^4"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
48
|
"@jest/globals": "^30.4.1",
|
|
49
|
+
"@swc/core": "^1.15.47",
|
|
50
|
+
"@swc/jest": "^0.2.39",
|
|
46
51
|
"@types/jest": "^30",
|
|
47
52
|
"@types/node": "^26",
|
|
48
53
|
"jest": "^30",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"typescript": "^5"
|
|
54
|
+
"oxlint": "^1.79.0",
|
|
55
|
+
"typescript": "^7.0.2"
|
|
52
56
|
},
|
|
53
57
|
"repository": {
|
|
54
58
|
"type": "git",
|
|
@@ -84,6 +88,7 @@
|
|
|
84
88
|
},
|
|
85
89
|
"files": [
|
|
86
90
|
"/lib",
|
|
91
|
+
"/CHANGELOG.md",
|
|
87
92
|
"/messages",
|
|
88
93
|
"/config",
|
|
89
94
|
"!/lib/**/*.map"
|
|
@@ -91,10 +96,10 @@
|
|
|
91
96
|
"pnpm": {
|
|
92
97
|
"overrides": {
|
|
93
98
|
"form-data": "^4.0.6",
|
|
94
|
-
"js-yaml@3": "^3.15.
|
|
99
|
+
"js-yaml@3": "^3.15.1",
|
|
95
100
|
"handlebars": "^4.7.9",
|
|
96
101
|
"brace-expansion": "^5.0.9",
|
|
97
|
-
"fast-uri@3": "^3.1.
|
|
102
|
+
"fast-uri@3": "^3.1.6"
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
}
|