@cclabsnz/sf-audit 1.0.1 → 1.2.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/README.md +228 -31
- package/lib/api/ToolingClientImpl.js +5 -2
- package/lib/chains/AttackChain.d.ts +20 -0
- package/lib/chains/AttackChain.js +2 -0
- package/lib/chains/Capability.d.ts +7 -0
- package/lib/chains/Capability.js +11 -0
- package/lib/chains/CapabilityRegistry.d.ts +18 -0
- package/lib/chains/CapabilityRegistry.js +53 -0
- package/lib/chains/ChainEngine.d.ts +13 -0
- package/lib/chains/ChainEngine.js +137 -0
- package/lib/chains/namedChains.d.ts +14 -0
- package/lib/chains/namedChains.js +99 -0
- package/lib/checks/CheckEngine.js +33 -5
- package/lib/checks/impl/AnonymousApexAuditCheck.d.ts +10 -0
- package/lib/checks/impl/AnonymousApexAuditCheck.js +106 -0
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +11 -0
- package/lib/checks/impl/ApexCrudFLSCheck.js +98 -0
- package/lib/checks/impl/ApexLoggingCheck.d.ts +11 -0
- package/lib/checks/impl/ApexLoggingCheck.js +124 -0
- package/lib/checks/impl/ApexRestEndpointCheck.d.ts +11 -0
- package/lib/checks/impl/ApexRestEndpointCheck.js +94 -0
- package/lib/checks/impl/ApexSharingCheck.js +29 -0
- package/lib/checks/impl/ApiClientPermissionCheck.d.ts +10 -0
- package/lib/checks/impl/ApiClientPermissionCheck.js +59 -0
- package/lib/checks/impl/AuditTrailCheck.js +29 -0
- package/lib/checks/impl/CertificateExpiryCheck.d.ts +10 -0
- package/lib/checks/impl/CertificateExpiryCheck.js +123 -0
- package/lib/checks/impl/CodeSecurityCheck.d.ts +2 -1
- package/lib/checks/impl/CodeSecurityCheck.js +46 -6
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +11 -0
- package/lib/checks/impl/ConnectedAppInactivityCheck.js +86 -0
- package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +10 -0
- package/lib/checks/impl/ConnectedAppScopeCheck.js +125 -0
- package/lib/checks/impl/ConnectedAppsCheck.d.ts +1 -0
- package/lib/checks/impl/ConnectedAppsCheck.js +37 -2
- package/lib/checks/impl/ContentLinksCheck.d.ts +10 -0
- package/lib/checks/impl/ContentLinksCheck.js +115 -0
- package/lib/checks/impl/CorsAllowlistCheck.d.ts +10 -0
- package/lib/checks/impl/CorsAllowlistCheck.js +80 -0
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +10 -0
- package/lib/checks/impl/CspTrustedSitesCheck.js +55 -0
- package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +10 -0
- package/lib/checks/impl/CustomLabelsCredentialCheck.js +97 -0
- package/lib/checks/impl/DataClassificationCheck.d.ts +10 -0
- package/lib/checks/impl/DataClassificationCheck.js +112 -0
- package/lib/checks/impl/DebugLogAccessCheck.d.ts +10 -0
- package/lib/checks/impl/DebugLogAccessCheck.js +81 -0
- package/lib/checks/impl/DeploymentIdentityCheck.d.ts +11 -0
- package/lib/checks/impl/DeploymentIdentityCheck.js +144 -0
- package/lib/checks/impl/EnhancedDomainsCheck.d.ts +10 -0
- package/lib/checks/impl/EnhancedDomainsCheck.js +84 -0
- package/lib/checks/impl/EscalationPermsCheck.d.ts +10 -0
- package/lib/checks/impl/EscalationPermsCheck.js +77 -0
- package/lib/checks/impl/EventMonitoringCheck.d.ts +11 -0
- package/lib/checks/impl/EventMonitoringCheck.js +84 -0
- package/lib/checks/impl/ExperienceCloudSiteCheck.d.ts +10 -0
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +91 -0
- package/lib/checks/impl/FailedLoginCheck.d.ts +10 -0
- package/lib/checks/impl/FailedLoginCheck.js +122 -0
- package/lib/checks/impl/FieldHistoryTrackingCheck.d.ts +10 -0
- package/lib/checks/impl/FieldHistoryTrackingCheck.js +70 -0
- package/lib/checks/impl/FieldLevelSecurityCheck.js +28 -18
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +11 -0
- package/lib/checks/impl/GuestExecutableApexCheck.js +93 -0
- package/lib/checks/impl/GuestUserAccessCheck.js +74 -66
- package/lib/checks/impl/HardcodedCredentialsCheck.js +2 -2
- package/lib/checks/impl/HighAssuranceSessionCheck.d.ts +10 -0
- package/lib/checks/impl/HighAssuranceSessionCheck.js +103 -0
- package/lib/checks/impl/InactiveUsersCheck.js +38 -19
- package/lib/checks/impl/InstalledPackagesCheck.d.ts +10 -0
- package/lib/checks/impl/InstalledPackagesCheck.js +94 -0
- package/lib/checks/impl/IntegrationUsersCheck.d.ts +10 -0
- package/lib/checks/impl/IntegrationUsersCheck.js +108 -0
- package/lib/checks/impl/InternalUserMfaCheck.d.ts +10 -0
- package/lib/checks/impl/InternalUserMfaCheck.js +81 -0
- package/lib/checks/impl/IpRestrictionsCheck.js +86 -23
- package/lib/checks/impl/LegacyApiVersionCheck.d.ts +10 -0
- package/lib/checks/impl/LegacyApiVersionCheck.js +91 -0
- package/lib/checks/impl/MfaEnforcementCheck.d.ts +10 -0
- package/lib/checks/impl/MfaEnforcementCheck.js +76 -0
- package/lib/checks/impl/MfaMethodStrengthCheck.d.ts +11 -0
- package/lib/checks/impl/MfaMethodStrengthCheck.js +116 -0
- package/lib/checks/impl/MfaRegistrationCheck.d.ts +11 -0
- package/lib/checks/impl/MfaRegistrationCheck.js +95 -0
- package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +10 -0
- package/lib/checks/impl/MyDomainLoginPolicyCheck.js +105 -0
- package/lib/checks/impl/NamedCredentialsCheck.js +37 -2
- package/lib/checks/impl/PermissionsCheck.js +67 -14
- package/lib/checks/impl/PublicGroupSharingCheck.js +20 -9
- package/lib/checks/impl/ReleaseUpdatesCheck.d.ts +10 -0
- package/lib/checks/impl/ReleaseUpdatesCheck.js +106 -0
- package/lib/checks/impl/ReportFolderAccessCheck.d.ts +10 -0
- package/lib/checks/impl/ReportFolderAccessCheck.js +54 -0
- package/lib/checks/impl/ScheduledApexCheck.d.ts +1 -0
- package/lib/checks/impl/ScheduledApexCheck.js +3 -0
- package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
- package/lib/checks/impl/SharingModelCheck.js +103 -32
- package/lib/checks/impl/SiemIntegrationCheck.d.ts +11 -0
- package/lib/checks/impl/SiemIntegrationCheck.js +102 -0
- package/lib/checks/impl/SsoEnforcementCheck.d.ts +10 -0
- package/lib/checks/impl/SsoEnforcementCheck.js +90 -0
- package/lib/checks/impl/StandardProfilesCheck.d.ts +10 -0
- package/lib/checks/impl/StandardProfilesCheck.js +68 -0
- package/lib/checks/impl/TransactionSecurityPolicyCheck.d.ts +10 -0
- package/lib/checks/impl/TransactionSecurityPolicyCheck.js +62 -0
- package/lib/checks/impl/TrustedIPRangesCheck.d.ts +10 -0
- package/lib/checks/impl/TrustedIPRangesCheck.js +106 -0
- package/lib/checks/impl/UsersAndAdminsCheck.js +50 -20
- package/lib/checks/impl/VisualforceXssCheck.d.ts +11 -0
- package/lib/checks/impl/VisualforceXssCheck.js +150 -0
- package/lib/checks/registry.js +97 -12
- package/lib/commands/audit/diff.d.ts +17 -0
- package/lib/commands/audit/diff.js +76 -0
- package/lib/commands/audit/history.d.ts +15 -0
- package/lib/commands/audit/history.js +59 -0
- package/lib/commands/audit/security.d.ts +5 -0
- package/lib/commands/audit/security.js +38 -9
- 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 +111 -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 +20 -0
- package/lib/context/AuditContext.d.ts +0 -2
- package/lib/findings/AuditResult.d.ts +3 -0
- package/lib/findings/CheckMeta.d.ts +9 -0
- package/lib/findings/CheckMeta.js +67 -0
- package/lib/findings/ComplianceMapping.d.ts +3 -0
- package/lib/findings/ComplianceMapping.js +75 -0
- package/lib/findings/Finding.d.ts +20 -0
- package/lib/findings/loadScoringConfig.js +9 -2
- package/lib/findings/scoring.d.ts +2 -1
- package/lib/findings/scoring.js +20 -7
- package/lib/history/AuditDiff.d.ts +26 -0
- package/lib/history/AuditDiff.js +2 -0
- package/lib/history/DiffEngine.d.ts +4 -0
- package/lib/history/DiffEngine.js +61 -0
- package/lib/history/HistoryStore.d.ts +11 -0
- package/lib/history/HistoryStore.js +56 -0
- package/lib/history/metricMeta.d.ts +9 -0
- package/lib/history/metricMeta.js +28 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.js +2 -1
- package/lib/lib/wire.d.ts +1 -2
- package/lib/lib/wire.js +1 -2
- 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.d.ts +8 -0
- package/lib/renderers/DiffHtmlRenderer.js +164 -0
- package/lib/renderers/DiffJsonRenderer.d.ts +8 -0
- package/lib/renderers/DiffJsonRenderer.js +8 -0
- package/lib/renderers/DiffRenderer.d.ts +7 -0
- package/lib/renderers/DiffRenderer.js +2 -0
- package/lib/renderers/HistoryRenderer.d.ts +6 -0
- package/lib/renderers/HistoryRenderer.js +140 -0
- package/lib/renderers/HtmlRenderer.d.ts +1 -0
- package/lib/renderers/HtmlRenderer.js +354 -60
- package/lib/renderers/MarkdownRenderer.js +34 -1
- 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/package.json +4 -3
- 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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Maps each check id to the compliance control ids it relates to.
|
|
2
|
+
// Migrated from the former ComplianceMapping. HIPAA/GDPR ids are intentionally omitted
|
|
3
|
+
// until their catalogs land (later plan). A08/A10 are mapped precisely:
|
|
4
|
+
// A10 (SSRF) → egress controls (remote-sites, csp-trusted-sites, named-credentials)
|
|
5
|
+
// A08 (Software & Data Integrity) → installed-packages, deployment-identity
|
|
6
|
+
// NZ pack control ids (HISO/NZISM/Privacy Act) are layered on by domain via NZ_CROSSWALK below.
|
|
7
|
+
const BASE_CHECK_CONTROL_MAP = {
|
|
8
|
+
'users-and-admins': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-004'],
|
|
9
|
+
'permissions': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-002', 'SBS-ACS-005'],
|
|
10
|
+
'inactive-users': ['OWASP-A01', 'SOC2-CC6.2', 'ISO-A.5.18'],
|
|
11
|
+
'login-session': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
12
|
+
'ip-restrictions': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-003'],
|
|
13
|
+
'password-session-policy': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
14
|
+
'field-level-security': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
15
|
+
'sharing-model': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
16
|
+
'public-group-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
17
|
+
'guest-user-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
|
|
18
|
+
'apex-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-001'],
|
|
19
|
+
'flows-without-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-004'],
|
|
20
|
+
'connected-apps': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.8.3', 'SBS-OAUTH-001', 'SBS-OAUTH-002', 'SBS-DEP-006'],
|
|
21
|
+
'remote-sites': ['OWASP-A05', 'OWASP-A10', 'SOC2-CC6.6', 'ISO-A.8.26', 'SBS-INT-002'],
|
|
22
|
+
'csp-trusted-sites': ['OWASP-A05', 'OWASP-A10', 'SOC2-CC6.6', 'ISO-A.8.26'],
|
|
23
|
+
'named-credentials': ['OWASP-A02', 'OWASP-A10', 'SOC2-CC6.7', 'ISO-A.8.3', 'SBS-INT-003'],
|
|
24
|
+
'hardcoded-credentials': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.3', 'SBS-DEP-005'],
|
|
25
|
+
'custom-settings': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.3'],
|
|
26
|
+
'health-check': ['OWASP-A05', 'SOC2-CC7.1', 'ISO-A.8.8', 'SBS-SECCONF-001', 'SBS-SECCONF-002'],
|
|
27
|
+
'audit-trail': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-002'],
|
|
28
|
+
'code-security': ['OWASP-A03', 'OWASP-A05', 'SOC2-CC7.2', 'ISO-A.8.25', 'SBS-CODE-002'],
|
|
29
|
+
'api-limits': ['OWASP-A05', 'SOC2-CC9.1', 'ISO-A.8.8', 'SBS-MON-005'],
|
|
30
|
+
'scheduled-apex': ['OWASP-A05', 'SOC2-CC7.2', 'ISO-A.8.32'],
|
|
31
|
+
'standard-profiles': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-005'],
|
|
32
|
+
'sso-enforcement': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-001', 'SBS-AUTH-002'],
|
|
33
|
+
'mfa-enforcement': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-004'],
|
|
34
|
+
'api-client-permission': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.8.3', 'SBS-ACS-006'],
|
|
35
|
+
'integration-users': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-007', 'SBS-ACS-008', 'SBS-ACS-009'],
|
|
36
|
+
'content-links': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.14', 'SBS-FILE-001', 'SBS-FILE-002', 'SBS-FILE-003'],
|
|
37
|
+
'field-history-tracking': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-DATA-004'],
|
|
38
|
+
'data-classification': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.12', 'SBS-DATA-001', 'SBS-DATA-002'],
|
|
39
|
+
'deployment-identity': ['OWASP-A05', 'OWASP-A08', 'SOC2-CC8.1', 'ISO-A.8.32', 'SBS-DEP-001', 'SBS-DEP-003'],
|
|
40
|
+
'apex-logging': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-CODE-003', 'SBS-CODE-004'],
|
|
41
|
+
'event-monitoring': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-001', 'SBS-INT-004'],
|
|
42
|
+
'siem-integration': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003', 'SBS-MON-004'],
|
|
43
|
+
'apex-crud-fls': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
44
|
+
'apex-rest-endpoint': ['OWASP-A01', 'OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
45
|
+
'visualforce-xss': ['OWASP-A03', 'SOC2-CC6.1', 'ISO-A.8.25'],
|
|
46
|
+
'certificate-expiry': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.24'],
|
|
47
|
+
'installed-packages': ['OWASP-A06', 'OWASP-A08', 'SOC2-CC9.2', 'ISO-A.8.25'],
|
|
48
|
+
'trusted-ip-ranges': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-003'],
|
|
49
|
+
'anonymous-apex-audit': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15'],
|
|
50
|
+
'debug-log-access': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15'],
|
|
51
|
+
'connected-app-inactivity': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.5.18'],
|
|
52
|
+
'my-domain-login-policy': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-001'],
|
|
53
|
+
'high-assurance-session': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
54
|
+
'enhanced-domains': ['OWASP-A05', 'SOC2-CC6.1', 'ISO-A.8.26'],
|
|
55
|
+
'internal-user-mfa': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-004'],
|
|
56
|
+
'mfa-registration': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
57
|
+
'mfa-method-strength': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
58
|
+
'release-updates': ['OWASP-A06', 'SOC2-CC7.1', 'ISO-A.8.8'],
|
|
59
|
+
'legacy-api-version': ['OWASP-A06', 'SOC2-CC6.6', 'ISO-A.8.8'],
|
|
60
|
+
'connected-app-scope': ['OWASP-A01', 'OWASP-A05', 'SOC2-CC6.6', 'ISO-A.8.3', 'SBS-OAUTH-002'],
|
|
61
|
+
'transaction-security-policy': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003'],
|
|
62
|
+
'failed-login-detection': ['OWASP-A07', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003'],
|
|
63
|
+
'experience-cloud-site': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-003'],
|
|
64
|
+
'custom-labels-credential': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.3'],
|
|
65
|
+
'report-folder-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
|
|
66
|
+
'escalation-perms': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-004'],
|
|
67
|
+
'cors-allowlist': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.8.26'],
|
|
68
|
+
'guest-executable-apex': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-001', 'SBS-CPORTAL-002'],
|
|
69
|
+
};
|
|
70
|
+
// NZ pack crosswalk — each check belongs to one domain; the domain's NZ control ids are
|
|
71
|
+
// layered onto its base entry. HISO/NZISM are domain/chapter-level drafts; Privacy Act IPPs
|
|
72
|
+
// are statute-level. All verified:false until the verification pass.
|
|
73
|
+
const NZ_CROSSWALK = [
|
|
74
|
+
{ controls: ['HISO-AC', 'NZISM-AC', 'PRIVACY-IPP5'],
|
|
75
|
+
checks: ['users-and-admins', 'permissions', 'sharing-model', 'public-group-sharing', 'guest-user-access',
|
|
76
|
+
'field-level-security', 'standard-profiles', 'api-client-permission', 'integration-users',
|
|
77
|
+
'escalation-perms', 'report-folder-access', 'apex-crud-fls', 'apex-rest-endpoint',
|
|
78
|
+
'guest-executable-apex', 'experience-cloud-site', 'content-links', 'apex-sharing', 'flows-without-sharing'] },
|
|
79
|
+
{ controls: ['HISO-AUTH', 'NZISM-AUTH', 'PRIVACY-IPP5'],
|
|
80
|
+
checks: ['login-session', 'ip-restrictions', 'password-session-policy', 'sso-enforcement', 'mfa-enforcement',
|
|
81
|
+
'trusted-ip-ranges', 'my-domain-login-policy', 'high-assurance-session', 'internal-user-mfa',
|
|
82
|
+
'mfa-registration', 'mfa-method-strength', 'failed-login-detection', 'enhanced-domains'] },
|
|
83
|
+
{ controls: ['HISO-CRYPTO', 'NZISM-CRYPTO', 'PRIVACY-IPP5'],
|
|
84
|
+
checks: ['named-credentials', 'hardcoded-credentials', 'custom-settings', 'certificate-expiry', 'custom-labels-credential'] },
|
|
85
|
+
{ controls: ['HISO-LOG', 'NZISM-LOG'],
|
|
86
|
+
checks: ['audit-trail', 'apex-logging', 'event-monitoring', 'siem-integration', 'anonymous-apex-audit',
|
|
87
|
+
'debug-log-access', 'transaction-security-policy'] },
|
|
88
|
+
{ controls: ['HISO-DEV', 'NZISM-SW'],
|
|
89
|
+
checks: ['code-security', 'visualforce-xss', 'scheduled-apex'] },
|
|
90
|
+
{ controls: ['HISO-COMM', 'NZISM-NET', 'PRIVACY-IPP12'],
|
|
91
|
+
checks: ['remote-sites', 'csp-trusted-sites', 'connected-apps', 'connected-app-scope', 'connected-app-inactivity', 'cors-allowlist'] },
|
|
92
|
+
{ controls: ['HISO-DATA', 'PRIVACY-IPP5'],
|
|
93
|
+
checks: ['data-classification', 'field-history-tracking'] },
|
|
94
|
+
{ controls: ['HISO-GOV', 'NZISM-CONFIG'],
|
|
95
|
+
checks: ['health-check', 'api-limits', 'release-updates', 'legacy-api-version', 'installed-packages', 'deployment-identity'] },
|
|
96
|
+
{ controls: ['PRIVACY-IPP9'],
|
|
97
|
+
checks: ['inactive-users'] },
|
|
98
|
+
];
|
|
99
|
+
function buildCheckControlMap() {
|
|
100
|
+
const map = {};
|
|
101
|
+
for (const [check, ids] of Object.entries(BASE_CHECK_CONTROL_MAP))
|
|
102
|
+
map[check] = [...ids];
|
|
103
|
+
for (const group of NZ_CROSSWALK) {
|
|
104
|
+
for (const check of group.checks) {
|
|
105
|
+
(map[check] ??= []).push(...group.controls);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return map;
|
|
109
|
+
}
|
|
110
|
+
export const CHECK_CONTROL_MAP = buildCheckControlMap();
|
|
111
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ControlDef, Framework, FrameworkPack } from './types.js';
|
|
2
|
+
export declare function packFrameworks(pack: FrameworkPack): Framework[];
|
|
3
|
+
export interface ResolveOptions {
|
|
4
|
+
frameworks?: Framework[];
|
|
5
|
+
requireVerified?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function resolveControls(checkId: string, opts?: ResolveOptions): ControlDef[];
|
|
8
|
+
/** Backward-compatible: the bare id strings, as the old ComplianceMapping returned. */
|
|
9
|
+
export declare function getComplianceTags(checkId: string): string[];
|
|
10
|
+
/** Resolve a --frameworks value: a pack name (universal|nz|all) or a comma list of aliases. */
|
|
11
|
+
export declare function resolveFrameworks(input: string): Framework[];
|
|
12
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CHECK_CONTROL_MAP } from './mapping.js';
|
|
2
|
+
import { getControl } from './catalogs/index.js';
|
|
3
|
+
const PACKS = {
|
|
4
|
+
universal: ['OWASP', 'SOC2', 'ISO27001'],
|
|
5
|
+
nz: ['ISO27001', 'HISO10029', 'PRIVACY_ACT', 'NZISM'],
|
|
6
|
+
all: ['OWASP', 'SOC2', 'ISO27001', 'SBS', 'HISO10029', 'PRIVACY_ACT', 'NZISM', 'HIPAA', 'GDPR'],
|
|
7
|
+
};
|
|
8
|
+
export function packFrameworks(pack) {
|
|
9
|
+
return PACKS[pack];
|
|
10
|
+
}
|
|
11
|
+
export function resolveControls(checkId, opts = {}) {
|
|
12
|
+
const requireVerified = opts.requireVerified ?? true;
|
|
13
|
+
const ids = CHECK_CONTROL_MAP[checkId] ?? [];
|
|
14
|
+
const out = [];
|
|
15
|
+
for (const id of ids) {
|
|
16
|
+
const c = getControl(id);
|
|
17
|
+
if (!c)
|
|
18
|
+
continue;
|
|
19
|
+
if (opts.frameworks && !opts.frameworks.includes(c.framework))
|
|
20
|
+
continue;
|
|
21
|
+
if (requireVerified && !c.verified)
|
|
22
|
+
continue;
|
|
23
|
+
out.push(c);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/** Backward-compatible: the bare id strings, as the old ComplianceMapping returned. */
|
|
28
|
+
export function getComplianceTags(checkId) {
|
|
29
|
+
return CHECK_CONTROL_MAP[checkId] ?? [];
|
|
30
|
+
}
|
|
31
|
+
const ALIAS = {
|
|
32
|
+
owasp: 'OWASP', soc2: 'SOC2', iso: 'ISO27001', iso27001: 'ISO27001', sbs: 'SBS',
|
|
33
|
+
privacy: 'PRIVACY_ACT', 'privacy-act': 'PRIVACY_ACT', hiso: 'HISO10029', nzism: 'NZISM',
|
|
34
|
+
hipaa: 'HIPAA', gdpr: 'GDPR',
|
|
35
|
+
};
|
|
36
|
+
/** Resolve a --frameworks value: a pack name (universal|nz|all) or a comma list of aliases. */
|
|
37
|
+
export function resolveFrameworks(input) {
|
|
38
|
+
const v = input.trim().toLowerCase();
|
|
39
|
+
if (v === 'universal' || v === 'nz' || v === 'all')
|
|
40
|
+
return packFrameworks(v);
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const part of v.split(',').map((s) => s.trim())) {
|
|
43
|
+
const fw = ALIAS[part];
|
|
44
|
+
if (fw && !out.includes(fw))
|
|
45
|
+
out.push(fw);
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Framework = 'OWASP' | 'SOC2' | 'ISO27001' | 'SBS' | 'HISO10029' | 'PRIVACY_ACT' | 'NZISM' | 'HIPAA' | 'GDPR';
|
|
2
|
+
export interface ControlDef {
|
|
3
|
+
id: string;
|
|
4
|
+
framework: Framework;
|
|
5
|
+
version: string;
|
|
6
|
+
title: string;
|
|
7
|
+
requirement: string;
|
|
8
|
+
sourceRef: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
verified: boolean;
|
|
11
|
+
}
|
|
12
|
+
export type FrameworkPack = 'universal' | 'nz' | 'all';
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -8,11 +8,31 @@ export interface ApexClassBody {
|
|
|
8
8
|
name: string;
|
|
9
9
|
body: string;
|
|
10
10
|
}
|
|
11
|
+
export interface VfPageBody {
|
|
12
|
+
name: string;
|
|
13
|
+
markup: string;
|
|
14
|
+
}
|
|
15
|
+
export interface EventLogSummary {
|
|
16
|
+
earliestDate: string | null;
|
|
17
|
+
totalFiles: number;
|
|
18
|
+
eventTypes: string[];
|
|
19
|
+
}
|
|
20
|
+
export interface MfaRegistration {
|
|
21
|
+
userId: string;
|
|
22
|
+
username: string;
|
|
23
|
+
profileName: string;
|
|
24
|
+
methods: string[];
|
|
25
|
+
}
|
|
11
26
|
export interface AuditCache {
|
|
12
27
|
healthCheckRisks?: HealthCheckRisk[];
|
|
13
28
|
apexBodies?: ApexClassBody[];
|
|
14
29
|
namedCredentialEndpoints?: string[];
|
|
15
30
|
remoteSiteUrls?: string[];
|
|
16
31
|
healthCloudInstalled?: boolean;
|
|
32
|
+
connectedAppNames?: string[];
|
|
33
|
+
scheduledApexClassNames?: string[];
|
|
34
|
+
eventLogSummary?: EventLogSummary;
|
|
35
|
+
mfaRegistrations?: MfaRegistration[];
|
|
36
|
+
vfPageBodies?: VfPageBody[];
|
|
17
37
|
}
|
|
18
38
|
//# sourceMappingURL=AuditCache.d.ts.map
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { SoqlClient } from '../api/SoqlClient.js';
|
|
2
2
|
import type { ToolingClient } from '../api/ToolingClient.js';
|
|
3
3
|
import type { RestClient } from '../api/RestClient.js';
|
|
4
|
-
import type { QueryRegistry } from '../queries/QueryRegistry.js';
|
|
5
4
|
import type { OrgInfo } from './OrgInfo.js';
|
|
6
5
|
import type { AuditCache } from './AuditCache.js';
|
|
7
6
|
export interface AuditContext {
|
|
8
7
|
readonly soql: SoqlClient;
|
|
9
8
|
readonly tooling: ToolingClient;
|
|
10
9
|
readonly rest: RestClient;
|
|
11
|
-
readonly queries: QueryRegistry;
|
|
12
10
|
readonly orgInfo: OrgInfo;
|
|
13
11
|
cache: AuditCache;
|
|
14
12
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Finding } from './Finding.js';
|
|
2
2
|
import type { OrgMetrics } from '../context/OrgMetrics.js';
|
|
3
|
+
import type { AttackChain } from '../chains/AttackChain.js';
|
|
3
4
|
export interface AuditResult {
|
|
4
5
|
generatedAt: Date;
|
|
5
6
|
orgId: string;
|
|
@@ -7,9 +8,11 @@ export interface AuditResult {
|
|
|
7
8
|
orgType: string;
|
|
8
9
|
isSandbox: boolean;
|
|
9
10
|
instance: string;
|
|
11
|
+
instanceUrl: string;
|
|
10
12
|
findings: Finding[];
|
|
11
13
|
metrics: OrgMetrics;
|
|
12
14
|
healthScore: number;
|
|
13
15
|
grade: 'A' | 'B' | 'C' | 'D' | 'F';
|
|
16
|
+
attackChains?: AttackChain[];
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=AuditResult.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CheckMeta {
|
|
2
|
+
/** Remediation effort tier: quick = ≤1 day, moderate = days, project = weeks. */
|
|
3
|
+
effort: 'quick' | 'moderate' | 'project';
|
|
4
|
+
/** One-sentence abuse/incident narrative for standalone (non-chained) top-N findings. */
|
|
5
|
+
impact: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CHECK_META: Record<string, CheckMeta>;
|
|
8
|
+
export declare function getCheckMeta(id: string): CheckMeta | undefined;
|
|
9
|
+
//# sourceMappingURL=CheckMeta.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const CHECK_META = {
|
|
2
|
+
'users-and-admins': { effort: 'moderate', impact: 'Over-privileged admins mean one compromised account can read, alter, or export the entire org’s data.' },
|
|
3
|
+
'permissions': { effort: 'moderate', impact: 'Permission-set sprawl widens the blast radius of any single account takeover.' },
|
|
4
|
+
'inactive-users': { effort: 'quick', impact: 'Dormant but active accounts are unmonitored entry points attackers reuse without raising suspicion.' },
|
|
5
|
+
'login-session': { effort: 'quick', impact: 'Weak session settings let a stolen session token stay valid long enough to be replayed.' },
|
|
6
|
+
'ip-restrictions': { effort: 'moderate', impact: 'Without IP restrictions, stolen admin credentials work from anywhere in the world.' },
|
|
7
|
+
'password-session-policy': { effort: 'quick', impact: 'Weak password and session policy makes credential guessing and session hijacking far easier.' },
|
|
8
|
+
'field-level-security': { effort: 'moderate', impact: 'Sensitive fields (SSN, card, tax id) exposed to broad permission sets leak PII to users who shouldn’t see it.' },
|
|
9
|
+
'sharing-model': { effort: 'project', impact: 'Loose org-wide defaults expose records org-wide; any internal user can read data meant to be private.' },
|
|
10
|
+
'public-group-sharing': { effort: 'moderate', impact: 'Sharing rules granting “All Internal Users” turn a low-privilege account into a path to sensitive records.' },
|
|
11
|
+
'guest-user-access': { effort: 'moderate', impact: 'Object access granted to unauthenticated guests lets anonymous web visitors read or modify records.' },
|
|
12
|
+
'apex-sharing': { effort: 'project', impact: 'without-sharing Apex bypasses record access, letting low-privilege or guest users reach data they can’t otherwise see.' },
|
|
13
|
+
'flows-without-sharing': { effort: 'moderate', impact: 'System-context flows without sharing run with elevated rights, exposing records to whoever triggers them.' },
|
|
14
|
+
'connected-apps': { effort: 'moderate', impact: 'Connected apps not admin-restricted let any user authorize a third-party app to act on org data.' },
|
|
15
|
+
'remote-sites': { effort: 'quick', impact: 'Permissive remote sites allow Apex callouts to attacker-controlled endpoints (SSRF and data exfiltration).' },
|
|
16
|
+
'csp-trusted-sites': { effort: 'quick', impact: 'Insecure HTTP CSP entries allow mixed-content loading and man-in-the-middle script injection.' },
|
|
17
|
+
'named-credentials': { effort: 'quick', impact: 'Unmanaged callout endpoints can send org data to unintended or attacker-controlled destinations.' },
|
|
18
|
+
'hardcoded-credentials': { effort: 'moderate', impact: 'Secrets embedded in Apex can be read by anyone with code access and reused to reach connected systems.' },
|
|
19
|
+
'custom-settings': { effort: 'quick', impact: 'Credential-like custom settings may store secrets readable by users who can query them.' },
|
|
20
|
+
'health-check': { effort: 'moderate', impact: 'Unaddressed Health Check high-risk settings are documented, exploitable misconfigurations.' },
|
|
21
|
+
'audit-trail': { effort: 'quick', impact: 'Without reviewing the audit trail, malicious permission changes and Login-As abuse go undetected.' },
|
|
22
|
+
'code-security': { effort: 'project', impact: 'Low Apex test coverage and injection-prone code hide exploitable vulnerabilities behind untested paths.' },
|
|
23
|
+
'api-limits': { effort: 'quick', impact: 'API exhaustion, deliberate or accidental, can cause denial of service for integrations and users.' },
|
|
24
|
+
'scheduled-apex': { effort: 'quick', impact: 'Unreviewed scheduled jobs can run unauthorized logic on a recurring basis unnoticed.' },
|
|
25
|
+
'standard-profiles': { effort: 'moderate', impact: 'Standard profiles grant broad default permissions; users on them often have more access than intended.' },
|
|
26
|
+
'sso-enforcement': { effort: 'project', impact: 'Without enforced SSO, username/password logins bypass your identity provider’s MFA and conditional access.' },
|
|
27
|
+
'mfa-enforcement': { effort: 'quick', impact: 'Portal/external users without MFA let a stolen password reach customer or partner data directly.' },
|
|
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
|
+
'integration-users': { effort: 'moderate', impact: 'Over-privileged service accounts are prime targets — one stolen key grants broad, unattended access.' },
|
|
30
|
+
'content-links': { effort: 'quick', impact: 'Public file links without expiry or password leak documents to anyone who finds the URL.' },
|
|
31
|
+
'field-history-tracking': { effort: 'quick', impact: 'Without field history, tampering with sensitive records can’t be reconstructed after an incident.' },
|
|
32
|
+
'data-classification': { effort: 'moderate', impact: 'Unclassified sensitive data can’t be protected or encrypted consistently, increasing exposure.' },
|
|
33
|
+
'deployment-identity': { effort: 'moderate', impact: 'No controlled deployment identity means malicious metadata changes blend in with normal admin activity.' },
|
|
34
|
+
'apex-logging': { effort: 'moderate', impact: 'Missing logging leaves no trail to detect or investigate abuse of Apex execution.' },
|
|
35
|
+
'event-monitoring': { effort: 'moderate', impact: 'Without Event Monitoring, data exfiltration and abuse leave no detailed forensic record.' },
|
|
36
|
+
'siem-integration': { effort: 'project', impact: 'No SIEM forwarding means security events are never correlated or alerted on outside the org.' },
|
|
37
|
+
'apex-crud-fls': { effort: 'project', impact: 'Apex skipping CRUD/FLS checks lets callers read or write records and fields they have no rights to.' },
|
|
38
|
+
'apex-rest-endpoint': { effort: 'project', impact: 'without-sharing @RestResource endpoints expose records to REST callers without record-level access control.' },
|
|
39
|
+
'visualforce-xss': { effort: 'moderate', impact: 'Unescaped Visualforce merge fields let attackers inject scripts that run in victims’ sessions.' },
|
|
40
|
+
'certificate-expiry': { effort: 'quick', impact: 'An expired certificate breaks integrations or, if ignored, invites insecure fallback.' },
|
|
41
|
+
'installed-packages': { effort: 'moderate', impact: 'Unmanaged or beta packages in production can carry unvetted code with broad org access.' },
|
|
42
|
+
'trusted-ip-ranges': { effort: 'quick', impact: 'Overly broad trusted IP ranges silently exempt large networks from MFA.' },
|
|
43
|
+
'anonymous-apex-audit': { effort: 'quick', impact: 'Anonymous Apex execution in production can run arbitrary privileged code leaving little trace.' },
|
|
44
|
+
'debug-log-access': { effort: 'quick', impact: 'Active high-detail debug traces capture sensitive field values readable by anyone with log access.' },
|
|
45
|
+
'connected-app-inactivity': { effort: 'quick', impact: 'Stale connected apps remain authorized attack surface long after they’re abandoned.' },
|
|
46
|
+
'my-domain-login-policy': { effort: 'quick', impact: 'Allowing login.salesforce.com login bypasses My Domain SSO enforcement.' },
|
|
47
|
+
'high-assurance-session': { effort: 'moderate', impact: 'Admin-capable apps without short or high-assurance sessions let a hijacked session retain elevated rights.' },
|
|
48
|
+
'enhanced-domains': { effort: 'moderate', impact: 'Without Enhanced Domains, cross-org cookie leakage and URL spoofing become possible.' },
|
|
49
|
+
'internal-user-mfa': { effort: 'quick', impact: 'A stolen or guessed admin password grants full org access with no second factor to stop it.' },
|
|
50
|
+
'mfa-registration': { effort: 'quick', impact: 'Users with no registered MFA method are effectively single-factor and easily phished.' },
|
|
51
|
+
'mfa-method-strength': { effort: 'moderate', impact: 'Weak MFA methods such as SMS are bypassable via SIM-swap and real-time phishing.' },
|
|
52
|
+
'release-updates': { effort: 'quick', impact: 'Ignored release updates leave known-deprecated, sometimes insecure behavior active past its deadline.' },
|
|
53
|
+
'legacy-api-version': { effort: 'moderate', impact: 'Apex on old API versions and SOAP remote sites carry deprecated, less-secure behavior.' },
|
|
54
|
+
'connected-app-scope': { effort: 'moderate', impact: 'Full-scope OAuth grants and infinite refresh tokens make a single leaked token catastrophic.' },
|
|
55
|
+
'transaction-security-policy': { effort: 'moderate', impact: 'Without transaction security policies, automated threats like bulk export or anomalous logins go unblocked.' },
|
|
56
|
+
'failed-login-detection': { effort: 'quick', impact: 'No brute-force detection means credential-stuffing campaigns run unnoticed until they succeed.' },
|
|
57
|
+
'experience-cloud-site': { effort: 'moderate', impact: 'Self-registration on live sites lets attackers create their own accounts to probe guest-accessible data.' },
|
|
58
|
+
'custom-labels-credential': { effort: 'quick', impact: 'Credentials in custom labels are globally readable by all authenticated users via merge fields.' },
|
|
59
|
+
'report-folder-access': { effort: 'quick', impact: 'Public report folders let any authenticated user view all reports and the data behind them — mass exfiltration.' },
|
|
60
|
+
'escalation-perms': { effort: 'moderate', impact: 'Lateral-movement permissions let a compromised account grant itself more access and persist.' },
|
|
61
|
+
'cors-allowlist': { effort: 'quick', impact: 'Wildcard CORS origins let malicious sites make authenticated browser requests against the org.' },
|
|
62
|
+
'guest-executable-apex': { effort: 'project', impact: 'Unauthenticated web users can execute Apex that bypasses sharing — bulk record exfiltration without login.' },
|
|
63
|
+
};
|
|
64
|
+
export function getCheckMeta(id) {
|
|
65
|
+
return CHECK_META[id];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=CheckMeta.js.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Maps each SecurityCheck `id` to its compliance framework references.
|
|
2
|
+
// Tags use the format: <Framework>-<Control> e.g. OWASP-A01, SOC2-CC6.1, ISO-A.9.2, SBS-<domain>-<num>
|
|
3
|
+
export const COMPLIANCE_MAP = {
|
|
4
|
+
'users-and-admins': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.2', 'HIPAA-164.312a', 'GDPR-Art.32', 'SBS-ACS-004'],
|
|
5
|
+
'permissions': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.2', 'GDPR-Art.32', 'SBS-ACS-002', 'SBS-ACS-005'],
|
|
6
|
+
'inactive-users': ['OWASP-A01', 'SOC2-CC6.2', 'ISO-A.9.2', 'HIPAA-164.312a', 'GDPR-Art.5', 'SBS-ACS-007'],
|
|
7
|
+
'login-session': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32'],
|
|
8
|
+
'ip-restrictions': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32', 'SBS-AUTH-003'],
|
|
9
|
+
'password-session-policy': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32'],
|
|
10
|
+
'field-level-security': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.5'],
|
|
11
|
+
'sharing-model': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32'],
|
|
12
|
+
'public-group-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32'],
|
|
13
|
+
'guest-user-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.2', 'GDPR-Art.32', 'SBS-CPORTAL-002'],
|
|
14
|
+
'apex-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-CPORTAL-001'],
|
|
15
|
+
'flows-without-sharing': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-CPORTAL-004'],
|
|
16
|
+
'connected-apps': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-OAUTH-001', 'SBS-OAUTH-002', 'SBS-DEP-006'],
|
|
17
|
+
'remote-sites': ['OWASP-A05', 'SOC2-CC6.4', 'ISO-A.14.1', 'GDPR-Art.32', 'SBS-INT-002'],
|
|
18
|
+
'csp-trusted-sites': ['OWASP-A05', 'SOC2-CC6.4', 'ISO-A.14.1', 'GDPR-Art.32'],
|
|
19
|
+
'named-credentials': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-INT-003'],
|
|
20
|
+
'hardcoded-credentials': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-DEP-005'],
|
|
21
|
+
'custom-settings': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.9.4', 'GDPR-Art.32'],
|
|
22
|
+
'health-check': ['OWASP-A05', 'SOC2-CC7.1', 'ISO-A.12.6', 'GDPR-Art.32', 'SBS-SECCONF-001', 'SBS-SECCONF-002'],
|
|
23
|
+
'audit-trail': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-MON-002'],
|
|
24
|
+
'code-security': ['OWASP-A03', 'OWASP-A05', 'SOC2-CC7.2', 'ISO-A.14.2', 'GDPR-Art.32', 'SBS-CODE-002'],
|
|
25
|
+
'api-limits': ['OWASP-A05', 'SOC2-CC9.1', 'ISO-A.12.6', 'GDPR-Art.32', 'SBS-MON-005'],
|
|
26
|
+
'scheduled-apex': ['OWASP-A05', 'SOC2-CC7.2', 'ISO-A.12.1', 'GDPR-Art.32'],
|
|
27
|
+
// Net-new SBS checks
|
|
28
|
+
'standard-profiles': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.9.2', 'GDPR-Art.32', 'SBS-ACS-005'],
|
|
29
|
+
'sso-enforcement': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-AUTH-001', 'SBS-AUTH-002'],
|
|
30
|
+
'mfa-enforcement': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-AUTH-004'],
|
|
31
|
+
'api-client-permission': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-ACS-006'],
|
|
32
|
+
'integration-users': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.2', 'GDPR-Art.32', 'SBS-ACS-007', 'SBS-ACS-008', 'SBS-ACS-009'],
|
|
33
|
+
'content-links': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.13.2', 'GDPR-Art.32', 'SBS-FILE-001', 'SBS-FILE-002', 'SBS-FILE-003'],
|
|
34
|
+
'field-history-tracking': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-DATA-004'],
|
|
35
|
+
'data-classification': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.2', 'HIPAA-164.514', 'GDPR-Art.30', 'SBS-DATA-001', 'SBS-DATA-002', 'SBS-DATA-003'],
|
|
36
|
+
'deployment-identity': ['OWASP-A05', 'SOC2-CC8.1', 'ISO-A.12.1', 'GDPR-Art.32', 'SBS-DEP-001', 'SBS-DEP-003'],
|
|
37
|
+
'apex-logging': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'GDPR-Art.32', 'SBS-CODE-003', 'SBS-CODE-004'],
|
|
38
|
+
'event-monitoring': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-MON-001', 'SBS-INT-004'],
|
|
39
|
+
'siem-integration': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-MON-003', 'SBS-MON-004'],
|
|
40
|
+
// Additional security checks
|
|
41
|
+
'apex-crud-fls': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32'],
|
|
42
|
+
'apex-rest-endpoint': ['OWASP-A01', 'OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'GDPR-Art.32'],
|
|
43
|
+
'visualforce-xss': ['OWASP-A03', 'SOC2-CC6.1', 'ISO-A.14.2', 'GDPR-Art.32'],
|
|
44
|
+
'certificate-expiry': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.10.1', 'HIPAA-164.312e', 'GDPR-Art.32'],
|
|
45
|
+
'installed-packages': ['OWASP-A06', 'SOC2-CC9.2', 'ISO-A.14.2', 'GDPR-Art.32'],
|
|
46
|
+
'trusted-ip-ranges': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-AUTH-003'],
|
|
47
|
+
'anonymous-apex-audit': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'GDPR-Art.32'],
|
|
48
|
+
'debug-log-access': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32'],
|
|
49
|
+
'connected-app-inactivity': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.9.2', 'GDPR-Art.32'],
|
|
50
|
+
'my-domain-login-policy': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-AUTH-001'],
|
|
51
|
+
'high-assurance-session': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32'],
|
|
52
|
+
'enhanced-domains': ['OWASP-A05', 'SOC2-CC6.1', 'ISO-A.14.1', 'GDPR-Art.32'],
|
|
53
|
+
// Recent Salesforce MFA improvements
|
|
54
|
+
'internal-user-mfa': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32', 'SBS-AUTH-004'],
|
|
55
|
+
'mfa-registration': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32'],
|
|
56
|
+
'mfa-method-strength': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32'],
|
|
57
|
+
// Platform hygiene + API security
|
|
58
|
+
'release-updates': ['OWASP-A06', 'SOC2-CC7.1', 'ISO-A.12.6', 'GDPR-Art.32'],
|
|
59
|
+
'legacy-api-version': ['OWASP-A06', 'SOC2-CC6.4', 'ISO-A.12.6', 'GDPR-Art.32'],
|
|
60
|
+
'connected-app-scope': ['OWASP-A01', 'OWASP-A05', 'SOC2-CC6.6', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-OAUTH-002'],
|
|
61
|
+
// Threat detection + hacker attack surface coverage
|
|
62
|
+
'transaction-security-policy': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-MON-003'],
|
|
63
|
+
'failed-login-detection': ['OWASP-A07', 'SOC2-CC7.2', 'ISO-A.12.4', 'HIPAA-164.312b', 'GDPR-Art.32', 'SBS-MON-003'],
|
|
64
|
+
'experience-cloud-site': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-CPORTAL-003'],
|
|
65
|
+
'custom-labels-credential': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.9.4', 'HIPAA-164.312d', 'GDPR-Art.32'],
|
|
66
|
+
'report-folder-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'HIPAA-164.312a', 'GDPR-Art.32'],
|
|
67
|
+
// Attack-chain ingredient checks
|
|
68
|
+
'escalation-perms': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.9.2', 'HIPAA-164.312a', 'GDPR-Art.32', 'SBS-ACS-004'],
|
|
69
|
+
'cors-allowlist': ['OWASP-A05', 'SOC2-CC6.4', 'ISO-A.14.1', 'GDPR-Art.32'],
|
|
70
|
+
'guest-executable-apex': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.9.4', 'GDPR-Art.32', 'SBS-CPORTAL-001', 'SBS-CPORTAL-002'],
|
|
71
|
+
};
|
|
72
|
+
export function getComplianceTags(checkId) {
|
|
73
|
+
return COMPLIANCE_MAP[checkId] ?? [];
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ComplianceMapping.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RiskLevel } from './RiskLevel.js';
|
|
2
|
+
import type { Capability } from '../chains/Capability.js';
|
|
2
3
|
export interface AffectedItem {
|
|
3
4
|
label: string;
|
|
4
5
|
url?: string;
|
|
@@ -24,5 +25,24 @@ export interface Finding {
|
|
|
24
25
|
affectedItems?: AffectedItem[];
|
|
25
26
|
/** True when the finding represents a passing check (everything is correctly configured). */
|
|
26
27
|
passed?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Compliance framework tags, e.g. ['OWASP-A01', 'SOC2-CC6.1'].
|
|
30
|
+
* Populated by CheckEngine from ComplianceMapping after each check runs.
|
|
31
|
+
*/
|
|
32
|
+
complianceTags?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* True when the check could not gather evidence due to insufficient permissions.
|
|
35
|
+
* Scored as INFO (no impact on health score) but displayed distinctly.
|
|
36
|
+
*/
|
|
37
|
+
inconclusive?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Optional inline attacker-capability declaration for findings produced by
|
|
40
|
+
* chain-aware checks. When present, it overrides the central CapabilityRegistry
|
|
41
|
+
* entry for this finding id. Only honoured for active (non-passed, non-inconclusive) findings.
|
|
42
|
+
*/
|
|
43
|
+
capabilities?: {
|
|
44
|
+
grants?: Capability[];
|
|
45
|
+
requires?: Capability[];
|
|
46
|
+
};
|
|
27
47
|
}
|
|
28
48
|
//# sourceMappingURL=Finding.d.ts.map
|
|
@@ -10,11 +10,18 @@ export function loadScoringConfig(filePath, knownCheckIds, warn) {
|
|
|
10
10
|
catch (err) {
|
|
11
11
|
throw new Error(`Cannot read scoring config file '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
let parsed;
|
|
14
|
+
try {
|
|
15
|
+
parsed = JSON.parse(raw);
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
throw new Error(`Invalid JSON in scoring config '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
|
|
19
|
+
}
|
|
14
20
|
const validated = scoringConfigSchema.parse(parsed); // throws ZodError on failure
|
|
15
21
|
// Warn on unknown check IDs and drop them
|
|
16
22
|
const safeCheckWeights = {};
|
|
17
|
-
|
|
23
|
+
const rawWeights = validated.checkWeights ?? {};
|
|
24
|
+
for (const [id, weight] of Object.entries(rawWeights)) {
|
|
18
25
|
if (!knownCheckIds.has(id)) {
|
|
19
26
|
warn(`Unknown check ID in --scoring-config checkWeights: '${id}'. Run 'sf audit list' to see valid IDs. Skipping.`);
|
|
20
27
|
}
|
|
@@ -3,5 +3,6 @@ import type { OrgMetrics } from '../context/OrgMetrics.js';
|
|
|
3
3
|
import type { AuditResult } from './AuditResult.js';
|
|
4
4
|
import type { AuditContext } from '../context/AuditContext.js';
|
|
5
5
|
import type { ScoringConfig } from './ScoringConfig.js';
|
|
6
|
-
|
|
6
|
+
import type { AttackChain } from '../chains/AttackChain.js';
|
|
7
|
+
export declare function buildAuditResult(ctx: AuditContext, findings: Finding[], metrics: Partial<OrgMetrics>, config?: ScoringConfig, attackChains?: AttackChain[]): AuditResult;
|
|
7
8
|
//# sourceMappingURL=scoring.d.ts.map
|
package/lib/findings/scoring.js
CHANGED
|
@@ -11,13 +11,24 @@ function meetsConditions(conditions, healthScore, criticalCount, highCount, medi
|
|
|
11
11
|
return false;
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORING_CONFIG) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORING_CONFIG, attackChains = []) {
|
|
15
|
+
// Passed and inconclusive findings carry no penalty — exclude from numerator.
|
|
16
|
+
// They remain in maxPossible so a broad passing audit still dilutes real failures.
|
|
17
|
+
const totalScore = findings.reduce((sum, f) => {
|
|
18
|
+
if (f.passed || f.inconclusive)
|
|
19
|
+
return sum;
|
|
20
|
+
return sum + (f.checkId !== undefined ? (config.checkWeights[f.checkId] ?? config.riskScores[f.riskLevel]) : config.riskScores[f.riskLevel]);
|
|
21
|
+
}, 0);
|
|
22
|
+
const chainScore = attackChains.reduce((sum, c) => sum + config.riskScores[c.severity], 0);
|
|
23
|
+
const totalWithChains = totalScore + chainScore;
|
|
24
|
+
const maxPossible = (findings.length + attackChains.length) * 10;
|
|
25
|
+
const healthScore = Math.max(0, 100 - Math.round((totalWithChains / Math.max(maxPossible, 1)) * 100));
|
|
26
|
+
const chainCrit = attackChains.filter((c) => c.severity === 'CRITICAL').length;
|
|
27
|
+
const chainHigh = attackChains.filter((c) => c.severity === 'HIGH').length;
|
|
28
|
+
const chainMed = attackChains.filter((c) => c.severity === 'MEDIUM').length;
|
|
29
|
+
const criticalCount = findings.filter((f) => f.riskLevel === 'CRITICAL').length + chainCrit;
|
|
30
|
+
const highCount = findings.filter((f) => f.riskLevel === 'HIGH').length + chainHigh;
|
|
31
|
+
const mediumCount = findings.filter((f) => f.riskLevel === 'MEDIUM').length + chainMed;
|
|
21
32
|
const grades = ['A', 'B', 'C', 'D'];
|
|
22
33
|
let grade = 'F';
|
|
23
34
|
for (const g of grades) {
|
|
@@ -33,10 +44,12 @@ export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORIN
|
|
|
33
44
|
orgType: ctx.orgInfo.type,
|
|
34
45
|
isSandbox: ctx.orgInfo.isSandbox,
|
|
35
46
|
instance: ctx.orgInfo.instance,
|
|
47
|
+
instanceUrl: ctx.orgInfo.instanceUrl,
|
|
36
48
|
findings,
|
|
37
49
|
metrics: { ...EMPTY_METRICS, ...metrics },
|
|
38
50
|
healthScore,
|
|
39
51
|
grade,
|
|
52
|
+
attackChains,
|
|
40
53
|
};
|
|
41
54
|
}
|
|
42
55
|
//# sourceMappingURL=scoring.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Finding } from '../findings/Finding.js';
|
|
2
|
+
import type { OrgMetrics } from '../context/OrgMetrics.js';
|
|
3
|
+
import type { AuditResult } from '../findings/AuditResult.js';
|
|
4
|
+
export type FindingChangeType = 'new' | 'resolved' | 'severity-changed' | 'detail-changed' | 'unchanged';
|
|
5
|
+
export interface FindingChange {
|
|
6
|
+
type: FindingChangeType;
|
|
7
|
+
finding: Finding;
|
|
8
|
+
previous?: Finding;
|
|
9
|
+
}
|
|
10
|
+
export interface MetricDelta {
|
|
11
|
+
key: keyof OrgMetrics;
|
|
12
|
+
label: string;
|
|
13
|
+
before: number;
|
|
14
|
+
after: number;
|
|
15
|
+
delta: number;
|
|
16
|
+
direction: 'improved' | 'degraded' | 'neutral';
|
|
17
|
+
}
|
|
18
|
+
export interface AuditDiff {
|
|
19
|
+
baseline: AuditResult;
|
|
20
|
+
current: AuditResult;
|
|
21
|
+
findingChanges: FindingChange[];
|
|
22
|
+
metricDeltas: MetricDelta[];
|
|
23
|
+
scoreDelta: number;
|
|
24
|
+
gradeDelta: string;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=AuditDiff.d.ts.map
|