@cclabsnz/sf-audit 1.1.0 → 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.
Files changed (52) hide show
  1. package/README.md +153 -31
  2. package/lib/checks/CheckEngine.js +1 -1
  3. package/lib/commands/audit/security.d.ts +5 -0
  4. package/lib/commands/audit/security.js +32 -3
  5. package/lib/compliance/catalogs/hiso10029.d.ts +3 -0
  6. package/lib/compliance/catalogs/hiso10029.js +35 -0
  7. package/lib/compliance/catalogs/index.d.ts +4 -0
  8. package/lib/compliance/catalogs/index.js +21 -0
  9. package/lib/compliance/catalogs/iso27001.d.ts +3 -0
  10. package/lib/compliance/catalogs/iso27001.js +39 -0
  11. package/lib/compliance/catalogs/nzism.d.ts +3 -0
  12. package/lib/compliance/catalogs/nzism.js +31 -0
  13. package/lib/compliance/catalogs/owasp.d.ts +3 -0
  14. package/lib/compliance/catalogs/owasp.js +37 -0
  15. package/lib/compliance/catalogs/privacyAct.d.ts +3 -0
  16. package/lib/compliance/catalogs/privacyAct.js +17 -0
  17. package/lib/compliance/catalogs/sbs.d.ts +3 -0
  18. package/lib/compliance/catalogs/sbs.js +61 -0
  19. package/lib/compliance/catalogs/soc2.d.ts +3 -0
  20. package/lib/compliance/catalogs/soc2.js +42 -0
  21. package/lib/compliance/mapping.d.ts +2 -0
  22. package/lib/compliance/mapping.js +111 -0
  23. package/lib/compliance/resolve.d.ts +12 -0
  24. package/lib/compliance/resolve.js +49 -0
  25. package/lib/compliance/types.d.ts +13 -0
  26. package/lib/compliance/types.js +2 -0
  27. package/lib/findings/CheckMeta.d.ts +9 -0
  28. package/lib/findings/CheckMeta.js +67 -0
  29. package/lib/renderers/AuditRenderer.d.ts +2 -0
  30. package/lib/renderers/ClientReportRenderer.d.ts +29 -0
  31. package/lib/renderers/ClientReportRenderer.js +205 -0
  32. package/lib/renderers/HtmlRenderer.js +1 -7
  33. package/lib/renderers/html-utils.d.ts +2 -0
  34. package/lib/renderers/html-utils.js +8 -0
  35. package/lib/report/ComplianceMatrix.d.ts +19 -0
  36. package/lib/report/ComplianceMatrix.js +47 -0
  37. package/lib/report/ExecutivePriorities.d.ts +8 -0
  38. package/lib/report/ExecutivePriorities.js +22 -0
  39. package/lib/report/RemediationRoadmap.d.ts +9 -0
  40. package/lib/report/RemediationRoadmap.js +18 -0
  41. package/lib/report/branding.d.ts +18 -0
  42. package/lib/report/branding.js +19 -0
  43. package/lib/report/fonts.d.ts +2 -0
  44. package/lib/report/fonts.js +22 -0
  45. package/package.json +2 -1
  46. package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
  47. package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
  48. package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
  49. package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
  50. package/config/queries/soql.json +0 -24
  51. package/config/queries/tooling.json +0 -28
  52. package/config/scoring.json +0 -17
