@cclabsnz/sf-audit 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -1
- package/lib/apps/analyzeApps.d.ts +1 -1
- package/lib/apps/appResolver.d.ts +1 -1
- package/lib/apps/grantedAccess.d.ts +1 -1
- package/lib/chains/AttackChain.d.ts +1 -1
- package/lib/chains/namedChains.d.ts +1 -1
- package/lib/checks/CheckEngine.d.ts +1 -1
- package/lib/checks/SecurityCheck.d.ts +3 -3
- package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +1 -1
- package/lib/checks/impl/AgentActionSurfaceCheck.js +1 -1
- package/lib/checks/impl/AgentChannelExposureCheck.d.ts +1 -1
- package/lib/checks/impl/AgentInventoryCheck.d.ts +1 -1
- package/lib/checks/impl/AgentInventoryCheck.js +1 -1
- package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +1 -1
- package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +1 -1
- package/lib/checks/impl/AnonymousApexAuditCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
- package/lib/checks/impl/ApexLoggingCheck.d.ts +1 -1
- package/lib/checks/impl/ApexRestEndpointCheck.d.ts +1 -1
- package/lib/checks/impl/ApexSharingCheck.d.ts +1 -1
- package/lib/checks/impl/ApexSharingCheck.js +3 -2
- package/lib/checks/impl/ApiClientPermissionCheck.d.ts +1 -1
- package/lib/checks/impl/ApiLimitsCheck.d.ts +1 -1
- package/lib/checks/impl/AuditTrailCheck.d.ts +1 -1
- package/lib/checks/impl/AuthProvidersCheck.d.ts +1 -1
- package/lib/checks/impl/CertificateExpiryCheck.d.ts +1 -1
- package/lib/checks/impl/ClassicSitesCheck.d.ts +1 -1
- package/lib/checks/impl/CodeSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/CodeSecurityCheck.js +5 -5
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppsCheck.d.ts +1 -1
- package/lib/checks/impl/ContentLinksCheck.d.ts +1 -1
- package/lib/checks/impl/CorsAllowlistCheck.d.ts +1 -1
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -1
- package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
- package/lib/checks/impl/CustomSettingsCheck.d.ts +1 -1
- package/lib/checks/impl/DataClassificationCheck.d.ts +1 -1
- package/lib/checks/impl/DataExportAccessCheck.d.ts +1 -1
- package/lib/checks/impl/DebugLogAccessCheck.d.ts +1 -1
- package/lib/checks/impl/DeploymentIdentityCheck.d.ts +1 -1
- package/lib/checks/impl/EmailSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/EncryptionCoverageCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.js +18 -4
- package/lib/checks/impl/EscalationPermsCheck.d.ts +1 -1
- package/lib/checks/impl/EventMonitoringCheck.d.ts +1 -1
- package/lib/checks/impl/EventMonitoringCheck.js +1 -1
- package/lib/checks/impl/ExperienceCloudSiteCheck.d.ts +1 -1
- package/lib/checks/impl/ExperienceCspCheck.d.ts +1 -1
- package/lib/checks/impl/ExternalCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/FailedLoginCheck.d.ts +1 -1
- package/lib/checks/impl/FieldHistoryTrackingCheck.d.ts +1 -1
- package/lib/checks/impl/FieldLevelSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/FlowsWithoutSharingCheck.d.ts +1 -1
- package/lib/checks/impl/FlowsWithoutSharingCheck.js +10 -9
- package/lib/checks/impl/GuestApiAccessCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +4 -3
- package/lib/checks/impl/GuestObjectExposureCheck.d.ts +1 -1
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +1 -1
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +1 -1
- package/lib/checks/impl/GuestTrafficAnomalyCheck.js +1 -1
- package/lib/checks/impl/GuestUserAccessCheck.d.ts +1 -1
- package/lib/checks/impl/HardcodedCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/HardcodedCredentialsCheck.js +8 -1
- package/lib/checks/impl/HealthCheckCheck.d.ts +1 -1
- package/lib/checks/impl/HighAssuranceSessionCheck.d.ts +1 -1
- package/lib/checks/impl/InactiveUsersCheck.d.ts +1 -1
- package/lib/checks/impl/InstalledPackagesCheck.d.ts +1 -1
- package/lib/checks/impl/IntegrationUsersCheck.d.ts +1 -1
- package/lib/checks/impl/InternalUserMfaCheck.d.ts +1 -1
- package/lib/checks/impl/IpRestrictionsCheck.d.ts +1 -1
- package/lib/checks/impl/LegacyApiVersionCheck.d.ts +1 -1
- package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/LoginAnomalyCheck.d.ts +1 -1
- package/lib/checks/impl/LoginSessionCheck.d.ts +1 -1
- package/lib/checks/impl/MfaEnforcementCheck.d.ts +1 -1
- package/lib/checks/impl/MfaMethodStrengthCheck.d.ts +1 -1
- package/lib/checks/impl/MfaRegistrationCheck.d.ts +1 -1
- package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/NamedCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/NamedCredentialsCheck.js +7 -6
- package/lib/checks/impl/OutboundMessagesCheck.d.ts +1 -1
- package/lib/checks/impl/PasswordSessionPolicyCheck.d.ts +2 -2
- package/lib/checks/impl/PermissionsCheck.d.ts +1 -1
- package/lib/checks/impl/PrivilegedAccessCheck.d.ts +1 -1
- package/lib/checks/impl/PublicContentExposureCheck.d.ts +1 -1
- package/lib/checks/impl/PublicGroupSharingCheck.d.ts +1 -1
- package/lib/checks/impl/ReleaseUpdatesCheck.d.ts +1 -1
- package/lib/checks/impl/RemoteSitesCheck.d.ts +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
- package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +1 -1
- package/lib/checks/impl/ScheduledApexCheck.d.ts +1 -1
- package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +1 -1
- package/lib/checks/impl/SessionHardeningCheck.d.ts +1 -1
- package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
- package/lib/checks/impl/SiemIntegrationCheck.d.ts +1 -1
- package/lib/checks/impl/SsoEnforcementCheck.d.ts +1 -1
- package/lib/checks/impl/StandardProfilesCheck.d.ts +1 -1
- package/lib/checks/impl/ThreatDetectionCheck.d.ts +1 -1
- package/lib/checks/impl/TransactionSecurityPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/TrustedIPRangesCheck.d.ts +1 -1
- package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +1 -1
- package/lib/checks/impl/UsersAndAdminsCheck.d.ts +1 -1
- package/lib/checks/impl/VisualforceXssCheck.d.ts +1 -1
- package/lib/commands/audit/events/pull.d.ts +1 -1
- package/lib/commands/audit/events/pull.js +3 -3
- package/lib/commands/audit/security.js +3 -1
- package/lib/findings/AuditResult.d.ts +1 -1
- package/lib/findings/Finding.d.ts +1 -1
- package/lib/findings/ScoringConfig.d.ts +9 -217
- package/lib/findings/scoring.d.ts +2 -2
- package/lib/findings/scoring.js +1 -1
- package/lib/history/AuditDiff.d.ts +1 -1
- package/lib/history/metricMeta.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/lib/wire.d.ts +6 -6
- package/lib/lib/wire.js +4 -4
- package/lib/renderers/ClientReportRenderer.d.ts +1 -1
- package/lib/renderers/ClientReportRenderer.js +6 -3
- package/lib/renderers/HistoryRenderer.js +2 -1
- package/lib/renderers/HtmlRenderer.js +3 -4
- package/lib/renderers/MarkdownRenderer.js +1 -1
- package/lib/renderers/chartAsset.d.ts +12 -0
- package/lib/renderers/chartAsset.js +25 -0
- package/package.json +26 -28
- package/lib/api/ApiError.d.ts +0 -6
- package/lib/api/ApiError.js +0 -6
- package/lib/api/MetadataClient.d.ts +0 -4
- package/lib/api/MetadataClient.js +0 -2
- package/lib/api/MetadataClientImpl.d.ts +0 -8
- package/lib/api/MetadataClientImpl.js +0 -22
- package/lib/api/RestClient.d.ts +0 -6
- package/lib/api/RestClient.js +0 -2
- package/lib/api/RestClientImpl.d.ts +0 -10
- package/lib/api/RestClientImpl.js +0 -45
- package/lib/api/SoqlClient.d.ts +0 -10
- package/lib/api/SoqlClient.js +0 -2
- package/lib/api/SoqlClientImpl.d.ts +0 -9
- package/lib/api/SoqlClientImpl.js +0 -19
- package/lib/api/ToolingClient.d.ts +0 -5
- package/lib/api/ToolingClient.js +0 -2
- package/lib/api/ToolingClientImpl.d.ts +0 -10
- package/lib/api/ToolingClientImpl.js +0 -29
- package/lib/api/index.d.ts +0 -9
- package/lib/api/index.js +0 -5
- package/lib/checks/eventLogAccess.d.ts +0 -14
- package/lib/checks/eventLogAccess.js +0 -33
- package/lib/context/AuditCache.d.ts +0 -78
- package/lib/context/AuditCache.js +0 -2
- package/lib/context/AuditContext.d.ts +0 -19
- package/lib/context/AuditContext.js +0 -2
- package/lib/context/OrgInfo.d.ts +0 -9
- package/lib/context/OrgInfo.js +0 -2
- package/lib/context/OrgMetrics.d.ts +0 -20
- package/lib/context/OrgMetrics.js +0 -20
- package/lib/events/EventBaselineStore.d.ts +0 -16
- package/lib/events/EventBaselineStore.js +0 -55
- package/lib/events/eventLogQuery.d.ts +0 -21
- package/lib/events/eventLogQuery.js +0 -34
- package/lib/events/pullEventLogs.d.ts +0 -51
- package/lib/events/pullEventLogs.js +0 -79
- package/lib/findings/ComplianceMapping.d.ts +0 -3
- package/lib/findings/ComplianceMapping.js +0 -75
- package/lib/findings/RiskLevel.d.ts +0 -3
- package/lib/findings/RiskLevel.js +0 -2
- package/lib/queries/QueryDefinition.d.ts +0 -48
- package/lib/queries/QueryDefinition.js +0 -11
- package/lib/queries/QueryRegistry.d.ts +0 -13
- package/lib/queries/QueryRegistry.js +0 -93
- package/lib/renderers/html-utils.d.ts +0 -2
- package/lib/renderers/html-utils.js +0 -8
- package/lib/report/branding.d.ts +0 -18
- package/lib/report/branding.js +0 -19
- package/lib/report/fonts.d.ts +0 -2
- package/lib/report/fonts.js +0 -22
- package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type { RiskLevel } from '
|
|
2
|
+
import type { RiskLevel } from '@cclabsnz/sf-core';
|
|
3
3
|
export declare const scoringConfigSchema: z.ZodObject<{
|
|
4
|
-
/** When provided, ALL five risk levels (CRITICAL, HIGH, MEDIUM, LOW, INFO) must be present.
|
|
5
|
-
* The entire object is replaced atomically during merge, not key-by-key. */
|
|
6
4
|
riskScores: z.ZodOptional<z.ZodObject<{
|
|
7
5
|
CRITICAL: z.ZodNumber;
|
|
8
6
|
HIGH: z.ZodNumber;
|
|
9
7
|
MEDIUM: z.ZodNumber;
|
|
10
8
|
LOW: z.ZodNumber;
|
|
11
9
|
INFO: z.ZodNumber;
|
|
12
|
-
},
|
|
13
|
-
CRITICAL: number;
|
|
14
|
-
HIGH: number;
|
|
15
|
-
MEDIUM: number;
|
|
16
|
-
LOW: number;
|
|
17
|
-
INFO: number;
|
|
18
|
-
}, {
|
|
19
|
-
CRITICAL: number;
|
|
20
|
-
HIGH: number;
|
|
21
|
-
MEDIUM: number;
|
|
22
|
-
LOW: number;
|
|
23
|
-
INFO: number;
|
|
24
|
-
}>>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
25
11
|
checkWeights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
26
12
|
gradeThresholds: z.ZodOptional<z.ZodObject<{
|
|
27
13
|
A: z.ZodOptional<z.ZodObject<{
|
|
@@ -29,227 +15,33 @@ export declare const scoringConfigSchema: z.ZodObject<{
|
|
|
29
15
|
maxCritical: z.ZodOptional<z.ZodNumber>;
|
|
30
16
|
maxHigh: z.ZodOptional<z.ZodNumber>;
|
|
31
17
|
maxMedium: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
},
|
|
33
|
-
minScore?: number | undefined;
|
|
34
|
-
maxCritical?: number | undefined;
|
|
35
|
-
maxHigh?: number | undefined;
|
|
36
|
-
maxMedium?: number | undefined;
|
|
37
|
-
}, {
|
|
38
|
-
minScore?: number | undefined;
|
|
39
|
-
maxCritical?: number | undefined;
|
|
40
|
-
maxHigh?: number | undefined;
|
|
41
|
-
maxMedium?: number | undefined;
|
|
42
|
-
}>>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
43
19
|
B: z.ZodOptional<z.ZodObject<{
|
|
44
20
|
minScore: z.ZodOptional<z.ZodNumber>;
|
|
45
21
|
maxCritical: z.ZodOptional<z.ZodNumber>;
|
|
46
22
|
maxHigh: z.ZodOptional<z.ZodNumber>;
|
|
47
23
|
maxMedium: z.ZodOptional<z.ZodNumber>;
|
|
48
|
-
},
|
|
49
|
-
minScore?: number | undefined;
|
|
50
|
-
maxCritical?: number | undefined;
|
|
51
|
-
maxHigh?: number | undefined;
|
|
52
|
-
maxMedium?: number | undefined;
|
|
53
|
-
}, {
|
|
54
|
-
minScore?: number | undefined;
|
|
55
|
-
maxCritical?: number | undefined;
|
|
56
|
-
maxHigh?: number | undefined;
|
|
57
|
-
maxMedium?: number | undefined;
|
|
58
|
-
}>>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
59
25
|
C: z.ZodOptional<z.ZodObject<{
|
|
60
26
|
minScore: z.ZodOptional<z.ZodNumber>;
|
|
61
27
|
maxCritical: z.ZodOptional<z.ZodNumber>;
|
|
62
28
|
maxHigh: z.ZodOptional<z.ZodNumber>;
|
|
63
29
|
maxMedium: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
},
|
|
65
|
-
minScore?: number | undefined;
|
|
66
|
-
maxCritical?: number | undefined;
|
|
67
|
-
maxHigh?: number | undefined;
|
|
68
|
-
maxMedium?: number | undefined;
|
|
69
|
-
}, {
|
|
70
|
-
minScore?: number | undefined;
|
|
71
|
-
maxCritical?: number | undefined;
|
|
72
|
-
maxHigh?: number | undefined;
|
|
73
|
-
maxMedium?: number | undefined;
|
|
74
|
-
}>>;
|
|
30
|
+
}, z.core.$strip>>;
|
|
75
31
|
D: z.ZodOptional<z.ZodObject<{
|
|
76
32
|
minScore: z.ZodOptional<z.ZodNumber>;
|
|
77
33
|
maxCritical: z.ZodOptional<z.ZodNumber>;
|
|
78
34
|
maxHigh: z.ZodOptional<z.ZodNumber>;
|
|
79
35
|
maxMedium: z.ZodOptional<z.ZodNumber>;
|
|
80
|
-
},
|
|
81
|
-
minScore?: number | undefined;
|
|
82
|
-
maxCritical?: number | undefined;
|
|
83
|
-
maxHigh?: number | undefined;
|
|
84
|
-
maxMedium?: number | undefined;
|
|
85
|
-
}, {
|
|
86
|
-
minScore?: number | undefined;
|
|
87
|
-
maxCritical?: number | undefined;
|
|
88
|
-
maxHigh?: number | undefined;
|
|
89
|
-
maxMedium?: number | undefined;
|
|
90
|
-
}>>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
91
37
|
F: z.ZodOptional<z.ZodObject<{
|
|
92
38
|
minScore: z.ZodOptional<z.ZodNumber>;
|
|
93
39
|
maxCritical: z.ZodOptional<z.ZodNumber>;
|
|
94
40
|
maxHigh: z.ZodOptional<z.ZodNumber>;
|
|
95
41
|
maxMedium: z.ZodOptional<z.ZodNumber>;
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
maxHigh?: number | undefined;
|
|
100
|
-
maxMedium?: number | undefined;
|
|
101
|
-
}, {
|
|
102
|
-
minScore?: number | undefined;
|
|
103
|
-
maxCritical?: number | undefined;
|
|
104
|
-
maxHigh?: number | undefined;
|
|
105
|
-
maxMedium?: number | undefined;
|
|
106
|
-
}>>;
|
|
107
|
-
}, "strip", z.ZodTypeAny, {
|
|
108
|
-
A?: {
|
|
109
|
-
minScore?: number | undefined;
|
|
110
|
-
maxCritical?: number | undefined;
|
|
111
|
-
maxHigh?: number | undefined;
|
|
112
|
-
maxMedium?: number | undefined;
|
|
113
|
-
} | undefined;
|
|
114
|
-
B?: {
|
|
115
|
-
minScore?: number | undefined;
|
|
116
|
-
maxCritical?: number | undefined;
|
|
117
|
-
maxHigh?: number | undefined;
|
|
118
|
-
maxMedium?: number | undefined;
|
|
119
|
-
} | undefined;
|
|
120
|
-
C?: {
|
|
121
|
-
minScore?: number | undefined;
|
|
122
|
-
maxCritical?: number | undefined;
|
|
123
|
-
maxHigh?: number | undefined;
|
|
124
|
-
maxMedium?: number | undefined;
|
|
125
|
-
} | undefined;
|
|
126
|
-
D?: {
|
|
127
|
-
minScore?: number | undefined;
|
|
128
|
-
maxCritical?: number | undefined;
|
|
129
|
-
maxHigh?: number | undefined;
|
|
130
|
-
maxMedium?: number | undefined;
|
|
131
|
-
} | undefined;
|
|
132
|
-
F?: {
|
|
133
|
-
minScore?: number | undefined;
|
|
134
|
-
maxCritical?: number | undefined;
|
|
135
|
-
maxHigh?: number | undefined;
|
|
136
|
-
maxMedium?: number | undefined;
|
|
137
|
-
} | undefined;
|
|
138
|
-
}, {
|
|
139
|
-
A?: {
|
|
140
|
-
minScore?: number | undefined;
|
|
141
|
-
maxCritical?: number | undefined;
|
|
142
|
-
maxHigh?: number | undefined;
|
|
143
|
-
maxMedium?: number | undefined;
|
|
144
|
-
} | undefined;
|
|
145
|
-
B?: {
|
|
146
|
-
minScore?: number | undefined;
|
|
147
|
-
maxCritical?: number | undefined;
|
|
148
|
-
maxHigh?: number | undefined;
|
|
149
|
-
maxMedium?: number | undefined;
|
|
150
|
-
} | undefined;
|
|
151
|
-
C?: {
|
|
152
|
-
minScore?: number | undefined;
|
|
153
|
-
maxCritical?: number | undefined;
|
|
154
|
-
maxHigh?: number | undefined;
|
|
155
|
-
maxMedium?: number | undefined;
|
|
156
|
-
} | undefined;
|
|
157
|
-
D?: {
|
|
158
|
-
minScore?: number | undefined;
|
|
159
|
-
maxCritical?: number | undefined;
|
|
160
|
-
maxHigh?: number | undefined;
|
|
161
|
-
maxMedium?: number | undefined;
|
|
162
|
-
} | undefined;
|
|
163
|
-
F?: {
|
|
164
|
-
minScore?: number | undefined;
|
|
165
|
-
maxCritical?: number | undefined;
|
|
166
|
-
maxHigh?: number | undefined;
|
|
167
|
-
maxMedium?: number | undefined;
|
|
168
|
-
} | undefined;
|
|
169
|
-
}>>;
|
|
170
|
-
}, "strip", z.ZodTypeAny, {
|
|
171
|
-
riskScores?: {
|
|
172
|
-
CRITICAL: number;
|
|
173
|
-
HIGH: number;
|
|
174
|
-
MEDIUM: number;
|
|
175
|
-
LOW: number;
|
|
176
|
-
INFO: number;
|
|
177
|
-
} | undefined;
|
|
178
|
-
checkWeights?: Record<string, number> | undefined;
|
|
179
|
-
gradeThresholds?: {
|
|
180
|
-
A?: {
|
|
181
|
-
minScore?: number | undefined;
|
|
182
|
-
maxCritical?: number | undefined;
|
|
183
|
-
maxHigh?: number | undefined;
|
|
184
|
-
maxMedium?: number | undefined;
|
|
185
|
-
} | undefined;
|
|
186
|
-
B?: {
|
|
187
|
-
minScore?: number | undefined;
|
|
188
|
-
maxCritical?: number | undefined;
|
|
189
|
-
maxHigh?: number | undefined;
|
|
190
|
-
maxMedium?: number | undefined;
|
|
191
|
-
} | undefined;
|
|
192
|
-
C?: {
|
|
193
|
-
minScore?: number | undefined;
|
|
194
|
-
maxCritical?: number | undefined;
|
|
195
|
-
maxHigh?: number | undefined;
|
|
196
|
-
maxMedium?: number | undefined;
|
|
197
|
-
} | undefined;
|
|
198
|
-
D?: {
|
|
199
|
-
minScore?: number | undefined;
|
|
200
|
-
maxCritical?: number | undefined;
|
|
201
|
-
maxHigh?: number | undefined;
|
|
202
|
-
maxMedium?: number | undefined;
|
|
203
|
-
} | undefined;
|
|
204
|
-
F?: {
|
|
205
|
-
minScore?: number | undefined;
|
|
206
|
-
maxCritical?: number | undefined;
|
|
207
|
-
maxHigh?: number | undefined;
|
|
208
|
-
maxMedium?: number | undefined;
|
|
209
|
-
} | undefined;
|
|
210
|
-
} | undefined;
|
|
211
|
-
}, {
|
|
212
|
-
riskScores?: {
|
|
213
|
-
CRITICAL: number;
|
|
214
|
-
HIGH: number;
|
|
215
|
-
MEDIUM: number;
|
|
216
|
-
LOW: number;
|
|
217
|
-
INFO: number;
|
|
218
|
-
} | undefined;
|
|
219
|
-
checkWeights?: Record<string, number> | undefined;
|
|
220
|
-
gradeThresholds?: {
|
|
221
|
-
A?: {
|
|
222
|
-
minScore?: number | undefined;
|
|
223
|
-
maxCritical?: number | undefined;
|
|
224
|
-
maxHigh?: number | undefined;
|
|
225
|
-
maxMedium?: number | undefined;
|
|
226
|
-
} | undefined;
|
|
227
|
-
B?: {
|
|
228
|
-
minScore?: number | undefined;
|
|
229
|
-
maxCritical?: number | undefined;
|
|
230
|
-
maxHigh?: number | undefined;
|
|
231
|
-
maxMedium?: number | undefined;
|
|
232
|
-
} | undefined;
|
|
233
|
-
C?: {
|
|
234
|
-
minScore?: number | undefined;
|
|
235
|
-
maxCritical?: number | undefined;
|
|
236
|
-
maxHigh?: number | undefined;
|
|
237
|
-
maxMedium?: number | undefined;
|
|
238
|
-
} | undefined;
|
|
239
|
-
D?: {
|
|
240
|
-
minScore?: number | undefined;
|
|
241
|
-
maxCritical?: number | undefined;
|
|
242
|
-
maxHigh?: number | undefined;
|
|
243
|
-
maxMedium?: number | undefined;
|
|
244
|
-
} | undefined;
|
|
245
|
-
F?: {
|
|
246
|
-
minScore?: number | undefined;
|
|
247
|
-
maxCritical?: number | undefined;
|
|
248
|
-
maxHigh?: number | undefined;
|
|
249
|
-
maxMedium?: number | undefined;
|
|
250
|
-
} | undefined;
|
|
251
|
-
} | undefined;
|
|
252
|
-
}>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
253
45
|
export type ScoringConfigInput = z.infer<typeof scoringConfigSchema>;
|
|
254
46
|
export interface GradeConditions {
|
|
255
47
|
minScore?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Finding } from './Finding.js';
|
|
2
|
-
import type { OrgMetrics } from '
|
|
2
|
+
import type { OrgMetrics } from '@cclabsnz/sf-core';
|
|
3
3
|
import type { AuditResult } from './AuditResult.js';
|
|
4
|
-
import type { AuditContext } from '
|
|
4
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
5
5
|
import type { ScoringConfig } from './ScoringConfig.js';
|
|
6
6
|
import type { AttackChain } from '../chains/AttackChain.js';
|
|
7
7
|
export declare function buildAuditResult(ctx: AuditContext, findings: Finding[], metrics: Partial<OrgMetrics>, config?: ScoringConfig, attackChains?: AttackChain[]): AuditResult;
|
package/lib/findings/scoring.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EMPTY_METRICS } from '
|
|
1
|
+
import { EMPTY_METRICS } from '@cclabsnz/sf-core';
|
|
2
2
|
import { DEFAULT_SCORING_CONFIG } from './ScoringConfig.js';
|
|
3
3
|
function meetsConditions(conditions, healthScore, criticalCount, highCount, mediumCount) {
|
|
4
4
|
if (conditions.minScore !== undefined && healthScore < conditions.minScore)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Finding } from '../findings/Finding.js';
|
|
2
|
-
import type { OrgMetrics } from '
|
|
2
|
+
import type { OrgMetrics } from '@cclabsnz/sf-core';
|
|
3
3
|
import type { AuditResult } from '../findings/AuditResult.js';
|
|
4
4
|
export type FindingChangeType = 'new' | 'resolved' | 'severity-changed' | 'detail-changed' | 'unchanged';
|
|
5
5
|
export interface FindingChange {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { AuditResult } from './findings/AuditResult.js';
|
|
2
2
|
export type { Finding } from './findings/Finding.js';
|
|
3
|
-
export type { RiskLevel } from '
|
|
4
|
-
export type { OrgMetrics } from '
|
|
3
|
+
export type { RiskLevel } from '@cclabsnz/sf-core';
|
|
4
|
+
export type { OrgMetrics } from '@cclabsnz/sf-core';
|
|
5
5
|
export type { AuditDiff, FindingChange, FindingChangeType, MetricDelta } from './history/AuditDiff.js';
|
|
6
6
|
export { HistoryStore } from './history/HistoryStore.js';
|
|
7
7
|
export { computeDiff } from './history/DiffEngine.js';
|
package/lib/lib/wire.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Connection } from '@salesforce/core';
|
|
2
|
-
import { SoqlClientImpl } from '
|
|
3
|
-
import { ToolingClientImpl } from '
|
|
4
|
-
import { RestClientImpl } from '
|
|
5
|
-
import { MetadataClientImpl } from '
|
|
6
|
-
import type { AuditContext, AuditOptions } from '
|
|
7
|
-
import type { OrgInfo } from '
|
|
2
|
+
import { SoqlClientImpl } from '@cclabsnz/sf-core';
|
|
3
|
+
import { ToolingClientImpl } from '@cclabsnz/sf-core';
|
|
4
|
+
import { RestClientImpl } from '@cclabsnz/sf-core';
|
|
5
|
+
import { MetadataClientImpl } from '@cclabsnz/sf-core';
|
|
6
|
+
import type { AuditContext, AuditOptions } from '@cclabsnz/sf-core';
|
|
7
|
+
import type { OrgInfo } from '@cclabsnz/sf-core';
|
|
8
8
|
export declare function buildApiClients(conn: Connection): {
|
|
9
9
|
soql: SoqlClientImpl;
|
|
10
10
|
tooling: ToolingClientImpl;
|
package/lib/lib/wire.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SoqlClientImpl } from '
|
|
2
|
-
import { ToolingClientImpl } from '
|
|
3
|
-
import { RestClientImpl } from '
|
|
4
|
-
import { MetadataClientImpl } from '
|
|
1
|
+
import { SoqlClientImpl } from '@cclabsnz/sf-core';
|
|
2
|
+
import { ToolingClientImpl } from '@cclabsnz/sf-core';
|
|
3
|
+
import { RestClientImpl } from '@cclabsnz/sf-core';
|
|
4
|
+
import { MetadataClientImpl } from '@cclabsnz/sf-core';
|
|
5
5
|
export function buildApiClients(conn) {
|
|
6
6
|
return {
|
|
7
7
|
soql: new SoqlClientImpl(conn),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AuditResult } from '../findings/AuditResult.js';
|
|
2
2
|
import type { AuditRenderer } from './AuditRenderer.js';
|
|
3
|
-
import type { Branding } from '
|
|
3
|
+
import type { Branding } from '@cclabsnz/sf-core';
|
|
4
4
|
import type { Framework } from '../compliance/types.js';
|
|
5
5
|
export interface ClientReportOptions {
|
|
6
6
|
branding: Branding;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { esc } from '
|
|
2
|
-
import { fontFaceCss } from '
|
|
1
|
+
import { esc } from '@cclabsnz/sf-core';
|
|
2
|
+
import { fontFaceCss } from '@cclabsnz/sf-core';
|
|
3
3
|
import { getCheckMeta } from '../findings/CheckMeta.js';
|
|
4
4
|
import { selectPriorities } from '../report/ExecutivePriorities.js';
|
|
5
5
|
import { buildRoadmap } from '../report/RemediationRoadmap.js';
|
|
@@ -198,8 +198,11 @@ ${tier('Projects', 'weeks', roadmap.project)}`;
|
|
|
198
198
|
return `${this.sectionHead(numStr, 'All Findings')}${rows}`;
|
|
199
199
|
}
|
|
200
200
|
footer(b) {
|
|
201
|
+
const site = b.website
|
|
202
|
+
? ` · <a href="https://${esc(b.website.replace(/^https?:\/\//, ''))}">${esc(b.website.replace(/^https?:\/\//, ''))}</a>`
|
|
203
|
+
: '';
|
|
201
204
|
return `<footer><span class="label">Scope & Liability</span>
|
|
202
|
-
Read-only, point-in-time configuration review: not a penetration test, not a code audit. The grade is a prioritisation aid, not a certification. Validate findings before remediation. © ${new Date().getFullYear()} ${esc(b.firmName)} · ${esc(b.contact)}</footer>`;
|
|
205
|
+
Read-only, point-in-time configuration review: not a penetration test, not a code audit. The grade is a prioritisation aid, not a certification. Validate findings before remediation. © ${new Date().getFullYear()} ${esc(b.firmName)} · ${esc(b.contact)}${site}</footer>`;
|
|
203
206
|
}
|
|
204
207
|
}
|
|
205
208
|
//# sourceMappingURL=ClientReportRenderer.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { chartJsScript } from './chartAsset.js';
|
|
1
2
|
function fmtDate(d) {
|
|
2
3
|
return d.toISOString().replace('T', ' ').substring(0, 16);
|
|
3
4
|
}
|
|
@@ -65,7 +66,7 @@ export class HistoryRenderer {
|
|
|
65
66
|
<meta charset="UTF-8">
|
|
66
67
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
67
68
|
<title>SF Audit History: ${orgName}</title>
|
|
68
|
-
<script
|
|
69
|
+
<script>${chartJsScript()}</script>
|
|
69
70
|
<style>
|
|
70
71
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
71
72
|
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: #0d1117; color: #c9d1d9; max-width: 1100px; margin: 2rem auto; padding: 0 1.25rem 4rem; line-height: 1.6; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { esc } from '
|
|
1
|
+
import { esc, firaFontFaceCss } from '@cclabsnz/sf-core';
|
|
2
2
|
const RISK_COLORS = {
|
|
3
3
|
CRITICAL: '#dc2626',
|
|
4
4
|
HIGH: '#ea580c',
|
|
@@ -242,9 +242,8 @@ export class HtmlRenderer {
|
|
|
242
242
|
<meta charset="UTF-8">
|
|
243
243
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
244
244
|
<title>SF Security Audit: ${esc(result.orgName)}</title>
|
|
245
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
246
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&family=Fira+Sans:wght@300;400;500;600;700&display=swap">
|
|
247
245
|
<style>
|
|
246
|
+
${firaFontFaceCss()}
|
|
248
247
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
249
248
|
body {
|
|
250
249
|
font-family: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
|
|
@@ -563,7 +562,7 @@ export class HtmlRenderer {
|
|
|
563
562
|
});
|
|
564
563
|
</script>
|
|
565
564
|
<div class="offline-footer">
|
|
566
|
-
<strong>Offline-first audit:</strong> all analysis performed locally; no data is transmitted outside your Salesforce org. Generated by
|
|
565
|
+
<strong>Offline-first audit:</strong> all analysis performed locally; no data is transmitted outside your Salesforce org. Generated by <a href="https://github.com/cclabsnz/sf-audit-plugin" style="color:inherit">sf-audit</a>, built by <a href="https://cloudcounsel.co.nz" style="color:inherit">CloudCounsel</a>.
|
|
567
566
|
</div>
|
|
568
567
|
</body>
|
|
569
568
|
</html>`;
|
|
@@ -79,7 +79,7 @@ export class MarkdownRenderer {
|
|
|
79
79
|
lines.push('');
|
|
80
80
|
lines.push('---');
|
|
81
81
|
lines.push('');
|
|
82
|
-
lines.push('> **Offline-first audit:** all analysis is performed locally; no data is transmitted outside your Salesforce org. Generated by
|
|
82
|
+
lines.push('> **Offline-first audit:** all analysis is performed locally; no data is transmitted outside your Salesforce org. Generated by [sf-audit](https://github.com/cclabsnz/sf-audit-plugin), built by [CloudCounsel](https://cloudcounsel.co.nz).');
|
|
83
83
|
lines.push('');
|
|
84
84
|
return lines.join('\n');
|
|
85
85
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Chart.js UMD bundle, read from the pinned `chart.js` dependency so it can be inlined
|
|
3
|
+
* into a generated report. An audit deliverable must never fetch script from a third-party
|
|
4
|
+
* CDN: the report carries sensitive org findings, is often opened on locked-down machines,
|
|
5
|
+
* and a compromised CDN would otherwise execute arbitrary JS in that page.
|
|
6
|
+
*
|
|
7
|
+
* Resolved from the dependency rather than vendored as a committed blob so the version stays
|
|
8
|
+
* visible to `pnpm audit`/dependabot. The UMD file itself is not in chart.js's `exports` map,
|
|
9
|
+
* so it is located relative to the resolved main entry.
|
|
10
|
+
*/
|
|
11
|
+
export declare function chartJsScript(): string;
|
|
12
|
+
//# sourceMappingURL=chartAsset.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
const requireFrom = createRequire(import.meta.url);
|
|
5
|
+
let cached = null;
|
|
6
|
+
/**
|
|
7
|
+
* The Chart.js UMD bundle, read from the pinned `chart.js` dependency so it can be inlined
|
|
8
|
+
* into a generated report. An audit deliverable must never fetch script from a third-party
|
|
9
|
+
* CDN: the report carries sensitive org findings, is often opened on locked-down machines,
|
|
10
|
+
* and a compromised CDN would otherwise execute arbitrary JS in that page.
|
|
11
|
+
*
|
|
12
|
+
* Resolved from the dependency rather than vendored as a committed blob so the version stays
|
|
13
|
+
* visible to `pnpm audit`/dependabot. The UMD file itself is not in chart.js's `exports` map,
|
|
14
|
+
* so it is located relative to the resolved main entry.
|
|
15
|
+
*/
|
|
16
|
+
export function chartJsScript() {
|
|
17
|
+
if (cached !== null)
|
|
18
|
+
return cached;
|
|
19
|
+
const umd = join(dirname(requireFrom.resolve('chart.js')), 'chart.umd.min.js');
|
|
20
|
+
// A literal `</script` in the bundle would close the tag early. Chart.js has none today;
|
|
21
|
+
// escape defensively so a future version cannot silently break the report.
|
|
22
|
+
cached = readFileSync(umd, 'utf8').replace(/<\/script/gi, '<\\/script');
|
|
23
|
+
return cached;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=chartAsset.js.map
|
package/package.json
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Salesforce Security Audit — native sf plugin",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"packageManager": "pnpm@10.33.0",
|
|
7
8
|
"main": "lib/index.js",
|
|
8
9
|
"scripts": {
|
|
9
10
|
"build": "tsc -p tsconfig.json",
|
|
10
|
-
"test": "node --experimental-vm-modules node_modules/jest
|
|
11
|
-
"test:unit": "node --experimental-vm-modules node_modules/jest
|
|
11
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --passWithNoTests",
|
|
12
|
+
"test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --passWithNoTests",
|
|
12
13
|
"prepack": "npm run build",
|
|
13
|
-
"clean": "rm -rf lib"
|
|
14
|
+
"clean": "rm -rf lib",
|
|
15
|
+
"prepare": "git config core.hooksPath .githooks 2>/dev/null || true"
|
|
14
16
|
},
|
|
15
17
|
"dependencies": {
|
|
16
18
|
"@oclif/core": "^4",
|
|
17
|
-
"@salesforce/core": "^
|
|
18
|
-
"@salesforce/sf-plugins-core": "^
|
|
19
|
-
"
|
|
19
|
+
"@salesforce/core": "^9",
|
|
20
|
+
"@salesforce/sf-plugins-core": "^13",
|
|
21
|
+
"chart.js": "^4.5.1",
|
|
22
|
+
"zod": "^4",
|
|
23
|
+
"@cclabsnz/sf-core": "^0.1.5"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@types/
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"@jest/globals": "^30.4.1",
|
|
27
|
+
"@types/jest": "^30",
|
|
28
|
+
"@types/node": "^26",
|
|
29
|
+
"jest": "^30",
|
|
30
|
+
"ts-jest": "^29.4.12",
|
|
26
31
|
"ts-node": "^10.9.2",
|
|
27
32
|
"typescript": "^5"
|
|
28
33
|
},
|
|
@@ -54,26 +59,19 @@
|
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
},
|
|
57
|
-
"pnpm": {
|
|
58
|
-
"overrides": {
|
|
59
|
-
"form-data": "^4.0.6",
|
|
60
|
-
"js-yaml@3": "^3.15.0"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"overrides": {
|
|
64
|
-
"handlebars": "^4.7.9",
|
|
65
|
-
"minimatch@5": {
|
|
66
|
-
"brace-expansion": "^2.0.3"
|
|
67
|
-
},
|
|
68
|
-
"minimatch@10": {
|
|
69
|
-
"brace-expansion": "^5.0.5"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
62
|
"files": [
|
|
73
63
|
"/lib",
|
|
74
64
|
"/messages",
|
|
75
65
|
"/config",
|
|
76
|
-
"/src/assets",
|
|
77
66
|
"!/lib/**/*.map"
|
|
78
|
-
]
|
|
67
|
+
],
|
|
68
|
+
"pnpm": {
|
|
69
|
+
"overrides": {
|
|
70
|
+
"form-data": "^4.0.6",
|
|
71
|
+
"js-yaml@3": "^3.15.0",
|
|
72
|
+
"handlebars": "^4.7.9",
|
|
73
|
+
"brace-expansion": "^5.0.8",
|
|
74
|
+
"fast-uri@3": "^3.1.4"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
79
77
|
}
|
package/lib/api/ApiError.d.ts
DELETED
package/lib/api/ApiError.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1,22 +0,0 @@
|
|
|
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
DELETED
package/lib/api/RestClient.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Connection } from '@salesforce/core';
|
|
2
|
-
import type { RestClient } from './RestClient.js';
|
|
3
|
-
export declare class RestClientImpl implements RestClient {
|
|
4
|
-
private readonly conn;
|
|
5
|
-
constructor(conn: Connection);
|
|
6
|
-
get<T>(path: string): Promise<T>;
|
|
7
|
-
getRaw(path: string): Promise<string>;
|
|
8
|
-
getRawToFile(path: string, destPath: string): Promise<number>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=RestClientImpl.d.ts.map
|