@cclabsnz/sf-audit 1.2.0 → 1.4.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 +135 -31
- package/lib/api/MetadataClient.d.ts +4 -0
- package/lib/api/MetadataClient.js +2 -0
- package/lib/api/MetadataClientImpl.d.ts +8 -0
- package/lib/api/MetadataClientImpl.js +22 -0
- package/lib/api/RestClient.d.ts +1 -0
- package/lib/api/RestClientImpl.d.ts +1 -0
- package/lib/api/RestClientImpl.js +6 -0
- package/lib/chains/CapabilityRegistry.js +19 -0
- package/lib/chains/namedChains.js +26 -4
- package/lib/checks/eventLogAccess.d.ts +14 -0
- package/lib/checks/eventLogAccess.js +33 -0
- 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/AuthProvidersCheck.d.ts +17 -0
- package/lib/checks/impl/AuthProvidersCheck.js +88 -0
- package/lib/checks/impl/CertificateExpiryCheck.js +1 -1
- package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
- package/lib/checks/impl/ClassicSitesCheck.js +65 -0
- 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/DataExportAccessCheck.d.ts +19 -0
- package/lib/checks/impl/DataExportAccessCheck.js +79 -0
- 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/EncryptionCoverageCheck.d.ts +19 -0
- package/lib/checks/impl/EncryptionCoverageCheck.js +108 -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 +14 -11
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
- package/lib/checks/impl/ExperienceCspCheck.d.ts +18 -0
- package/lib/checks/impl/ExperienceCspCheck.js +57 -0
- package/lib/checks/impl/ExternalCredentialsCheck.d.ts +17 -0
- package/lib/checks/impl/ExternalCredentialsCheck.js +74 -0
- 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/GuestApiAccessCheck.d.ts +19 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
- package/lib/checks/impl/GuestObjectExposureCheck.d.ts +44 -0
- package/lib/checks/impl/GuestObjectExposureCheck.js +241 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +34 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +120 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +18 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.js +92 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +23 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.js +343 -0
- 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/LoginAccessPolicyCheck.d.ts +26 -0
- package/lib/checks/impl/LoginAccessPolicyCheck.js +117 -0
- package/lib/checks/impl/LoginAnomalyCheck.d.ts +17 -0
- package/lib/checks/impl/LoginAnomalyCheck.js +98 -0
- 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/SandboxDataMaskingCheck.d.ts +17 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
- 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/SessionHardeningCheck.d.ts +21 -0
- package/lib/checks/impl/SessionHardeningCheck.js +134 -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/ThreatDetectionCheck.d.ts +17 -0
- package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
- 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 +45 -0
- package/lib/commands/audit/diff.js +9 -5
- package/lib/commands/audit/events/pull.d.ts +17 -0
- package/lib/commands/audit/events/pull.js +88 -0
- package/lib/commands/audit/security.d.ts +4 -0
- package/lib/commands/audit/security.js +41 -17
- package/lib/compliance/mapping.js +34 -7
- package/lib/context/AuditCache.d.ts +12 -0
- package/lib/context/AuditContext.d.ts +2 -0
- package/lib/events/EventBaselineStore.d.ts +16 -0
- package/lib/events/EventBaselineStore.js +55 -0
- package/lib/events/eventLogQuery.d.ts +21 -0
- package/lib/events/eventLogQuery.js +34 -0
- package/lib/events/pullEventLogs.d.ts +51 -0
- package/lib/events/pullEventLogs.js +79 -0
- package/lib/findings/CheckMeta.js +24 -3
- package/lib/lib/wire.d.ts +2 -0
- package/lib/lib/wire.js +3 -0
- 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 +14 -2
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,13 +1,14 @@
|
|
|
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
|
+
- **82 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
|
|
10
|
-
-
|
|
9
|
+
- **History & diff:** archives each run and shows security-posture drift over time
|
|
10
|
+
- **Free event baseline:** `sf audit events pull` captures the org's free daily `EventLogFile` logs to local disk before the 1-day retention window drops them — no Event Monitoring / Shield add-on needed
|
|
11
|
+
- Strictly read-only (SOQL/Tooling/REST GETs + Metadata API reads); see [PERMISSIONS.md](PERMISSIONS.md) for the least-privilege access it needs
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
13
14
|
|
|
@@ -31,7 +32,7 @@ sf plugins link .
|
|
|
31
32
|
sf audit security --target-org <orgAlias>
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
This runs all
|
|
35
|
+
This runs all 82 security checks against the target org and writes a report to the current directory.
|
|
35
36
|
|
|
36
37
|
### Options
|
|
37
38
|
|
|
@@ -40,11 +41,11 @@ This runs all 61 security checks against the target org and writes a report to t
|
|
|
40
41
|
| `--target-org` | *(required)* | Org alias or username to audit |
|
|
41
42
|
| `--format` / `-f` | `html` | Output format(s), comma-separated: `html`, `md`, `json`, `executive` |
|
|
42
43
|
| `--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` |
|
|
44
|
+
| `--fail-on` | (none) | Exit with code 1 if any finding is at or above this severity: `CRITICAL`, `HIGH`, `MEDIUM`, `LOW` |
|
|
45
|
+
| `--checks` | *(all)* | Comma-separated check IDs to run instead of all 82 (e.g. `hardcoded-credentials,apex-sharing`) |
|
|
46
|
+
| `--scoring-config` | (none) | Path to a custom scoring config JSON file to override weights and grade thresholds |
|
|
47
|
+
| `--prepared-for` | (none) | Client name for the executive report cover line |
|
|
48
|
+
| `--branding` | (none) | Path to a `report-branding.json` to override CloudCounsel defaults (executive format) |
|
|
48
49
|
| `--top` | `5` | Number of executive priorities to highlight (executive format) |
|
|
49
50
|
| `--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
51
|
|
|
@@ -66,13 +67,17 @@ sf audit security --target-org myOrg --fail-on HIGH
|
|
|
66
67
|
# Run only specific checks
|
|
67
68
|
sf audit security --target-org myOrg --checks hardcoded-credentials,apex-sharing,guest-user-access
|
|
68
69
|
|
|
70
|
+
# Guest / Experience Cloud exposure sweep — the unauthenticated data-leak surface
|
|
71
|
+
# (bulk-read via UI API, guest-owned records defeating Private OWD, file access, self-reg, threat detection)
|
|
72
|
+
sf audit security --target-org myOrg --checks guest-user-access,guest-object-exposure,guest-site-options,guest-executable-apex,experience-cloud-site,threat-detection
|
|
73
|
+
|
|
69
74
|
# Use a custom scoring config (e.g. stricter weights for your org)
|
|
70
75
|
sf audit security --target-org myOrg --scoring-config ./my-scoring.json
|
|
71
76
|
```
|
|
72
77
|
|
|
73
78
|
### Executive report
|
|
74
79
|
|
|
75
|
-
`--format executive` produces a CloudCounsel-branded, print-to-PDF HTML report for clients
|
|
80
|
+
`--format executive` produces a CloudCounsel-branded, print-to-PDF HTML report for clients:
|
|
76
81
|
grade and executive summary, top priorities with abuse/impact narratives, attack scenarios, a
|
|
77
82
|
risk×effort remediation roadmap, and a **compliance coverage matrix** mapping findings to framework
|
|
78
83
|
controls. It is fully self-contained (fonts embedded); open it and **Save as PDF**.
|
|
@@ -81,7 +86,7 @@ controls. It is fully self-contained (fonts embedded); open it and **Save as PDF
|
|
|
81
86
|
# Branded executive report for a client (universal compliance matrix)
|
|
82
87
|
sf audit security --target-org myOrg --format executive --prepared-for "Acme Health" --top 5
|
|
83
88
|
|
|
84
|
-
# NZ health/government engagement
|
|
89
|
+
# NZ health/government engagement: NZ framework matrix
|
|
85
90
|
sf audit security --target-org myOrg --format executive --frameworks nz
|
|
86
91
|
|
|
87
92
|
# White-label / co-brand via overrides
|
|
@@ -90,20 +95,20 @@ sf audit security --target-org myOrg --format executive --branding ./report-bran
|
|
|
90
95
|
|
|
91
96
|
Compliance controls are mapped from authoritative, version-pinned sources (OWASP Top 10:2021,
|
|
92
97
|
AICPA TSC, ISO/IEC 27001:2022, the Security Benchmark for Salesforce, NZ Privacy Act, HISO 10029,
|
|
93
|
-
NZISM). Only source-verified controls render
|
|
98
|
+
NZISM). Only source-verified controls render. "No findings detected" is **not** an attestation of
|
|
94
99
|
compliance (see the report's Scope & Liability section).
|
|
95
100
|
|
|
96
101
|
The report file is written as `sf-audit-<orgId>-<timestamp>.<ext>` in the output directory (e.g. `sf-audit-00D000000000001-1711234567890.html`).
|
|
97
102
|
|
|
98
103
|
## What It Checks
|
|
99
104
|
|
|
100
|
-
The audit runs **
|
|
105
|
+
The audit runs **82 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
106
|
|
|
102
107
|
### Org Health & Configuration
|
|
103
108
|
| Check | What it looks for |
|
|
104
109
|
|-------|------------------|
|
|
105
110
|
| Security Health Check | Salesforce Health Check score and individual high-risk settings |
|
|
106
|
-
| Enhanced Domains | Enhanced Domains enabled
|
|
111
|
+
| Enhanced Domains | Enhanced Domains enabled: prevents cross-org cookie leakage and enforces URL isolation |
|
|
107
112
|
| Pending Release Updates | Salesforce release updates pending activation, especially those past auto-activation |
|
|
108
113
|
| Legacy API Versions | Apex compiled on old API versions and SOAP-based remote site integrations |
|
|
109
114
|
| API & Resource Limits | API request consumption against daily and concurrent limits |
|
|
@@ -122,6 +127,8 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
122
127
|
| Login IP Restrictions | Admin profiles missing IP ranges; connected apps with relaxed IP policy |
|
|
123
128
|
| Password & Session Policy | Password complexity, session timeout, and MFA gaps (from Health Check) |
|
|
124
129
|
| Certificate Expiry | Installed certificates nearing expiry (30 / 90 / 180-day thresholds) |
|
|
130
|
+
| Auth Providers & External IdPs | External Auth Providers and SAML SSO configs; flags social/JIT providers that can federate in or auto-provision users |
|
|
131
|
+
| Session & Clickjack Hardening | Clickjack, CSRF, XSS, and content-sniffing settings read authoritatively from SecuritySettings (Health Check cache fallback) with per-setting remediation |
|
|
125
132
|
|
|
126
133
|
### Users, Permissions & Privilege
|
|
127
134
|
| Check | What it looks for |
|
|
@@ -131,8 +138,12 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
131
138
|
| Standard Profile Usage | Active users assigned to out-of-the-box standard profiles |
|
|
132
139
|
| Use Any API Client | Users with the permission that bypasses API Access Control |
|
|
133
140
|
| Privilege Escalation Permissions | Users holding lateral-movement / persistence permission clusters |
|
|
141
|
+
| Privileged Access & Shadow Admins | Effective high-risk permissions per user (profile + permission sets + groups); admin-equivalent users not on the System Administrator profile |
|
|
142
|
+
| Separation of Duties | Toxic permission combinations a single user holds (e.g. Manage Users + Assign Permission Sets, Author Apex + Modify All Data) |
|
|
134
143
|
| Integration / Service Accounts | Non-human identity inventory and excess privilege |
|
|
135
144
|
| Inactive Users | Active licensed users with no login in 90+ days |
|
|
145
|
+
| Login-As & Delegated Administration | Delegated-admin groups (SOQL) and the "log in as any user" policy read from SecuritySettings — user-impersonation and scoped-escalation paths |
|
|
146
|
+
| Mass Data Export Access | Profiles/permission sets with Weekly Data Export, or API access combined with View/Modify All Data (bulk-exfil capability) |
|
|
136
147
|
|
|
137
148
|
### Data Access & Sharing
|
|
138
149
|
| Check | What it looks for |
|
|
@@ -143,15 +154,24 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
143
154
|
| Report Folder Public Access | Report folders any authenticated user can view |
|
|
144
155
|
| Field History Tracking | History tracking enabled on sensitive standard objects |
|
|
145
156
|
| Data Classification & Encryption | Field data classification usage and Shield Platform Encryption |
|
|
157
|
+
| Encryption Coverage for Sensitive Fields | Fields classified PII/PHI (ComplianceGroup) that are NOT encrypted at rest with Shield |
|
|
158
|
+
| Sandbox Data Masking | In sandboxes, populated PII fields (likely unmasked production data); advises running Data Mask |
|
|
146
159
|
| Flows Without Sharing | Active flows running in system context without sharing enforcement |
|
|
147
160
|
| Content Distribution Links | Public file links missing expiry or passwords, and stale records |
|
|
161
|
+
| Public Static Resources & Documents | Documents marked externally available (anonymous URL access) and static resources cached publicly |
|
|
148
162
|
|
|
149
163
|
### Guest & External-Facing Access
|
|
150
164
|
| Check | What it looks for |
|
|
151
165
|
|-------|------------------|
|
|
152
166
|
| Guest User Access | Object permissions and sharing rules granted to unauthenticated guests |
|
|
167
|
+
| Guest Object Exposure (Bulk Read via UI API) | Auto-discovers guest-readable objects (incl. records exposed by guest ownership despite a Private OWD), then grades them by actual UI-API reachability: objects the UI API models are CRITICAL (GraphQL-pullable), objects readable only in the sharing model but not UI-API-modelled (Calendar, AuthSession, etc.) are separated as MEDIUM, with UserRecordAccess as ground-truth read confirmation |
|
|
153
168
|
| Guest-Executable Apex | Apex that guest profiles can run, flagging `without sharing` classes |
|
|
154
169
|
| Experience Cloud Sites | Live sites with self-registration enabled and guest user presence |
|
|
170
|
+
| Experience Cloud Guest Site Options | Guest file access and guest member visibility on Experience Cloud sites |
|
|
171
|
+
| Secure Guest User Record Access | Verifies the "Secure guest user record access" enforcement is activated — the guardrail that stops guest-owned records defeating a Private OWD (complements Guest Object Exposure) |
|
|
172
|
+
| Guest API & Bulk Access | Guest users granted API Enabled or Bulk API Hard Delete — programmatic bulk read/delete for unauthenticated visitors |
|
|
173
|
+
| Classic Force.com Sites | Active classic (Visualforce) Sites and their guest users — an unauthenticated surface separate from Experience Cloud |
|
|
174
|
+
| Experience Cloud CSP & Lightning Web Security | Advises verifying Strict CSP and Lightning Web Security on live sites (not reliably API-readable) |
|
|
155
175
|
| CORS Allowlist | Wildcard or overly broad CORS allowlist origins |
|
|
156
176
|
| CSP Trusted Sites | Content Security Policy trusted sites with insecure HTTP (mixed-content) endpoints |
|
|
157
177
|
|
|
@@ -175,7 +195,10 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
175
195
|
| Connected App OAuth Scopes | Full OAuth-scope grants and infinite refresh-token policies |
|
|
176
196
|
| Inactive Connected Apps | Apps with no OAuth logins in the past 90 days |
|
|
177
197
|
| Named Credentials | Named credential inventory; credentials not referenced in Apex |
|
|
198
|
+
| External Credential Authentication | External Credentials using no authentication or a custom (non-standard) scheme |
|
|
178
199
|
| Remote Site Settings | Remote sites with protocol security disabled |
|
|
200
|
+
| Outbound Messages | Workflow outbound messages that include a session ID or post to cleartext (http://) endpoints |
|
|
201
|
+
| 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
202
|
| Installed Packages | Managed/unmanaged package inventory; unmanaged or beta packages in production |
|
|
180
203
|
| Deployment Identity | Designated deployment identity and uncontrolled deployment activity |
|
|
181
204
|
|
|
@@ -194,42 +217,57 @@ The audit runs **61 read-only checks**. Every finding is risk-rated (CRITICAL
|
|
|
194
217
|
| Transaction Security Policies | Automated threat detection and response policies configured |
|
|
195
218
|
| Active Debug Log Traces | Active TraceFlag records capturing logs, including high-detail traces |
|
|
196
219
|
| Event Monitoring | Event Monitoring enabled with logs covering 30+ days |
|
|
220
|
+
| Threat Detection Event Storage | Guest User Anomaly / Threat Detection event storage enabled and retaining events |
|
|
221
|
+
| Guest Traffic Anomaly | Scans recent EventLogFile guest requests for anonymizer/hosting source IPs, single-IP bursts, and GraphQL `totalCount` reconnaissance sweeps |
|
|
222
|
+
| Anomalous Successful Logins | Accounts with successful logins from an unusually high number of distinct source IPs (credential-sharing / compromise signature) |
|
|
197
223
|
| SIEM Integration Signals | Evidence of SIEM or external monitoring integration |
|
|
198
224
|
|
|
225
|
+
### Known limitations (advisory-only checks)
|
|
226
|
+
|
|
227
|
+
A small number of checks emit an **advisory** rather than a pass/fail verdict because the underlying setting is not exposed to the read APIs this plugin uses (SOQL/Tooling/REST/Metadata read):
|
|
228
|
+
|
|
229
|
+
- **Experience Cloud CSP & Lightning Web Security** — the per-site LWR Content Security Policy level and the Lightning Web Security toggle live inside the site's `ExperienceBundle`, not in a `metadata.read`-able type. The check lists live Experience sites and asks for manual verification. A true detection would require retrieving and parsing the `ExperienceBundle` (retrieve → unzip → read `config/*.json`), which is a larger capability than the current read clients; it is tracked as a future enhancement.
|
|
230
|
+
- **"Administrators Can Log In as Any User"** is a true detection when SecuritySettings is readable; if the Metadata client is unavailable it degrades to a manual-verification advisory.
|
|
231
|
+
|
|
232
|
+
Advisory findings are surfaced as `INFO` and never inflate the health score.
|
|
233
|
+
|
|
199
234
|
## Compliance frameworks
|
|
200
235
|
|
|
201
|
-
Findings are mapped to controls across seven security and privacy frameworks. The mapping is built on a **sourced control catalog**
|
|
236
|
+
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
237
|
|
|
203
238
|
| Framework | Version | Notes |
|
|
204
239
|
|-----------|---------|-------|
|
|
205
240
|
| OWASP Top 10 | 2021 | Web application risk categories |
|
|
206
241
|
| SOC 2 | AICPA TSC 2017 | Common Criteria (CC6–CC9) |
|
|
207
242
|
| ISO/IEC 27001 | 2022 | Annex A controls |
|
|
208
|
-
| Security Benchmark for Salesforce (SBS) | current | Salesforce-native benchmark
|
|
243
|
+
| Security Benchmark for Salesforce (SBS) | current | Salesforce-native benchmark: [docs.securitybenchmark.org](https://docs.securitybenchmark.org) |
|
|
209
244
|
| NZ Privacy Act | 2020 | Information Privacy Principles (IPP 5/9/12) |
|
|
210
245
|
| HISO 10029 | 2022 | NZ Health Information Security Framework |
|
|
211
246
|
| NZISM | v3.8 | NZ Information Security Manual |
|
|
212
247
|
|
|
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
|
|
248
|
+
**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
249
|
|
|
215
250
|
**Framework packs.** The executive report's compliance matrix is scoped with `--frameworks`:
|
|
216
251
|
|
|
217
|
-
- `universal` *(default)
|
|
218
|
-
- `nz
|
|
219
|
-
- `all
|
|
252
|
+
- `universal` *(default)*: OWASP, SOC 2, ISO 27001
|
|
253
|
+
- `nz`: ISO 27001, HISO 10029, NZ Privacy Act, NZISM (for NZ health/government engagements)
|
|
254
|
+
- `all`: every framework
|
|
220
255
|
- a comma list of aliases, e.g. `owasp,iso,nzism`
|
|
221
256
|
|
|
222
|
-
> **Not an attestation.** A control rendering "No findings detected" means this audit's checks surfaced no issues mapped to it
|
|
257
|
+
> **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).
|
|
258
|
+
|
|
259
|
+
**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
260
|
|
|
224
261
|
## Scope & Liability
|
|
225
262
|
|
|
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
|
|
263
|
+
**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
264
|
|
|
228
265
|
**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
266
|
|
|
267
|
+
|
|
230
268
|
**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
269
|
|
|
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
|
|
270
|
+
**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
271
|
|
|
234
272
|
**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
273
|
|
|
@@ -259,15 +297,15 @@ The audit produces a **Health Score** (0–100) and a **Grade** (A–F):
|
|
|
259
297
|
|
|
260
298
|
### Custom Scoring Config
|
|
261
299
|
|
|
262
|
-
All weights and grade thresholds are configurable
|
|
300
|
+
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
301
|
|
|
264
|
-
**Step 1
|
|
302
|
+
**Step 1:** Copy the sample config as your starting point:
|
|
265
303
|
|
|
266
304
|
```bash
|
|
267
305
|
cp config/scoring.sample.json my-scoring.json
|
|
268
306
|
```
|
|
269
307
|
|
|
270
|
-
**Step 2
|
|
308
|
+
**Step 2:** Edit the values. All three sections (`riskScores`, `checkWeights`, `gradeThresholds`) are optional: omit any section to keep the defaults.
|
|
271
309
|
|
|
272
310
|
```json
|
|
273
311
|
{
|
|
@@ -296,7 +334,7 @@ cp config/scoring.sample.json my-scoring.json
|
|
|
296
334
|
|
|
297
335
|
The full list of valid `checkWeights` keys (one per check) is in [`config/scoring.sample.json`](config/scoring.sample.json).
|
|
298
336
|
|
|
299
|
-
**Step 3
|
|
337
|
+
**Step 3:** Pass it when running the audit:
|
|
300
338
|
|
|
301
339
|
```bash
|
|
302
340
|
sf audit security --target-org myOrg --scoring-config ./my-scoring.json
|
|
@@ -312,7 +350,7 @@ Every `sf audit security` run automatically archives a JSON copy of the report t
|
|
|
312
350
|
~/.sf/audit-history/{orgId}/sf-audit-{orgId}-{timestamp}.json
|
|
313
351
|
```
|
|
314
352
|
|
|
315
|
-
No configuration needed
|
|
353
|
+
No configuration needed: archiving happens silently after each run.
|
|
316
354
|
|
|
317
355
|
### View Audit History
|
|
318
356
|
|
|
@@ -379,6 +417,72 @@ Diff report written: ./sf-audit-diff-00D000000000001-...-vs-....json
|
|
|
379
417
|
─────────────────────────────
|
|
380
418
|
```
|
|
381
419
|
|
|
420
|
+
## Free event baseline
|
|
421
|
+
|
|
422
|
+
Salesforce's free tier exposes **Daily-interval `EventLogFile` logs** (login, API, and error
|
|
423
|
+
activity) on Enterprise/Unlimited/Performance editions and Developer Edition — *without* the paid
|
|
424
|
+
Event Monitoring / Shield add-on. The catch: on the free tier those logs are retained for only
|
|
425
|
+
**~1 day**. Miss a day and that day's activity is gone.
|
|
426
|
+
|
|
427
|
+
`sf audit events pull` captures them to local disk before they expire, so a daily run builds a
|
|
428
|
+
rolling local baseline you own:
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
sf audit events pull --target-org myOrg
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
It queries whatever daily event types the org actually exposes, downloads each log's CSV body, and
|
|
435
|
+
saves it to `~/.sf/event-baseline/{orgId}/{EventType}/{LogDate}-{Id}.csv`, plus a per-run manifest.
|
|
436
|
+
It is **read-only** (GET only) and **idempotent**: any log already on disk is skipped, so it is safe
|
|
437
|
+
to run repeatedly. Run it once a day from cron or a scheduled GitHub Action and you beat the 1-day
|
|
438
|
+
retention window with a growing archive — no add-on required.
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# Daily cron entry (07:15) — capture yesterday's logs
|
|
442
|
+
15 7 * * * sf audit events pull --target-org myOrg >> ~/.sf/event-baseline/pull.log 2>&1
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Flags:**
|
|
446
|
+
|
|
447
|
+
| Flag | Description | Default |
|
|
448
|
+
|------|-------------|---------|
|
|
449
|
+
| `--target-org` | Org alias or username | required |
|
|
450
|
+
| `--since` | Days of `LogDate` to request (`LAST_N_DAYS` window) | `1` |
|
|
451
|
+
| `--types` | Restrict to specific EventTypes, comma-separated (e.g. `Login,ApiTotalUsage`) | *(all available)* |
|
|
452
|
+
| `--output` / `-o` | Base directory to store logs under | `~/.sf/event-baseline` |
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# Backfill the last 3 days (each still subject to the org's retention)
|
|
456
|
+
sf audit events pull --target-org myOrg --since 3
|
|
457
|
+
|
|
458
|
+
# Only pull login and API-usage logs
|
|
459
|
+
sf audit events pull --target-org myOrg --types Login,ApiTotalUsage
|
|
460
|
+
|
|
461
|
+
# Store under a project-local directory instead of ~/.sf
|
|
462
|
+
sf audit events pull --target-org myOrg --output ./event-baseline
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
> Reading `EventLogFile` requires the **View Event Log Files** permission on the running user (this
|
|
466
|
+
> is in addition to the minimum read-only audit permission set). If it is missing, or the edition
|
|
467
|
+
> does not expose free daily logs, the command exits cleanly with an explanation rather than failing.
|
|
468
|
+
|
|
469
|
+
**Example output:**
|
|
470
|
+
|
|
471
|
+
```
|
|
472
|
+
Pulling free EventLogFile logs for org: My Org (00D000000000001)
|
|
473
|
+
|
|
474
|
+
─────────────────────────────
|
|
475
|
+
Event Baseline Pull
|
|
476
|
+
─────────────────────────────
|
|
477
|
+
Found 7
|
|
478
|
+
Downloaded 7
|
|
479
|
+
Skipped 0 (already saved)
|
|
480
|
+
Total bytes 48213
|
|
481
|
+
─────────────────────────────
|
|
482
|
+
Saved to: ~/.sf/event-baseline/00D000000000001
|
|
483
|
+
Manifest: ~/.sf/event-baseline/00D000000000001/_manifests/manifest-...-....json
|
|
484
|
+
```
|
|
485
|
+
|
|
382
486
|
## Requirements
|
|
383
487
|
|
|
384
488
|
- Node.js 18+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Connection } from '@salesforce/core';
|
|
2
|
+
import type { MetadataClient } from './MetadataClient.js';
|
|
3
|
+
export declare class MetadataClientImpl implements MetadataClient {
|
|
4
|
+
private readonly conn;
|
|
5
|
+
constructor(conn: Connection);
|
|
6
|
+
read<T = Record<string, unknown>>(type: string, fullName: string): Promise<T | null>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=MetadataClientImpl.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class MetadataClientImpl {
|
|
2
|
+
conn;
|
|
3
|
+
constructor(conn) {
|
|
4
|
+
this.conn = conn;
|
|
5
|
+
}
|
|
6
|
+
async read(type, fullName) {
|
|
7
|
+
// jsforce types `read` to a fixed MetadataType union; we pass through arbitrary
|
|
8
|
+
// type names (e.g. 'SecuritySettings'), so call via a loosened signature.
|
|
9
|
+
const read = this.conn.metadata.read.bind(this.conn.metadata);
|
|
10
|
+
const res = await read(type, fullName);
|
|
11
|
+
if (res == null)
|
|
12
|
+
return null;
|
|
13
|
+
const rec = Array.isArray(res) ? res[0] : res;
|
|
14
|
+
// Metadata.read returns an object with only `fullName`/empty fields when the
|
|
15
|
+
// component does not exist — treat that as "not present".
|
|
16
|
+
if (!rec || typeof rec !== 'object')
|
|
17
|
+
return null;
|
|
18
|
+
const keys = Object.keys(rec).filter((k) => k !== 'fullName');
|
|
19
|
+
return keys.length === 0 ? null : rec;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=MetadataClientImpl.js.map
|
package/lib/api/RestClient.d.ts
CHANGED
|
@@ -8,5 +8,11 @@ export class RestClientImpl {
|
|
|
8
8
|
const normalised = path.startsWith('/') ? path : `/${path}`;
|
|
9
9
|
return this.conn.request(`/services/data/v${version}${normalised}`);
|
|
10
10
|
}
|
|
11
|
+
async getRaw(path) {
|
|
12
|
+
const version = this.conn.getApiVersion();
|
|
13
|
+
const normalised = path.startsWith('/') ? path : `/${path}`;
|
|
14
|
+
// jsforce returns the raw body string for non-JSON content types (text/csv here).
|
|
15
|
+
return this.conn.request(`/services/data/v${version}${normalised}`);
|
|
16
|
+
}
|
|
11
17
|
}
|
|
12
18
|
//# sourceMappingURL=RestClientImpl.js.map
|
|
@@ -38,6 +38,25 @@ export const CAPABILITY_REGISTRY = {
|
|
|
38
38
|
'cors-wildcard-origin': { grants: ['credential-theft'] },
|
|
39
39
|
'cors-broad-origin': { grants: ['credential-theft'] },
|
|
40
40
|
'escalation-perms-found': { grants: ['priv-esc'] },
|
|
41
|
+
// Guest bulk-read surface (UI-API reachable) — the confirmed exfiltration sink
|
|
42
|
+
'guest-object-exposure-public-owd': { grants: ['unauth-foothold', 'data-read-bulk'] },
|
|
43
|
+
'guest-object-exposure-guest-owned': { grants: ['unauth-foothold', 'data-read-bulk'] },
|
|
44
|
+
// Observed guest recon in EventLogFile — an active unauthenticated foothold
|
|
45
|
+
'guest-traffic-anomaly-recon': { grants: ['unauth-foothold'] },
|
|
46
|
+
'guest-traffic-anomaly-anonymizer': { grants: ['unauth-foothold'] },
|
|
47
|
+
// Guest API/Bulk access — programmatic unauthenticated bulk read / destruction
|
|
48
|
+
'guest-api-access-enabled': { grants: ['unauth-foothold', 'data-read-bulk'] },
|
|
49
|
+
'guest-api-hard-delete': { grants: ['unauth-foothold', 'data-write'] },
|
|
50
|
+
// Classic Visualforce sites — a second unauthenticated foothold surface
|
|
51
|
+
'classic-sites-active': { grants: ['unauth-foothold'] },
|
|
52
|
+
// Mass data-export capability — a bulk-read sink for an authenticated actor
|
|
53
|
+
'data-export-weekly-export': { grants: ['data-read-bulk'] },
|
|
54
|
+
'data-export-bulk-api-viewall': { grants: ['data-read-bulk', 'data-write'] },
|
|
55
|
+
// Impersonation / delegated-admin escalation
|
|
56
|
+
'login-access-policy-delegated-admins': { grants: ['priv-esc'] },
|
|
57
|
+
'login-access-policy-login-as-enabled': { grants: ['priv-esc', 'data-read-bulk'] },
|
|
58
|
+
// External federation an attacker could ride in on
|
|
59
|
+
'auth-providers-social': { grants: ['low-trust-authenticated'] },
|
|
41
60
|
};
|
|
42
61
|
/** Resolve the effective capabilities for a finding (inline overrides registry; passed/inconclusive yield nothing). */
|
|
43
62
|
export function capabilitiesFor(finding) {
|