@@ -0,0 +1,61 @@
1
+ // Security Benchmark for Salesforce (SBS) — an independent, public Salesforce security standard.
2
+ // Titles VERIFIED 2026-06 against the official catalog: https://docs.securitybenchmark.org/controls-at-a-glance.html
3
+ // `title` is the verbatim official control statement; `requirement` is a faithful one-line summary.
4
+ const V = 'Security Benchmark for Salesforce (SBS)';
5
+ const ref = (id) => `Security Benchmark for Salesforce, ${id}`;
6
+ const URL = 'https://docs.securitybenchmark.org/controls-at-a-glance.html';
7
+ export const SBS_CONTROLS = [
8
+ // Access Controls
9
+ { id: 'SBS-ACS-002', framework: 'SBS', version: V, title: 'Documented Justification for All API-Enabled Authorizations', requirement: 'Every grant of the API Enabled permission is justified and documented.', sourceRef: ref('SBS-ACS-002'), url: URL, verified: true },
10
+ { id: 'SBS-ACS-004', framework: 'SBS', version: V, title: 'Documented Justification for All Super Admin–Equivalent Users', requirement: 'Users with super-admin-equivalent permissions (Modify All Data, etc.) are justified and documented.', sourceRef: ref('SBS-ACS-004'), url: URL, verified: true },
11
+ { id: 'SBS-ACS-005', framework: 'SBS', version: V, title: 'Only Use Custom Profiles for Active Users', requirement: 'Active users are assigned least-privilege custom profiles, not standard profiles.', sourceRef: ref('SBS-ACS-005'), url: URL, verified: true },
12
+ { id: 'SBS-ACS-006', framework: 'SBS', version: V, title: 'Documented Justification for Use Any API Client Permission', requirement: 'Every grant of the "Use Any API Client" permission is justified and documented.', sourceRef: ref('SBS-ACS-006'), url: URL, verified: true },
13
+ { id: 'SBS-ACS-007', framework: 'SBS', version: V, title: 'Maintain Inventory of Non-Human Identities', requirement: 'A current inventory of non-human/integration identities is maintained.', sourceRef: ref('SBS-ACS-007'), url: URL, verified: true },
14
+ { id: 'SBS-ACS-008', framework: 'SBS', version: V, title: 'Restrict Broad Privileges for Non-Human Identities', requirement: 'Non-human identities are not granted broad or excessive privileges.', sourceRef: ref('SBS-ACS-008'), url: URL, verified: true },
15
+ { id: 'SBS-ACS-009', framework: 'SBS', version: V, title: 'Implement Compensating Controls for Privileged Non-Human Identities', requirement: 'Privileged non-human identities have compensating controls (IP restriction, monitoring).', sourceRef: ref('SBS-ACS-009'), url: URL, verified: true },
16
+ // Authentication
17
+ { id: 'SBS-AUTH-001', framework: 'SBS', version: V, title: 'Enable Organization-Wide SSO Enforcement Setting', requirement: 'Org-wide single sign-on enforcement is enabled.', sourceRef: ref('SBS-AUTH-001'), url: URL, verified: true },
18
+ { id: 'SBS-AUTH-002', framework: 'SBS', version: V, title: 'Govern and Document All Users Permitted to Bypass Single Sign-On', requirement: 'Users allowed to bypass SSO are governed and documented.', sourceRef: ref('SBS-AUTH-002'), url: URL, verified: true },
19
+ { id: 'SBS-AUTH-003', framework: 'SBS', version: V, title: 'Prohibit Broad or Unrestricted Profile Login IP Ranges', requirement: 'Profile login IP ranges are not broad or unrestricted (which would bypass MFA).', sourceRef: ref('SBS-AUTH-003'), url: URL, verified: true },
20
+ { id: 'SBS-AUTH-004', framework: 'SBS', version: V, title: 'Enforce Strong Multi-Factor Authentication for External Users', requirement: 'Strong MFA is enforced for external/portal users.', sourceRef: ref('SBS-AUTH-004'), url: URL, verified: true },
21
+ // Code Security
22
+ { id: 'SBS-CODE-002', framework: 'SBS', version: V, title: 'Pre-Merge Static Code Analysis for Apex and LWC', requirement: 'Static code analysis runs on Apex and LWC before merge.', sourceRef: ref('SBS-CODE-002'), url: URL, verified: true },
23
+ { id: 'SBS-CODE-003', framework: 'SBS', version: V, title: 'Implement Persistent Apex Application Logging', requirement: 'A persistent Apex application logging framework is in place.', sourceRef: ref('SBS-CODE-003'), url: URL, verified: true },
24
+ { id: 'SBS-CODE-004', framework: 'SBS', version: V, title: 'Prevent Sensitive Data in Application Logs', requirement: 'Application logs do not capture sensitive data.', sourceRef: ref('SBS-CODE-004'), url: URL, verified: true },
25
+ // Customer Portals
26
+ { id: 'SBS-CPORTAL-001', framework: 'SBS', version: V, title: 'Prevent Parameter-Based Record Access in Portal Apex', requirement: 'Portal-reachable Apex does not allow parameter-based record access bypassing sharing.', sourceRef: ref('SBS-CPORTAL-001'), url: URL, verified: true },
27
+ { id: 'SBS-CPORTAL-002', framework: 'SBS', version: V, title: 'Restrict Guest User Record Access', requirement: 'Guest user record access is restricted to the minimum necessary.', sourceRef: ref('SBS-CPORTAL-002'), url: URL, verified: true },
28
+ { id: 'SBS-CPORTAL-003', framework: 'SBS', version: V, title: 'Inventory Portal-Exposed Apex Classes and Flows', requirement: 'Portal-exposed Apex classes and flows are inventoried.', sourceRef: ref('SBS-CPORTAL-003'), url: URL, verified: true },
29
+ { id: 'SBS-CPORTAL-004', framework: 'SBS', version: V, title: 'Prevent Parameter-Based Record Access in Portal-Exposed Flows', requirement: 'Portal-exposed flows do not allow parameter-based record access bypassing sharing.', sourceRef: ref('SBS-CPORTAL-004'), url: URL, verified: true },
30
+ // Data Security
31
+ { id: 'SBS-DATA-001', framework: 'SBS', version: V, title: 'Implement Mechanisms to Detect Regulated Data in Long Text Fields', requirement: 'Mechanisms detect regulated data stored in long text fields.', sourceRef: ref('SBS-DATA-001'), url: URL, verified: true },
32
+ { id: 'SBS-DATA-002', framework: 'SBS', version: V, title: 'Maintain an Inventory of Long Text Area Fields Containing Data', requirement: 'An inventory of long text area fields containing data is maintained.', sourceRef: ref('SBS-DATA-002'), url: URL, verified: true },
33
+ { id: 'SBS-DATA-003', framework: 'SBS', version: V, title: 'Maintain Tested Backup and Recovery for Salesforce Data', requirement: 'Tested backup and recovery is maintained for Salesforce data.', sourceRef: ref('SBS-DATA-003'), url: URL, verified: true },
34
+ { id: 'SBS-DATA-004', framework: 'SBS', version: V, title: 'Require Field History Tracking for Sensitive Fields', requirement: 'Field history tracking is enabled for sensitive fields.', sourceRef: ref('SBS-DATA-004'), url: URL, verified: true },
35
+ // Deployments
36
+ { id: 'SBS-DEP-001', framework: 'SBS', version: V, title: 'Require a Designated Deployment Identity for Metadata Changes', requirement: 'Metadata changes deploy under a designated deployment identity.', sourceRef: ref('SBS-DEP-001'), url: URL, verified: true },
37
+ { id: 'SBS-DEP-003', framework: 'SBS', version: V, title: 'Monitor and Alert on Unauthorized Modifications to High-Risk Metadata', requirement: 'Unauthorized changes to high-risk metadata are monitored and alerted.', sourceRef: ref('SBS-DEP-003'), url: URL, verified: true },
38
+ { id: 'SBS-DEP-005', framework: 'SBS', version: V, title: 'Implement Secret Scanning for Salesforce Source Repositories', requirement: 'Secret scanning runs on Salesforce source repositories.', sourceRef: ref('SBS-DEP-005'), url: URL, verified: true },
39
+ { id: 'SBS-DEP-006', framework: 'SBS', version: V, title: 'Configure Salesforce CLI Connected App with Token Expiration', requirement: 'The Salesforce CLI connected app is configured with token expiration.', sourceRef: ref('SBS-DEP-006'), url: URL, verified: true },
40
+ // File Security
41
+ { id: 'SBS-FILE-001', framework: 'SBS', version: V, title: 'Require Expiry Dates on Public Content Links', requirement: 'Public content links require expiry dates.', sourceRef: ref('SBS-FILE-001'), url: URL, verified: true },
42
+ { id: 'SBS-FILE-002', framework: 'SBS', version: V, title: 'Require Passwords on Public Content Links for Sensitive Content', requirement: 'Public content links for sensitive content require passwords.', sourceRef: ref('SBS-FILE-002'), url: URL, verified: true },
43
+ { id: 'SBS-FILE-003', framework: 'SBS', version: V, title: 'Periodic Review and Cleanup of Public Content Links', requirement: 'Public content links are periodically reviewed and cleaned up.', sourceRef: ref('SBS-FILE-003'), url: URL, verified: true },
44
+ // Integrations
45
+ { id: 'SBS-INT-002', framework: 'SBS', version: V, title: 'Inventory and Justification of Remote Site Settings', requirement: 'Remote site settings are inventoried and justified.', sourceRef: ref('SBS-INT-002'), url: URL, verified: true },
46
+ { id: 'SBS-INT-003', framework: 'SBS', version: V, title: 'Inventory and Justification of Named Credentials', requirement: 'Named credentials are inventoried and justified.', sourceRef: ref('SBS-INT-003'), url: URL, verified: true },
47
+ { id: 'SBS-INT-004', framework: 'SBS', version: V, title: 'Retain API Total Usage Event Logs for 30 Days', requirement: 'API Total Usage event logs are retained for at least 30 days.', sourceRef: ref('SBS-INT-004'), url: URL, verified: true },
48
+ // Event Monitoring
49
+ { id: 'SBS-MON-001', framework: 'SBS', version: V, title: 'Enable Event Monitoring Log Storage', requirement: 'Event Monitoring log storage is enabled.', sourceRef: ref('SBS-MON-001'), url: URL, verified: true },
50
+ { id: 'SBS-MON-002', framework: 'SBS', version: V, title: 'Retaining Event Logs', requirement: 'Event logs are retained for an adequate period.', sourceRef: ref('SBS-MON-002'), url: URL, verified: true },
51
+ { id: 'SBS-MON-003', framework: 'SBS', version: V, title: 'Monitor for Suspicious Logins', requirement: 'Suspicious logins are monitored and alerted.', sourceRef: ref('SBS-MON-003'), url: URL, verified: true },
52
+ { id: 'SBS-MON-004', framework: 'SBS', version: V, title: 'Monitor for Suspicious API Activity', requirement: 'Suspicious API activity is monitored and alerted.', sourceRef: ref('SBS-MON-004'), url: URL, verified: true },
53
+ { id: 'SBS-MON-005', framework: 'SBS', version: V, title: 'Monitor API Usage Against Limits', requirement: 'API usage is monitored against daily and concurrent limits.', sourceRef: ref('SBS-MON-005'), url: URL, verified: true },
54
+ // OAuth Security
55
+ { id: 'SBS-OAUTH-001', framework: 'SBS', version: V, title: 'Require Formal Installation of Connected Apps', requirement: 'Connected apps require formal installation.', sourceRef: ref('SBS-OAUTH-001'), url: URL, verified: true },
56
+ { id: 'SBS-OAUTH-002', framework: 'SBS', version: V, title: 'Require Profile or Permission Set Access Control for Connected Apps', requirement: 'Connected apps require profile or permission-set access control (admin-approved users).', sourceRef: ref('SBS-OAUTH-002'), url: URL, verified: true },
57
+ // Security Configuration
58
+ { id: 'SBS-SECCONF-001', framework: 'SBS', version: V, title: 'Establish a Salesforce Health Check Baseline', requirement: 'A Salesforce Health Check baseline is established.', sourceRef: ref('SBS-SECCONF-001'), url: URL, verified: true },
59
+ { id: 'SBS-SECCONF-002', framework: 'SBS', version: V, title: 'Review and Remediate Salesforce Health Check Deviations', requirement: 'Health Check deviations from baseline are reviewed and remediated.', sourceRef: ref('SBS-SECCONF-002'), url: URL, verified: true },
60
+ ];
61
+ //# sourceMappingURL=sbs.js.map
@@ -0,0 +1,3 @@
1
+ import type { ControlDef } from '../types.js';
2
+ export declare const SOC2_CONTROLS: ControlDef[];
3
+ //# sourceMappingURL=soc2.d.ts.map
@@ -0,0 +1,42 @@
1
+ // SOC 2 Common Criteria (AICPA Trust Services Criteria, 2017 with 2022 revised points of focus).
2
+ // Titles/intent confirmed 2026-06 against the AICPA TSC structure via authoritative secondary
3
+ // sources; the primary AICPA TSC document is the canonical reference. `requirement` is a faithful
4
+ // paraphrase of each criterion.
5
+ const V = 'AICPA TSC 2017 (Common Criteria)';
6
+ const ref = (cc) => `AICPA Trust Services Criteria 2017, ${cc}`;
7
+ export const SOC2_CONTROLS = [
8
+ { id: 'SOC2-CC6.1', framework: 'SOC2', version: V, title: 'Logical access controls',
9
+ requirement: 'The entity implements logical access security software, infrastructure, and architectures over protected information assets to protect them from security events.',
10
+ sourceRef: ref('CC6.1'), verified: true },
11
+ { id: 'SOC2-CC6.2', framework: 'SOC2', version: V, title: 'Registration and de-provisioning of users',
12
+ requirement: 'New internal and external users are registered and authorized before being issued credentials; credentials are removed when access is no longer required.',
13
+ sourceRef: ref('CC6.2'), verified: true },
14
+ { id: 'SOC2-CC6.3', framework: 'SOC2', version: V, title: 'Role-based access and least privilege',
15
+ requirement: 'Access to information assets is authorized and modified based on roles, least privilege, and segregation of duties.',
16
+ sourceRef: ref('CC6.3'), verified: true },
17
+ { id: 'SOC2-CC6.4', framework: 'SOC2', version: V, title: 'Physical access controls',
18
+ requirement: 'The entity restricts physical access to facilities and protected information assets to authorized personnel. (Generally a data-centre control, not org configuration.)',
19
+ sourceRef: ref('CC6.4'), verified: true },
20
+ { id: 'SOC2-CC6.6', framework: 'SOC2', version: V, title: 'Boundary protection against external threats',
21
+ requirement: 'The entity implements logical access security measures to protect against threats from sources outside its system boundaries.',
22
+ sourceRef: ref('CC6.6'), verified: true },
23
+ { id: 'SOC2-CC6.7', framework: 'SOC2', version: V, title: 'Restriction of information transmission and movement',
24
+ requirement: 'The entity restricts the transmission, movement, and removal of information to authorized users and processes, and protects it during transmission.',
25
+ sourceRef: ref('CC6.7'), verified: true },
26
+ { id: 'SOC2-CC7.1', framework: 'SOC2', version: V, title: 'Detection of configuration changes and vulnerabilities',
27
+ requirement: 'The entity uses detection and monitoring procedures to identify configuration changes and susceptibility to newly discovered vulnerabilities.',
28
+ sourceRef: ref('CC7.1'), verified: true },
29
+ { id: 'SOC2-CC7.2', framework: 'SOC2', version: V, title: 'Monitoring for anomalies and security events',
30
+ requirement: 'The entity monitors system components for anomalies indicative of malicious acts, errors, or other security events.',
31
+ sourceRef: ref('CC7.2'), verified: true },
32
+ { id: 'SOC2-CC8.1', framework: 'SOC2', version: V, title: 'Change management',
33
+ requirement: 'Changes to infrastructure, data, software, and procedures are authorized, designed, tested, approved, and implemented under a controlled process.',
34
+ sourceRef: ref('CC8.1'), verified: true },
35
+ { id: 'SOC2-CC9.1', framework: 'SOC2', version: V, title: 'Risk mitigation for business disruptions',
36
+ requirement: 'The entity identifies, selects, and develops risk mitigation activities for risks arising from potential business disruptions.',
37
+ sourceRef: ref('CC9.1'), verified: true },
38
+ { id: 'SOC2-CC9.2', framework: 'SOC2', version: V, title: 'Vendor and third-party risk management',
39
+ requirement: 'The entity assesses and manages risks associated with vendors and business partners.',
40
+ sourceRef: ref('CC9.2'), verified: true },
41
+ ];
42
+ //# sourceMappingURL=soc2.js.map
@@ -0,0 +1,2 @@
1
+ export declare const CHECK_CONTROL_MAP: Record<string, string[]>;
2
+ //# sourceMappingURL=mapping.d.ts.map
@@ -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
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.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
@@ -2,6 +2,8 @@ import type { AuditResult } from '../findings/AuditResult.js';
2
2
  export interface AuditRenderer {
3
3
  readonly format: string;
4
4
  readonly fileExtension: string;
5
+ /** When set, used instead of 'sf-audit' for the output filename (avoids collisions between renderers sharing an extension). */
6
+ readonly filenamePrefix?: string;
5
7
  render(result: AuditResult): string;
6
8
  }
7
9
  //# sourceMappingURL=AuditRenderer.d.ts.map
@@ -0,0 +1,29 @@
1
+ import type { AuditResult } from '../findings/AuditResult.js';
2
+ import type { AuditRenderer } from './AuditRenderer.js';
3
+ import type { Branding } from '../report/branding.js';
4
+ import type { Framework } from '../compliance/types.js';
5
+ export interface ClientReportOptions {
6
+ branding: Branding;
7
+ topN: number;
8
+ frameworks: Framework[];
9
+ }
10
+ export declare class ClientReportRenderer implements AuditRenderer {
11
+ private readonly opts;
12
+ readonly format = "executive";
13
+ readonly fileExtension = ".html";
14
+ readonly filenamePrefix = "SF_Audit_Executive";
15
+ constructor(opts: ClientReportOptions);
16
+ render(result: AuditResult): string;
17
+ private chip;
18
+ private sectionHead;
19
+ private cover;
20
+ private summary;
21
+ private prioritiesSection;
22
+ private scenarios;
23
+ private roadmapSection;
24
+ private worst;
25
+ private matrixSection;
26
+ private findingsAppendix;
27
+ private footer;
28
+ }
29
+ //# sourceMappingURL=ClientReportRenderer.d.ts.map