@cclabsnz/sf-audit 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +38 -30
- package/lib/chains/namedChains.js +4 -4
- package/lib/checks/impl/AnonymousApexAuditCheck.js +5 -5
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.js +4 -4
- package/lib/checks/impl/ApexLoggingCheck.js +10 -10
- package/lib/checks/impl/ApexRestEndpointCheck.js +5 -5
- package/lib/checks/impl/ApexSharingCheck.js +3 -3
- package/lib/checks/impl/ApiClientPermissionCheck.js +2 -2
- package/lib/checks/impl/CertificateExpiryCheck.js +1 -1
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppInactivityCheck.js +5 -5
- package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppScopeCheck.js +4 -4
- package/lib/checks/impl/ConnectedAppsCheck.js +2 -2
- package/lib/checks/impl/ContentLinksCheck.js +6 -6
- package/lib/checks/impl/CorsAllowlistCheck.js +3 -3
- package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
- package/lib/checks/impl/CustomLabelsCredentialCheck.js +7 -7
- package/lib/checks/impl/DataClassificationCheck.js +6 -6
- package/lib/checks/impl/DebugLogAccessCheck.js +6 -6
- package/lib/checks/impl/DeploymentIdentityCheck.js +8 -8
- package/lib/checks/impl/EmailSecurityCheck.d.ts +10 -0
- package/lib/checks/impl/EmailSecurityCheck.js +117 -0
- package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.js +6 -6
- package/lib/checks/impl/EscalationPermsCheck.js +2 -2
- package/lib/checks/impl/EventMonitoringCheck.js +6 -6
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
- package/lib/checks/impl/FailedLoginCheck.js +5 -5
- package/lib/checks/impl/FieldHistoryTrackingCheck.js +3 -3
- package/lib/checks/impl/FieldLevelSecurityCheck.js +2 -2
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
- package/lib/checks/impl/GuestUserAccessCheck.js +5 -5
- package/lib/checks/impl/HealthCheckCheck.js +2 -2
- package/lib/checks/impl/HighAssuranceSessionCheck.js +4 -4
- package/lib/checks/impl/InstalledPackagesCheck.js +5 -5
- package/lib/checks/impl/IntegrationUsersCheck.js +5 -5
- package/lib/checks/impl/InternalUserMfaCheck.js +2 -2
- package/lib/checks/impl/IpRestrictionsCheck.js +3 -3
- package/lib/checks/impl/LegacyApiVersionCheck.js +1 -1
- package/lib/checks/impl/MfaEnforcementCheck.js +3 -3
- package/lib/checks/impl/MfaMethodStrengthCheck.js +3 -3
- package/lib/checks/impl/MfaRegistrationCheck.js +2 -2
- package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/MyDomainLoginPolicyCheck.js +9 -9
- package/lib/checks/impl/NamedCredentialsCheck.js +3 -3
- package/lib/checks/impl/OutboundMessagesCheck.d.ts +10 -0
- package/lib/checks/impl/OutboundMessagesCheck.js +88 -0
- package/lib/checks/impl/PasswordSessionPolicyCheck.js +3 -3
- package/lib/checks/impl/PermissionsCheck.js +3 -3
- package/lib/checks/impl/PrivilegedAccessCheck.d.ts +11 -0
- package/lib/checks/impl/PrivilegedAccessCheck.js +111 -0
- package/lib/checks/impl/PublicContentExposureCheck.d.ts +10 -0
- package/lib/checks/impl/PublicContentExposureCheck.js +98 -0
- package/lib/checks/impl/PublicGroupSharingCheck.js +1 -1
- package/lib/checks/impl/ReleaseUpdatesCheck.js +2 -2
- package/lib/checks/impl/RemoteSitesCheck.js +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.js +4 -4
- package/lib/checks/impl/ScheduledApexCheck.js +1 -1
- package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +11 -0
- package/lib/checks/impl/SeparationOfDutiesCheck.js +114 -0
- package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
- package/lib/checks/impl/SharingModelCheck.js +8 -8
- package/lib/checks/impl/SiemIntegrationCheck.js +4 -4
- package/lib/checks/impl/SsoEnforcementCheck.js +5 -5
- package/lib/checks/impl/StandardProfilesCheck.js +2 -2
- package/lib/checks/impl/TransactionSecurityPolicyCheck.js +2 -2
- package/lib/checks/impl/TrustedIPRangesCheck.js +5 -5
- package/lib/checks/impl/VisualforceXssCheck.js +6 -6
- package/lib/checks/permCatalog.d.ts +15 -0
- package/lib/checks/permCatalog.js +42 -0
- package/lib/checks/registry.js +12 -0
- package/lib/commands/audit/diff.js +1 -1
- package/lib/commands/audit/security.js +2 -2
- package/lib/compliance/mapping.js +9 -2
- package/lib/context/AuditCache.d.ts +9 -0
- package/lib/findings/CheckMeta.js +8 -3
- package/lib/renderers/ClientReportRenderer.js +4 -4
- package/lib/renderers/DiffHtmlRenderer.js +1 -1
- package/lib/renderers/HistoryRenderer.js +1 -1
- package/lib/renderers/HtmlRenderer.js +3 -3
- package/lib/renderers/MarkdownRenderer.js +2 -2
- package/messages/audit.security.md +30 -2
- package/package.json +2 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 CloudCounsel Limited
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# @cclabsnz/sf-audit
|
|
2
2
|
|
|
3
|
-
A Salesforce CLI (`sf`) plugin that runs a
|
|
3
|
+
A Salesforce CLI (`sf`) plugin that runs a complete, **read-only** security audit against any Salesforce org, risk-scores it with an A–F grade, and turns the result into a report your security team (or your client's) can act on.
|
|
4
4
|
|
|
5
|
-
- **
|
|
6
|
-
- **Attack-chain correlation
|
|
7
|
-
- **Compliance mapping
|
|
5
|
+
- **66 read-only checks** across identity, access, data, code, integrations, and monitoring
|
|
6
|
+
- **Attack-chain correlation:** links individual findings into named, multi-step attack scenarios
|
|
7
|
+
- **Compliance mapping:** every finding mapped to **source-verified** controls across 7 frameworks (OWASP, SOC 2, ISO/IEC 27001:2022, Security Benchmark for Salesforce, NZ Privacy Act, HISO 10029, NZISM)
|
|
8
8
|
- **Outputs:** a technical `html` / `md` / `json` report, or a branded, client-ready **executive report** (print-to-PDF) with priorities, remediation roadmap, and a compliance coverage matrix
|
|
9
|
-
- **History & diff
|
|
9
|
+
- **History & diff:** archives each run and shows security-posture drift over time
|
|
10
10
|
- Strictly read-only (SOQL/Tooling/REST GETs); see [PERMISSIONS.md](PERMISSIONS.md) for the least-privilege access it needs
|
|
11
11
|
|
|
12
12
|
## Installation
|
|
@@ -31,7 +31,7 @@ sf plugins link .
|
|
|
31
31
|
sf audit security --target-org <orgAlias>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
This runs all
|
|
34
|
+
This runs all 66 security checks against the target org and writes a report to the current directory.
|
|
35
35
|
|
|
36
36
|
### Options
|
|
37
37
|
|
|
@@ -40,11 +40,11 @@ This runs all 61 security checks against the target org and writes a report to t
|
|
|
40
40
|
| `--target-org` | *(required)* | Org alias or username to audit |
|
|
41
41
|
| `--format` / `-f` | `html` | Output format(s), comma-separated: `html`, `md`, `json`, `executive` |
|
|
42
42
|
| `--output` / `-o` | `.` | Directory to write the report file |
|
|
43
|
-
| `--fail-on` |
|
|
44
|
-
| `--checks` | *(all)* | Comma-separated check IDs to run instead of all
|
|
45
|
-
| `--scoring-config` |
|
|
46
|
-
| `--prepared-for` |
|
|
47
|
-
| `--branding` |
|
|
43
|
+
| `--fail-on` | (none) | Exit with code 1 if any finding is at or above this severity: `CRITICAL`, `HIGH`, `MEDIUM`, `LOW` |
|
|
44
|
+
| `--checks` | *(all)* | Comma-separated check IDs to run instead of all 66 (e.g. `hardcoded-credentials,apex-sharing`) |
|
|
45
|
+
| `--scoring-config` | (none) | Path to a custom scoring config JSON file to override weights and grade thresholds |
|
|
46
|
+
| `--prepared-for` | (none) | Client name for the executive report cover line |
|
|
47
|
+
| `--branding` | (none) | Path to a `report-branding.json` to override CloudCounsel defaults (executive format) |
|
|
48
48
|
| `--top` | `5` | Number of executive priorities to highlight (executive format) |
|
|
49
49
|
| `--frameworks` | `universal` | Compliance matrix scope (executive format): `universal` (OWASP/SOC 2/ISO 27001), `nz` (ISO/HISO/Privacy Act/NZISM), `all`, or a comma list (e.g. `owasp,iso,nzism`) |
|
|
50
50
|
|
|
@@ -72,7 +72,7 @@ sf audit security --target-org myOrg --scoring-config ./my-scoring.json
|
|
|
72
72
|
|
|
73
73
|
### Executive report
|
|
74
74
|
|
|
75
|
-
`--format executive` produces a CloudCounsel-branded, print-to-PDF HTML report for clients
|
|
75
|
+
`--format executive` produces a CloudCounsel-branded, print-to-PDF HTML report for clients:
|
|
76
76
|
grade and executive summary, top priorities with abuse/impact narratives, attack scenarios, a
|
|
77
77
|
risk×effort remediation roadmap, and a **compliance coverage matrix** mapping findings to framework
|
|
78
78
|
controls. It is fully self-contained (fonts embedded); open it and **Save as PDF**.
|
|
@@ -81,7 +81,7 @@ controls. It is fully self-contained (fonts embedded); open it and **Save as PDF
|
|
|
81
81
|
# Branded executive report for a client (universal compliance matrix)
|
|
82
82
|
sf audit security --target-org myOrg --format executive --prepared-for "Acme Health" --top 5
|
|
83
83
|
|
|
84
|
-
# NZ health/government engagement
|
|
84
|
+
# NZ health/government engagement: NZ framework matrix
|
|
85
85
|
sf audit security --target-org myOrg --format executive --frameworks nz
|
|
86
86
|
|
|
87
87
|
# White-label / co-brand via overrides
|
|
@@ -90,20 +90,20 @@ sf audit security --target-org myOrg --format executive --branding ./report-bran
|
|
|
90
90
|
|
|
91
91
|
Compliance controls are mapped from authoritative, version-pinned sources (OWASP Top 10:2021,
|
|
92
92
|
AICPA TSC, ISO/IEC 27001:2022, the Security Benchmark for Salesforce, NZ Privacy Act, HISO 10029,
|
|
93
|
-
NZISM). Only source-verified controls render
|
|
93
|
+
NZISM). Only source-verified controls render. "No findings detected" is **not** an attestation of
|
|
94
94
|
compliance (see the report's Scope & Liability section).
|
|
95
95
|
|
|
96
96
|
The report file is written as `sf-audit-<orgId>-<timestamp>.<ext>` in the output directory (e.g. `sf-audit-00D000000000001-1711234567890.html`).
|
|
97
97
|
|
|
98
98
|
## What It Checks
|
|
99
99
|
|
|
100
|
-
The audit runs **
|
|
100
|
+
The audit runs **66 read-only checks**. Every finding is risk-rated (CRITICAL → INFO) and mapped to controls across the compliance frameworks (see [Compliance frameworks](#compliance-frameworks)). The checks are grouped into nine domains below.
|
|
101
101
|
|
|
102
102
|
### Org Health & Configuration
|
|
103
103
|
| Check | What it looks for |
|
|
104
104
|
|-------|------------------|
|
|
105
105
|
| Security Health Check | Salesforce Health Check score and individual high-risk settings |
|
|
106
|
-
| Enhanced Domains | Enhanced Domains enabled
|
|
106
|
+
| Enhanced Domains | Enhanced Domains enabled: prevents cross-org cookie leakage and enforces URL isolation |
|
|
107
107
|
| Pending Release Updates | Salesforce release updates pending activation, especially those past auto-activation |
|
|
108
108
|
| Legacy API Versions | Apex compiled on old API versions and SOAP-based remote site integrations |
|
|
109
109
|
| API & Resource Limits | API request consumption against daily and concurrent limits |
|
|
@@ -131,6 +131,8 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
131
131
|
| Standard Profile Usage | Active users assigned to out-of-the-box standard profiles |
|
|
132
132
|
| Use Any API Client | Users with the permission that bypasses API Access Control |
|
|
133
133
|
| Privilege Escalation Permissions | Users holding lateral-movement / persistence permission clusters |
|
|
134
|
+
| Privileged Access & Shadow Admins | Effective high-risk permissions per user (profile + permission sets + groups); admin-equivalent users not on the System Administrator profile |
|
|
135
|
+
| Separation of Duties | Toxic permission combinations a single user holds (e.g. Manage Users + Assign Permission Sets, Author Apex + Modify All Data) |
|
|
134
136
|
| Integration / Service Accounts | Non-human identity inventory and excess privilege |
|
|
135
137
|
| Inactive Users | Active licensed users with no login in 90+ days |
|
|
136
138
|
|
|
@@ -145,6 +147,7 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
145
147
|
| Data Classification & Encryption | Field data classification usage and Shield Platform Encryption |
|
|
146
148
|
| Flows Without Sharing | Active flows running in system context without sharing enforcement |
|
|
147
149
|
| Content Distribution Links | Public file links missing expiry or passwords, and stale records |
|
|
150
|
+
| Public Static Resources & Documents | Documents marked externally available (anonymous URL access) and static resources cached publicly |
|
|
148
151
|
|
|
149
152
|
### Guest & External-Facing Access
|
|
150
153
|
| Check | What it looks for |
|
|
@@ -176,6 +179,8 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
176
179
|
| Inactive Connected Apps | Apps with no OAuth logins in the past 90 days |
|
|
177
180
|
| Named Credentials | Named credential inventory; credentials not referenced in Apex |
|
|
178
181
|
| Remote Site Settings | Remote sites with protocol security disabled |
|
|
182
|
+
| Outbound Messages | Workflow outbound messages that include a session ID or post to cleartext (http://) endpoints |
|
|
183
|
+
| Email Security & Spoofing | Inbound email services accepting mail from any sender / running Apex unauthenticated, and org-wide send-as addresses open to all profiles |
|
|
179
184
|
| Installed Packages | Managed/unmanaged package inventory; unmanaged or beta packages in production |
|
|
180
185
|
| Deployment Identity | Designated deployment identity and uncontrolled deployment activity |
|
|
181
186
|
|
|
@@ -198,38 +203,41 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
198
203
|
|
|
199
204
|
## Compliance frameworks
|
|
200
205
|
|
|
201
|
-
Findings are mapped to controls across seven security and privacy frameworks. The mapping is built on a **sourced control catalog**
|
|
206
|
+
Findings are mapped to controls across seven security and privacy frameworks. The mapping is built on a **sourced control catalog** (each control carries its framework, **pinned version**, official title, and a citation) so a finding's compliance reference ties to an exact, defensible requirement rather than a bare tag.
|
|
202
207
|
|
|
203
208
|
| Framework | Version | Notes |
|
|
204
209
|
|-----------|---------|-------|
|
|
205
210
|
| OWASP Top 10 | 2021 | Web application risk categories |
|
|
206
211
|
| SOC 2 | AICPA TSC 2017 | Common Criteria (CC6–CC9) |
|
|
207
212
|
| ISO/IEC 27001 | 2022 | Annex A controls |
|
|
208
|
-
| Security Benchmark for Salesforce (SBS) | current | Salesforce-native benchmark
|
|
213
|
+
| Security Benchmark for Salesforce (SBS) | current | Salesforce-native benchmark: [docs.securitybenchmark.org](https://docs.securitybenchmark.org) |
|
|
209
214
|
| NZ Privacy Act | 2020 | Information Privacy Principles (IPP 5/9/12) |
|
|
210
215
|
| HISO 10029 | 2022 | NZ Health Information Security Framework |
|
|
211
216
|
| NZISM | v3.8 | NZ Information Security Manual |
|
|
212
217
|
|
|
213
|
-
**Provenance gate.** Each catalogued control is marked `verified` only after its title/reference is confirmed against the authoritative source. **Controls that are not verified do not render** in the compliance matrix
|
|
218
|
+
**Provenance gate.** Each catalogued control is marked `verified` only after its title/reference is confirmed against the authoritative source. **Controls that are not verified do not render** in the compliance matrix. Nothing ships as "compliant-to-clause" on unconfirmed data. The current verification status is tracked in [`docs/compliance/verification-worksheet.md`](docs/compliance/verification-worksheet.md).
|
|
214
219
|
|
|
215
220
|
**Framework packs.** The executive report's compliance matrix is scoped with `--frameworks`:
|
|
216
221
|
|
|
217
|
-
- `universal` *(default)
|
|
218
|
-
- `nz
|
|
219
|
-
- `all
|
|
222
|
+
- `universal` *(default)*: OWASP, SOC 2, ISO 27001
|
|
223
|
+
- `nz`: ISO 27001, HISO 10029, NZ Privacy Act, NZISM (for NZ health/government engagements)
|
|
224
|
+
- `all`: every framework
|
|
220
225
|
- a comma list of aliases, e.g. `owasp,iso,nzism`
|
|
221
226
|
|
|
222
|
-
> **Not an attestation.** A control rendering "No findings detected" means this audit's checks surfaced no issues mapped to it
|
|
227
|
+
> **Not an attestation.** A control rendering "No findings detected" means this audit's checks surfaced no issues mapped to it. It is **not** a statement of compliance or certification. See [Scope & Liability](#scope--liability).
|
|
228
|
+
|
|
229
|
+
**Further reading:** [Mapping Salesforce security to NZISM, the NZ Privacy Act and ISO 27001](https://www.softwareinsights.dev/posts/salesforce-security-nzism-nz-privacy-act) and [Why Salesforce Health Cloud needs its own security review](https://www.softwareinsights.dev/posts/salesforce-health-cloud-security-review).
|
|
223
230
|
|
|
224
231
|
## Scope & Liability
|
|
225
232
|
|
|
226
|
-
**What this tool is.** A read-only, point-in-time configuration review. Every check uses standard Salesforce SOQL, Tooling, and REST **GET** queries only
|
|
233
|
+
**What this tool is.** A read-only, point-in-time configuration review. Every check uses standard Salesforce SOQL, Tooling, and REST **GET** queries only: the tool performs no DML, no metadata deployments, and never modifies the target org or its data. It runs under the permissions of the authenticated `sf` user; checks that the user cannot access are reported as *inconclusive* rather than passing silently.
|
|
227
234
|
|
|
228
235
|
**What this tool is not.** It is **not** a penetration test, a dynamic/runtime security test, or a source-code audit of managed-package internals. It does not exploit vulnerabilities, attempt privilege escalation, or guarantee detection of every misconfiguration. The Health Score and A–F grade are **prioritisation aids**, not certifications, and do not represent compliance with, or accreditation under, any standard (OWASP, SOC 2, ISO 27001, HIPAA, GDPR, or otherwise). Compliance-framework tags indicate *relevance* to a control area only.
|
|
229
236
|
|
|
237
|
+
|
|
230
238
|
**Point-in-time.** Results reflect org configuration **at the moment the audit ran**. Configuration drift, new customisations, and platform changes can invalidate findings at any time. Re-run regularly (see [History & Diff](#history--diff)).
|
|
231
239
|
|
|
232
|
-
**Authorisation.** Run this tool only against orgs you own or are **explicitly authorised in writing** to assess. You are responsible for obtaining the necessary permissions and for handling generated reports
|
|
240
|
+
**Authorisation.** Run this tool only against orgs you own or are **explicitly authorised in writing** to assess. You are responsible for obtaining the necessary permissions and for handling generated reports (which may contain sensitive security configuration) in accordance with your organisation's data-handling and confidentiality obligations.
|
|
233
241
|
|
|
234
242
|
**No warranty.** This software is provided "as is", without warranty of any kind, express or implied. To the maximum extent permitted by law, the authors and CloudCounsel Limited accept no liability for any loss, damage, or claim arising from use of this tool or reliance on its output. Findings are informational and should be validated by a qualified Salesforce security practitioner before any remediation action is taken.
|
|
235
243
|
|
|
@@ -259,15 +267,15 @@ The audit produces a **Health Score** (0–100) and a **Grade** (A–F):
|
|
|
259
267
|
|
|
260
268
|
### Custom Scoring Config
|
|
261
269
|
|
|
262
|
-
All weights and grade thresholds are configurable
|
|
270
|
+
All weights and grade thresholds are configurable: no recompile needed. This is useful when your org has a different risk appetite (e.g. you want to penalise hardcoded credentials more heavily, or set stricter grade thresholds).
|
|
263
271
|
|
|
264
|
-
**Step 1
|
|
272
|
+
**Step 1:** Copy the sample config as your starting point:
|
|
265
273
|
|
|
266
274
|
```bash
|
|
267
275
|
cp config/scoring.sample.json my-scoring.json
|
|
268
276
|
```
|
|
269
277
|
|
|
270
|
-
**Step 2
|
|
278
|
+
**Step 2:** Edit the values. All three sections (`riskScores`, `checkWeights`, `gradeThresholds`) are optional: omit any section to keep the defaults.
|
|
271
279
|
|
|
272
280
|
```json
|
|
273
281
|
{
|
|
@@ -296,7 +304,7 @@ cp config/scoring.sample.json my-scoring.json
|
|
|
296
304
|
|
|
297
305
|
The full list of valid `checkWeights` keys (one per check) is in [`config/scoring.sample.json`](config/scoring.sample.json).
|
|
298
306
|
|
|
299
|
-
**Step 3
|
|
307
|
+
**Step 3:** Pass it when running the audit:
|
|
300
308
|
|
|
301
309
|
```bash
|
|
302
310
|
sf audit security --target-org myOrg --scoring-config ./my-scoring.json
|
|
@@ -312,7 +320,7 @@ Every `sf audit security` run automatically archives a JSON copy of the report t
|
|
|
312
320
|
~/.sf/audit-history/{orgId}/sf-audit-{orgId}-{timestamp}.json
|
|
313
321
|
```
|
|
314
322
|
|
|
315
|
-
No configuration needed
|
|
323
|
+
No configuration needed: archiving happens silently after each run.
|
|
316
324
|
|
|
317
325
|
### View Audit History
|
|
318
326
|
|
|
@@ -26,7 +26,7 @@ export const NAMED_CHAINS = [
|
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: 'standard-to-takeover',
|
|
29
|
-
title: 'Standard user
|
|
29
|
+
title: 'Standard user to org takeover',
|
|
30
30
|
severity: 'CRITICAL',
|
|
31
31
|
narrative: 'A low-trust authenticated user combines with a privilege-escalation permission ' +
|
|
32
32
|
'(assign permission sets, manage users, author apex, modify metadata) to reach full org control.',
|
|
@@ -45,7 +45,7 @@ export const NAMED_CHAINS = [
|
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
id: 'cred-theft-pivot',
|
|
48
|
-
title: 'Credential theft
|
|
48
|
+
title: 'Credential theft to external pivot',
|
|
49
49
|
severity: 'CRITICAL',
|
|
50
50
|
narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels, debug logs, or broad CORS) ' +
|
|
51
51
|
'combine with an external egress path (named credential or remote site) to exfiltrate data to attacker infrastructure.',
|
|
@@ -63,7 +63,7 @@ export const NAMED_CHAINS = [
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
id: 'soql-injection-read',
|
|
66
|
-
title: 'SOQL injection
|
|
66
|
+
title: 'SOQL injection to mass read',
|
|
67
67
|
severity: 'HIGH',
|
|
68
68
|
narrative: 'Injectable dynamic SOQL combines with bulk data readability to let an attacker extract large datasets.',
|
|
69
69
|
remediation: 'Use bind variables in all dynamic SOQL and enforce CRUD/FLS; restrict bulk read access.',
|
|
@@ -82,7 +82,7 @@ export const NAMED_CHAINS = [
|
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
id: 'mfa-bypass-admin',
|
|
85
|
-
title: 'MFA bypass
|
|
85
|
+
title: 'MFA bypass to privileged compromise',
|
|
86
86
|
severity: 'HIGH',
|
|
87
87
|
narrative: 'Weak MFA enforcement or trusted-IP MFA bypass combines with the presence of highly-privileged ' +
|
|
88
88
|
'accounts, so a credential-stuffing or phishing attacker can take over an admin without a second factor.',
|
|
@@ -30,7 +30,7 @@ export class AnonymousApexAuditCheck {
|
|
|
30
30
|
category: this.category,
|
|
31
31
|
riskLevel: 'INFO',
|
|
32
32
|
inconclusive: true,
|
|
33
|
-
title: 'SetupAuditTrail could not be queried
|
|
33
|
+
title: 'SetupAuditTrail could not be queried: anonymous Apex execution cannot be verified',
|
|
34
34
|
detail: 'The SetupAuditTrail object was not accessible. This may indicate insufficient permissions to view the org audit trail.',
|
|
35
35
|
remediation: 'Grant "View Setup and Configuration" permission to the audit user. Review anonymous Apex execution manually in Setup → Audit Trail.',
|
|
36
36
|
affectedItems: [{ label: 'Setup Audit Trail', url: auditTrailUrl }],
|
|
@@ -76,12 +76,12 @@ export class AnonymousApexAuditCheck {
|
|
|
76
76
|
category: this.category,
|
|
77
77
|
riskLevel: 'HIGH',
|
|
78
78
|
title: `${nonAdminUsers.length} non-admin user(s) executed anonymous Apex in the last 90 days`,
|
|
79
|
-
detail: 'Anonymous Apex execution in production is a privileged, hard-to-audit operation. Anon Apex runs as the executing user but leaves no code artifact
|
|
79
|
+
detail: 'Anonymous Apex execution in production is a privileged, hard-to-audit operation. Anon Apex runs as the executing user but leaves no code artifact. It cannot be reviewed, versioned, or rolled back. Non-admin users executing anonymous Apex indicates a significant control gap: these users have Developer Console access in production and can manipulate data or bypass sharing rules without leaving a traceable code change.',
|
|
80
80
|
remediation: 'Remove Developer Console access from non-admin users. Revoke the "Author Apex" permission from all profiles and permission sets that do not require it. All code changes in production must go through a formal deployment process (change sets, Salesforce DX). Review each execution instance to determine what code was run and what data was affected.',
|
|
81
81
|
affectedItems: nonAdminUsers.map((u) => ({
|
|
82
82
|
label: u.username,
|
|
83
83
|
url: auditTrailUrl,
|
|
84
|
-
note: `${u.count} execution(s)
|
|
84
|
+
note: `${u.count} execution(s). Latest: ${new Date(u.latest).toISOString().split('T')[0]}. Profile: ${u.profile}`,
|
|
85
85
|
})),
|
|
86
86
|
});
|
|
87
87
|
}
|
|
@@ -90,13 +90,13 @@ export class AnonymousApexAuditCheck {
|
|
|
90
90
|
id: 'anonymous-apex-admin-only',
|
|
91
91
|
category: this.category,
|
|
92
92
|
riskLevel: 'MEDIUM',
|
|
93
|
-
title: `Anonymous Apex executed by ${adminOnlyUsers.length} admin-profile user(s) in the last 90 days
|
|
93
|
+
title: `Anonymous Apex executed by ${adminOnlyUsers.length} admin-profile user(s) in the last 90 days: monitoring recommended`,
|
|
94
94
|
detail: 'Anonymous Apex execution by administrator-profile users still represents a risk in production: it bypasses change management, leaves no deployable artifact, and cannot be peer-reviewed. Even legitimate use by admins should be tracked, approved, and documented as part of a change management process.',
|
|
95
95
|
remediation: 'Establish a policy requiring pre-approval for any anonymous Apex execution in production. Log approvals in your change management system. Prefer metadata deployments over anonymous Apex for all production data or configuration changes. Consider restricting Developer Console to a dedicated integration user only.',
|
|
96
96
|
affectedItems: adminOnlyUsers.map((u) => ({
|
|
97
97
|
label: u.username,
|
|
98
98
|
url: auditTrailUrl,
|
|
99
|
-
note: `${u.count} execution(s)
|
|
99
|
+
note: `${u.count} execution(s). Latest: ${new Date(u.latest).toISOString().split('T')[0]}. Profile: ${u.profile}`,
|
|
100
100
|
})),
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -4,7 +4,7 @@ export declare class ApexCrudFLSCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "apex-crud-fls";
|
|
5
5
|
readonly name = "Apex CRUD/FLS Enforcement";
|
|
6
6
|
readonly category = "Code Security";
|
|
7
|
-
readonly description = "Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions
|
|
7
|
+
readonly description = "Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions: OWASP Top 10 for Salesforce";
|
|
8
8
|
readonly dependsOnCache: readonly ["apexBodies"];
|
|
9
9
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ export class ApexCrudFLSCheck {
|
|
|
12
12
|
id = 'apex-crud-fls';
|
|
13
13
|
name = 'Apex CRUD/FLS Enforcement';
|
|
14
14
|
category = 'Code Security';
|
|
15
|
-
description = 'Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions
|
|
15
|
+
description = 'Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions: OWASP Top 10 for Salesforce';
|
|
16
16
|
dependsOnCache = ['apexBodies'];
|
|
17
17
|
async run(ctx) {
|
|
18
18
|
const findings = [];
|
|
@@ -24,7 +24,7 @@ export class ApexCrudFLSCheck {
|
|
|
24
24
|
category: this.category,
|
|
25
25
|
riskLevel: 'INFO',
|
|
26
26
|
inconclusive: true,
|
|
27
|
-
title: 'Apex class bodies not available
|
|
27
|
+
title: 'Apex class bodies not available: CRUD/FLS check skipped',
|
|
28
28
|
detail: 'Apex class bodies were not cached. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
29
29
|
remediation: 'Verify registry ordering so HardcodedCredentialsCheck (which populates apexBodies) precedes ApexCrudFLSCheck.',
|
|
30
30
|
});
|
|
@@ -62,7 +62,7 @@ export class ApexCrudFLSCheck {
|
|
|
62
62
|
affectedItems: withoutSharingNoFls.slice(0, 30).map((n) => ({
|
|
63
63
|
label: n,
|
|
64
64
|
url: apexClassesUrl,
|
|
65
|
-
note: '"without sharing" + DML/SOQL + no FLS check
|
|
65
|
+
note: '"without sharing" + DML/SOQL + no FLS check: highest risk',
|
|
66
66
|
})),
|
|
67
67
|
});
|
|
68
68
|
}
|
|
@@ -77,7 +77,7 @@ export class ApexCrudFLSCheck {
|
|
|
77
77
|
affectedItems: withDmlNoFls.slice(0, 30).map((n) => ({
|
|
78
78
|
label: n,
|
|
79
79
|
url: apexClassesUrl,
|
|
80
|
-
note: 'DML/SOQL without FLS check
|
|
80
|
+
note: 'DML/SOQL without FLS check: add Security.stripInaccessible() or isAccessible() guards',
|
|
81
81
|
})),
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -37,8 +37,8 @@ export class ApexLoggingCheck {
|
|
|
37
37
|
category: this.category,
|
|
38
38
|
riskLevel: 'INFO',
|
|
39
39
|
inconclusive: true,
|
|
40
|
-
title: 'Apex class bodies not available
|
|
41
|
-
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache
|
|
40
|
+
title: 'Apex class bodies not available: SBS-CODE-003/004 check skipped',
|
|
41
|
+
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
42
42
|
remediation: 'Verify HardcodedCredentialsCheck is registered before ApexLoggingCheck in the check registry.',
|
|
43
43
|
});
|
|
44
44
|
return { findings };
|
|
@@ -70,7 +70,7 @@ export class ApexLoggingCheck {
|
|
|
70
70
|
category: this.category,
|
|
71
71
|
riskLevel: 'LOW',
|
|
72
72
|
passed: true,
|
|
73
|
-
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework
|
|
73
|
+
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework: SBS-CODE-003`,
|
|
74
74
|
detail: `SBS-CODE-003 requires Apex to use a persistent logging framework rather than transient System.debug calls. ${persistentLoggerClasses.length} class(es) reference a persistent logger. Examples: ${persistentLoggerClasses.slice(0, 5).join(', ')}${persistentLoggerClasses.length > 5 ? ` (+${persistentLoggerClasses.length - 5} more)` : ''}.`,
|
|
75
75
|
remediation: 'Extend persistent logging coverage to all production classes that handle significant business logic or integration operations.',
|
|
76
76
|
});
|
|
@@ -80,15 +80,15 @@ export class ApexLoggingCheck {
|
|
|
80
80
|
id: 'apex-logging-debug-only',
|
|
81
81
|
category: this.category,
|
|
82
82
|
riskLevel: scheduledDebugClasses.length > 0 ? 'MEDIUM' : 'LOW',
|
|
83
|
-
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug
|
|
84
|
-
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs
|
|
83
|
+
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug: SBS-CODE-003`,
|
|
84
|
+
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs. Persistent logging is especially important for operational visibility in background processes.` : ''}`,
|
|
85
85
|
remediation: 'Adopt a persistent logging framework (a custom Log__c object, Platform Events, or an open-source framework) and migrate System.debug calls to it for all classes handling critical business logic.',
|
|
86
86
|
affectedItems: debugOnlyClasses.slice(0, 30).map((name) => ({
|
|
87
87
|
label: name,
|
|
88
88
|
url: apexClassesUrl,
|
|
89
89
|
note: scheduledClassNames.has(name)
|
|
90
|
-
? 'scheduled/batch job
|
|
91
|
-
: 'System.debug only
|
|
90
|
+
? 'scheduled/batch job: high priority to add persistent logging'
|
|
91
|
+
: 'System.debug only: no persistent log trail',
|
|
92
92
|
})),
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -97,13 +97,13 @@ export class ApexLoggingCheck {
|
|
|
97
97
|
id: 'apex-logging-sensitive-data',
|
|
98
98
|
category: this.category,
|
|
99
99
|
riskLevel: 'HIGH',
|
|
100
|
-
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data
|
|
100
|
+
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data: SBS-CODE-004`,
|
|
101
101
|
detail: 'SBS-CODE-004 prohibits logging sensitive data (passwords, tokens, session IDs, PII) in Apex. The flagged classes appear to pass sensitive variable names or credential values directly to System.debug(), which writes them to debug logs accessible to any administrator who can view debug logs.',
|
|
102
102
|
remediation: 'Remove all logging of passwords, tokens, API keys, and PII from Apex code. Review each flagged class and mask, redact, or entirely exclude sensitive values before passing them to any logging call.',
|
|
103
103
|
affectedItems: sensitiveLogClasses.map((name) => ({
|
|
104
104
|
label: name,
|
|
105
105
|
url: apexClassesUrl,
|
|
106
|
-
note: 'Review System.debug() calls
|
|
106
|
+
note: 'Review System.debug() calls: sensitive variable names detected near logging statements',
|
|
107
107
|
})),
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -113,7 +113,7 @@ export class ApexLoggingCheck {
|
|
|
113
113
|
category: this.category,
|
|
114
114
|
riskLevel: 'LOW',
|
|
115
115
|
passed: true,
|
|
116
|
-
title: 'No System.debug-only logging or sensitive-data logging patterns found
|
|
116
|
+
title: 'No System.debug-only logging or sensitive-data logging patterns found: SBS-CODE-003/004',
|
|
117
117
|
detail: 'SBS-CODE-003 requires a persistent logging framework and SBS-CODE-004 prohibits sensitive data in logs. No violations were detected in the scanned Apex classes.',
|
|
118
118
|
remediation: 'Continue monitoring as new Apex classes are added to the org.',
|
|
119
119
|
});
|