@cclabsnz/sf-audit 1.16.0 → 1.18.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/CHANGELOG.md +172 -1
- package/PERMISSIONS.md +139 -0
- package/README.md +98 -26
- package/config/scoring.sample.json +104 -5
- package/docs/permissionset/SF_Audit_ReadOnly.permissionset-meta.xml +54 -0
- package/lib/apps/analyzeApps.d.ts +8 -2
- package/lib/apps/analyzeApps.js +7 -2
- package/lib/apps/apiLogSource.d.ts +39 -0
- package/lib/apps/apiLogSource.js +75 -0
- package/lib/apps/appResolver.js +30 -4
- package/lib/apps/grantedAccess.js +16 -3
- package/lib/apps/leastPrivilege.d.ts +3 -1
- package/lib/apps/leastPrivilege.js +7 -3
- package/lib/apps/permissionSetGenerator.d.ts +22 -0
- package/lib/apps/permissionSetGenerator.js +100 -0
- package/lib/apps/types.d.ts +6 -0
- package/lib/apps/usageCollector.d.ts +7 -1
- package/lib/apps/usageCollector.js +57 -26
- package/lib/chains/CapabilityRegistry.js +26 -0
- package/lib/chains/ChainEngine.js +11 -1
- package/lib/chains/namedChains.js +130 -24
- package/lib/checks/CheckEngine.d.ts +3 -1
- package/lib/checks/CheckEngine.js +65 -26
- package/lib/checks/impl/AgentUserPrivilegeCheck.js +5 -4
- package/lib/checks/impl/AnonymousApexAuditCheck.js +41 -8
- package/lib/checks/impl/ApexCrudFLSCheck.js +45 -10
- package/lib/checks/impl/ApexSharingCheck.js +19 -26
- package/lib/checks/impl/ApiClientPermissionCheck.js +21 -5
- package/lib/checks/impl/AuditTrailCheck.js +23 -8
- package/lib/checks/impl/AuthProviderRegistrationHandlerCheck.d.ts +10 -0
- package/lib/checks/impl/AuthProviderRegistrationHandlerCheck.js +131 -0
- package/lib/checks/impl/CertificateExpiryCheck.js +2 -1
- package/lib/checks/impl/ConnectedAppScopeCheck.js +61 -5
- package/lib/checks/impl/ConnectedAppsCheck.js +60 -5
- package/lib/checks/impl/ContentLinksCheck.js +33 -9
- package/lib/checks/impl/CorsAllowlistCheck.js +3 -2
- package/lib/checks/impl/DataClassificationCheck.js +15 -13
- package/lib/checks/impl/DataCloudDataSpaceIsolationCheck.d.ts +10 -0
- package/lib/checks/impl/DataCloudDataSpaceIsolationCheck.js +116 -0
- package/lib/checks/impl/DebugLogAccessCheck.js +4 -4
- package/lib/checks/impl/DelegatedAdministrationGroupsCheck.d.ts +10 -0
- package/lib/checks/impl/DelegatedAdministrationGroupsCheck.js +76 -0
- package/lib/checks/impl/DelegatedAuthenticationExposureCheck.d.ts +10 -0
- package/lib/checks/impl/DelegatedAuthenticationExposureCheck.js +105 -0
- package/lib/checks/impl/DeploymentIdentityCheck.js +32 -5
- package/lib/checks/impl/EmailSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/EmailSecurityCheck.js +14 -34
- package/lib/checks/impl/EncryptionCoverageCheck.js +21 -15
- package/lib/checks/impl/EnhancedDomainsCheck.js +17 -2
- package/lib/checks/impl/EscalationPermsCheck.d.ts +2 -0
- package/lib/checks/impl/EscalationPermsCheck.js +88 -21
- package/lib/checks/impl/ExperienceCloudSiteCheck.js +56 -5
- package/lib/checks/impl/ExternalAccountHierarchyExposureCheck.d.ts +10 -0
- package/lib/checks/impl/ExternalAccountHierarchyExposureCheck.js +65 -0
- package/lib/checks/impl/ExternalCredentialsCheck.js +6 -3
- package/lib/checks/impl/FailedLoginCheck.js +36 -9
- package/lib/checks/impl/FieldHistoryTrackingCheck.js +14 -11
- package/lib/checks/impl/FlowHttpCalloutCredentialBypassCheck.d.ts +10 -0
- package/lib/checks/impl/FlowHttpCalloutCredentialBypassCheck.js +115 -0
- package/lib/checks/impl/GenAiPromptTemplateGroundingCheck.d.ts +10 -0
- package/lib/checks/impl/GenAiPromptTemplateGroundingCheck.js +227 -0
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +105 -14
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +52 -11
- package/lib/checks/impl/HardcodedCredentialsCheck.js +7 -2
- package/lib/checks/impl/HealthCheckCheck.js +1 -0
- package/lib/checks/impl/HighAssuranceSessionCheck.js +16 -11
- package/lib/checks/impl/InactiveUsersCheck.js +1 -1
- package/lib/checks/impl/InboundEmailHandlerExposureCheck.d.ts +10 -0
- package/lib/checks/impl/InboundEmailHandlerExposureCheck.js +136 -0
- package/lib/checks/impl/IntegrationLeastPrivilegeCheck.js +7 -6
- package/lib/checks/impl/InternalUserMfaCheck.js +26 -8
- package/lib/checks/impl/IpRestrictionsCheck.js +35 -16
- package/lib/checks/impl/LoginAccessPolicyCheck.js +5 -4
- package/lib/checks/impl/LoginAnomalyCheck.js +10 -7
- package/lib/checks/impl/LoginSessionCheck.js +2 -0
- package/lib/checks/impl/MfaEnforcementCheck.js +23 -6
- package/lib/checks/impl/MfaMethodStrengthCheck.js +18 -3
- package/lib/checks/impl/MfaRegistrationCheck.js +4 -3
- package/lib/checks/impl/MyDomainLoginPolicyCheck.js +23 -10
- package/lib/checks/impl/OauthDeviceAndAssetTokenFlowsCheck.d.ts +10 -0
- package/lib/checks/impl/OauthDeviceAndAssetTokenFlowsCheck.js +84 -0
- package/lib/checks/impl/OrgWideEmailSpoofingCheck.d.ts +10 -0
- package/lib/checks/impl/OrgWideEmailSpoofingCheck.js +106 -0
- package/lib/checks/impl/OutboundMessagesCheck.js +48 -6
- package/lib/checks/impl/PackagePostInstallSupplyChainCheck.d.ts +10 -0
- package/lib/checks/impl/PackagePostInstallSupplyChainCheck.js +89 -0
- package/lib/checks/impl/PlatformEventSubscriberContextCheck.d.ts +10 -0
- package/lib/checks/impl/PlatformEventSubscriberContextCheck.js +88 -0
- package/lib/checks/impl/PrivilegedAccessCheck.js +12 -5
- package/lib/checks/impl/ReleaseUpdatesCheck.js +18 -3
- package/lib/checks/impl/RemoteSitesCheck.js +4 -4
- package/lib/checks/impl/RestrictionRulesIntegrityCheck.d.ts +10 -0
- package/lib/checks/impl/RestrictionRulesIntegrityCheck.js +105 -0
- package/lib/checks/impl/SeparationOfDutiesCheck.js +14 -3
- package/lib/checks/impl/ShieldTenantSecretLifecycleCheck.d.ts +10 -0
- package/lib/checks/impl/ShieldTenantSecretLifecycleCheck.js +90 -0
- package/lib/checks/impl/SoapLoginApiAuthCheck.js +20 -8
- package/lib/checks/impl/SsoEnforcementCheck.js +16 -5
- package/lib/checks/impl/TransactionSecurityPolicyCheck.js +5 -5
- package/lib/checks/impl/TrustedIPRangesCheck.js +18 -9
- package/lib/checks/impl/UsersAndAdminsCheck.js +24 -4
- package/lib/checks/permCatalog.js +1 -1
- package/lib/checks/registry.js +30 -0
- package/lib/checks/support/apexAccess.d.ts +56 -0
- package/lib/checks/support/apexAccess.js +127 -0
- package/lib/checks/support/missingObject.d.ts +13 -0
- package/lib/checks/support/missingObject.js +37 -0
- package/lib/checks/support/schema.d.ts +17 -0
- package/lib/checks/support/schema.js +41 -0
- package/lib/commands/audit/apps.d.ts +1 -0
- package/lib/commands/audit/apps.js +86 -30
- package/lib/commands/audit/diff.js +2 -2
- package/lib/commands/audit/events/pull.js +3 -1
- package/lib/commands/audit/history.js +2 -2
- package/lib/commands/audit/incident/collect.js +3 -1
- package/lib/commands/audit/incident/report.js +2 -2
- package/lib/commands/audit/security.d.ts +3 -0
- package/lib/commands/audit/security.js +65 -10
- package/lib/commands/audit/timeline.js +2 -2
- package/lib/compliance/mapping.js +28 -7
- package/lib/findings/AuditResult.d.ts +10 -0
- package/lib/findings/CheckMeta.js +15 -0
- package/lib/findings/Finding.d.ts +4 -0
- package/lib/findings/ScoringConfig.d.ts +10 -8
- package/lib/findings/ScoringConfig.js +12 -5
- package/lib/findings/coverage.d.ts +34 -0
- package/lib/findings/coverage.js +42 -0
- package/lib/findings/exitCode.js +1 -1
- package/lib/findings/loadScoringConfig.js +51 -8
- package/lib/findings/scoring.js +61 -10
- package/lib/history/HistoryStore.js +9 -3
- package/lib/history/archivePolicy.d.ts +19 -0
- package/lib/history/archivePolicy.js +34 -0
- package/lib/incident/bundleIo.js +4 -3
- package/lib/incident/collect/collectBundle.d.ts +1 -1
- package/lib/incident/collect/collectBundle.js +4 -3
- package/lib/incident/collect/streamGuestLogs.d.ts +1 -1
- package/lib/incident/collect/streamGuestLogs.js +3 -2
- package/lib/incident/csv.js +4 -4
- package/lib/incident/render/evidence.js +3 -3
- package/lib/incident/render/html.js +2 -3
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/lib/packageInfo.d.ts +6 -0
- package/lib/lib/packageInfo.js +19 -0
- package/lib/preflight/permissionMap.d.ts +2 -20
- package/lib/preflight/permissionMap.js +2 -43
- package/lib/preflight/permissions.d.ts +25 -0
- package/lib/preflight/permissions.js +50 -0
- package/lib/renderers/AttackChainDagRenderer.d.ts +7 -0
- package/lib/renderers/AttackChainDagRenderer.js +139 -0
- package/lib/renderers/ClientReportRenderer.d.ts +2 -0
- package/lib/renderers/ClientReportRenderer.js +34 -6
- package/lib/renderers/DiffHtmlRenderer.js +2 -7
- package/lib/renderers/HistoryRenderer.js +19 -11
- package/lib/renderers/HtmlRenderer.js +23 -6
- package/lib/renderers/MarkdownRenderer.js +11 -1
- package/lib/renderers/SarifRenderer.d.ts +43 -0
- package/lib/renderers/SarifRenderer.js +250 -0
- package/lib/report/ExecutivePriorities.js +1 -1
- package/lib/report/RemediationRoadmap.d.ts +5 -1
- package/lib/report/RemediationRoadmap.js +6 -2
- package/lib/waivers/WaiverLoader.d.ts +28 -0
- package/lib/waivers/WaiverLoader.js +103 -0
- package/lib/waivers/WaiverModel.d.ts +32 -0
- package/lib/waivers/WaiverModel.js +28 -0
- package/lib/waivers/applyWaivers.d.ts +22 -0
- package/lib/waivers/applyWaivers.js +85 -0
- package/package.json +6 -4
|
@@ -55,34 +55,65 @@ function verbOf(method) {
|
|
|
55
55
|
return 'write';
|
|
56
56
|
return 'read';
|
|
57
57
|
}
|
|
58
|
-
export function collectUsage(restApiCsv,
|
|
59
|
-
const
|
|
58
|
+
export function collectUsage(restApiCsv, optsOrSoap) {
|
|
59
|
+
const opts = typeof optsOrSoap === 'string'
|
|
60
|
+
? { soapApiCsv: optsOrSoap }
|
|
61
|
+
: optsOrSoap ?? {};
|
|
60
62
|
const byApp = new Map();
|
|
63
|
+
let totalRows = 0;
|
|
61
64
|
let attributed = 0;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
65
|
+
const processFile = (csvText, entityGetter, verbGetter, rowsGetter) => {
|
|
66
|
+
if (!csvText)
|
|
67
|
+
return;
|
|
68
|
+
const rows = parseCsv(csvText);
|
|
69
|
+
totalRows += rows.length;
|
|
70
|
+
for (const row of rows) {
|
|
71
|
+
const appId = row.CONNECTED_APP_ID ?? '';
|
|
72
|
+
if (!appId)
|
|
73
|
+
continue;
|
|
74
|
+
attributed++;
|
|
75
|
+
let a = byApp.get(appId);
|
|
76
|
+
if (!a) {
|
|
77
|
+
a = { objects: new Map(), requests: 0, rows: 0, users: new Set() };
|
|
78
|
+
byApp.set(appId, a);
|
|
79
|
+
}
|
|
80
|
+
a.requests++;
|
|
81
|
+
a.rows += rowsGetter(row);
|
|
82
|
+
if (row.USER_ID)
|
|
83
|
+
a.users.add(row.USER_ID);
|
|
84
|
+
const entity = entityGetter(row);
|
|
85
|
+
if (entity) {
|
|
86
|
+
// Support comma-separated entities if present
|
|
87
|
+
const entityNames = entity.split(',').map((e) => e.trim()).filter(Boolean);
|
|
88
|
+
for (const ent of entityNames) {
|
|
89
|
+
const verbs = a.objects.get(ent) ?? new Set();
|
|
90
|
+
verbs.add(verbGetter(row));
|
|
91
|
+
a.objects.set(ent, verbs);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
81
94
|
}
|
|
82
|
-
}
|
|
95
|
+
};
|
|
96
|
+
// 1. RestApi logs
|
|
97
|
+
processFile(restApiCsv, (r) => r.ENTITY_NAME, (r) => verbOf(r.METHOD ?? r.METHOD_NAME ?? 'GET'), (r) => Number(r.ROWS_PROCESSED) || 0);
|
|
98
|
+
// 2. BulkApi2 logs
|
|
99
|
+
processFile(opts.bulkApi2Csv, (r) => r.ENTITY_NAME, (r) => {
|
|
100
|
+
const op = (r.OPERATION ?? r.OPERATION_TYPE ?? '').toLowerCase();
|
|
101
|
+
if (op === 'delete' || op === 'harddelete' || op === 'hard_delete')
|
|
102
|
+
return 'delete';
|
|
103
|
+
if (op === 'insert' || op === 'update' || op === 'upsert')
|
|
104
|
+
return 'write';
|
|
105
|
+
return 'read';
|
|
106
|
+
}, (r) => Number(r.ROWS_PROCESSED || r.NUMBER_RECORDS_PROCESSED || 0) || 0);
|
|
107
|
+
// 3. GraphQlQueryExecution logs
|
|
108
|
+
processFile(opts.graphQlCsv, (r) => r.ENTITY_NAME || r.TARGET_ENTITY, (r) => {
|
|
109
|
+
const op = (r.OPERATION_TYPE ?? r.OPERATION ?? '').toLowerCase();
|
|
110
|
+
return op.includes('mutation') ? 'write' : 'read';
|
|
111
|
+
}, (r) => Number(r.ROWS_PROCESSED || r.ROW_COUNT || 0) || 0);
|
|
112
|
+
// 4. AuraRequest logs
|
|
113
|
+
processFile(opts.auraCsv, (r) => r.ENTITY_NAME, (r) => verbOf(r.METHOD_NAME ?? r.METHOD ?? 'GET'), (r) => Number(r.ROWS_PROCESSED || 0) || 0);
|
|
83
114
|
const soapUsers = new Set();
|
|
84
|
-
if (soapApiCsv) {
|
|
85
|
-
for (const row of parseCsv(soapApiCsv))
|
|
115
|
+
if (opts.soapApiCsv) {
|
|
116
|
+
for (const row of parseCsv(opts.soapApiCsv))
|
|
86
117
|
if (row.USER_ID)
|
|
87
118
|
soapUsers.add(row.USER_ID);
|
|
88
119
|
}
|
|
@@ -96,9 +127,9 @@ export function collectUsage(restApiCsv, soapApiCsv) {
|
|
|
96
127
|
}));
|
|
97
128
|
return {
|
|
98
129
|
usage: usage.sort((x, y) => y.requests - x.requests),
|
|
99
|
-
totalRows
|
|
130
|
+
totalRows,
|
|
100
131
|
attributedRows: attributed,
|
|
101
|
-
attributionRatePct:
|
|
132
|
+
attributionRatePct: totalRows ? Math.round((100 * attributed) / totalRows) : 0,
|
|
102
133
|
};
|
|
103
134
|
}
|
|
104
135
|
//# sourceMappingURL=usageCollector.js.map
|
|
@@ -39,6 +39,8 @@ export const CAPABILITY_REGISTRY = {
|
|
|
39
39
|
// New checks (Tasks 8–10)
|
|
40
40
|
'guest-executable-apex-unprotected': { grants: ['code-exec', 'data-read-bulk', 'data-write'] },
|
|
41
41
|
'guest-executable-apex-exposed': { grants: ['code-exec'] },
|
|
42
|
+
// Sharing still bounds which records a guest reaches; SYSTEM_MODE lifts only CRUD/FLS on them.
|
|
43
|
+
'guest-executable-apex-system-mode': { grants: ['code-exec', 'data-read'] },
|
|
42
44
|
'cors-wildcard-origin': { grants: ['credential-theft'] },
|
|
43
45
|
'cors-broad-origin': { grants: ['credential-theft'] },
|
|
44
46
|
'escalation-perms-found': { grants: ['priv-esc'] },
|
|
@@ -115,6 +117,7 @@ export const CAPABILITY_REGISTRY = {
|
|
|
115
117
|
'apex-rest-without-sharing': { grants: ['code-exec', 'data-read', 'data-write'] },
|
|
116
118
|
'apex-crud-fls-without-sharing': { grants: ['data-read', 'data-write'] },
|
|
117
119
|
'apex-crud-fls-missing': { grants: ['data-read'] },
|
|
120
|
+
'apex-crud-fls-system-mode': { grants: ['data-read'] },
|
|
118
121
|
// A live session ID posted to an external endpoint. This is a credential leaving the org through
|
|
119
122
|
// a supported feature rather than a flaw, which is exactly why it is easy to leave in place: the
|
|
120
123
|
// receiving endpoint can act as the running user until the session expires.
|
|
@@ -151,6 +154,29 @@ export const CAPABILITY_REGISTRY = {
|
|
|
151
154
|
// so the model stays correct if that ever becomes an either/or, and because a CRITICAL finding
|
|
152
155
|
// silently granting nothing is precisely the failure this registry exists to prevent.
|
|
153
156
|
'connected-app-full-scope-infinite-token': { grants: ['data-read-bulk', 'data-write'] },
|
|
157
|
+
// 14 New Checks capability hooks
|
|
158
|
+
'genai-prompt-template-grounding-flow': { grants: ['data-read'] },
|
|
159
|
+
'genai-prompt-template-grounding-apex': { grants: ['data-read'] },
|
|
160
|
+
'genai-prompt-template-grounding-untrusted': { grants: ['data-read'] },
|
|
161
|
+
'data-cloud-data-space-default-overshared': { grants: ['data-read-bulk'] },
|
|
162
|
+
'data-cloud-data-share-target-unconstrained': { grants: ['data-read-bulk'] },
|
|
163
|
+
'platform-event-subscriber-escalation': { grants: ['priv-esc', 'data-write'] },
|
|
164
|
+
'flow-http-callout-hardcoded-secret': { grants: ['credential-theft', 'external-egress'] },
|
|
165
|
+
'flow-http-callout-uncredentialed-endpoint': { grants: ['external-egress'] },
|
|
166
|
+
'oauth-device-flow-enabled': { grants: ['credential-theft'] },
|
|
167
|
+
'oauth-password-flow-enabled': { grants: ['credential-theft'] },
|
|
168
|
+
'delegated-authentication-admin-assigned': { grants: ['org-takeover'] },
|
|
169
|
+
'delegated-authentication-insecure-gateway': { grants: ['org-takeover'] },
|
|
170
|
+
'delegated-administration-groups-active': { grants: ['priv-esc'] },
|
|
171
|
+
'auth-provider-registration-handler-admin-exec': { grants: ['priv-esc', 'org-takeover'] },
|
|
172
|
+
'auth-provider-registration-handler-unverified-email-linking': { grants: ['priv-esc', 'org-takeover'] },
|
|
173
|
+
'inbound-email-handler-unauthenticated-execution': { grants: ['unauth-foothold', 'code-exec'] },
|
|
174
|
+
'org-wide-email-spoofing-all-profiles': { grants: ['external-egress'] },
|
|
175
|
+
'org-wide-email-spoofing-no-dkim': { grants: ['external-egress'] },
|
|
176
|
+
'external-account-hierarchy-super-users': { grants: ['data-read-bulk'] },
|
|
177
|
+
'external-account-hierarchy-active': { grants: ['data-read-bulk'] },
|
|
178
|
+
'restriction-rules-inactive': { grants: ['data-read-bulk'] },
|
|
179
|
+
'restriction-rules-conflicting': { grants: ['data-read-bulk'] },
|
|
154
180
|
};
|
|
155
181
|
/** Resolve the effective capabilities for a finding (inline overrides registry; passed/inconclusive yield nothing). */
|
|
156
182
|
export function capabilitiesFor(finding) {
|
|
@@ -12,9 +12,16 @@ const SINK_SEVERITY = {
|
|
|
12
12
|
'credential-theft': 'MEDIUM',
|
|
13
13
|
};
|
|
14
14
|
const MAX_STEPS = 4;
|
|
15
|
+
// Population findings reported as passed at a healthy count (RULE-074) still name people who hold
|
|
16
|
+
// the power, so they keep their place in correlation while they list any holder.
|
|
17
|
+
const CHAIN_EVIDENCE_WHEN_PASSED = new Set(['users-modify-all-data', 'users-view-all-data']);
|
|
18
|
+
// Findings that only show a surface exists (a guest user, a live classic site). Every org with a
|
|
19
|
+
// site has them, so they never supply the entry point of a potential path on their own. RULE-071.
|
|
20
|
+
const SURFACE_ONLY = new Set(['guest-user-baseline', 'classic-sites-active']);
|
|
15
21
|
export class ChainEngine {
|
|
16
22
|
correlate(findings) {
|
|
17
|
-
const active = findings.filter((f) => !f.
|
|
23
|
+
const active = findings.filter((f) => !f.inconclusive &&
|
|
24
|
+
(!f.passed || (CHAIN_EVIDENCE_WHEN_PASSED.has(f.id) && (f.affectedItems?.length ?? 0) > 0)));
|
|
18
25
|
// Build present capability set + per-finding grants.
|
|
19
26
|
const present = new Set();
|
|
20
27
|
const grantsByFinding = new Map();
|
|
@@ -98,6 +105,9 @@ export class ChainEngine {
|
|
|
98
105
|
for (const src of SOURCE_CAPS) {
|
|
99
106
|
if (!present.has(src))
|
|
100
107
|
continue;
|
|
108
|
+
const hasRealSource = active.some((f) => !SURFACE_ONLY.has(f.id) && (grantsByFinding.get(f) ?? []).includes(src));
|
|
109
|
+
if (!hasRealSource)
|
|
110
|
+
continue;
|
|
101
111
|
for (const sink of HIGH_IMPACT_SINKS) {
|
|
102
112
|
if (!present.has(sink))
|
|
103
113
|
continue;
|
|
@@ -5,6 +5,33 @@ const byIds = (active, ids) => active.filter((f) => ids.includes(f.id));
|
|
|
5
5
|
// The AI & Agents findings carry dynamic id suffixes (userId, agent dev name, channel slug,
|
|
6
6
|
// domain), so their chain ingredients are matched by id prefix rather than exact id.
|
|
7
7
|
const byPrefixes = (active, prefixes) => active.filter((f) => prefixes.some((p) => f.id === p || f.id.startsWith(p)));
|
|
8
|
+
// Findings that show an unauthenticated visitor can actually read, write or run something. A guest
|
|
9
|
+
// user existing (`guest-user-baseline`) or a site being live (`classic-sites-active`) is a surface,
|
|
10
|
+
// not an exposure: every org with a site has one. RULE-071.
|
|
11
|
+
const GUEST_EXPOSURE = [
|
|
12
|
+
'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure',
|
|
13
|
+
'guest-executable-apex-unprotected', 'guest-executable-apex-exposed', 'guest-executable-apex-system-mode',
|
|
14
|
+
'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
|
|
15
|
+
'guest-api-access-enabled', 'guest-api-hard-delete',
|
|
16
|
+
'guest-user-visibility-view-all-users', 'guest-user-visibility-owd', 'guest-user-visibility-object-read',
|
|
17
|
+
'guest-record-access-policy-not-enforced',
|
|
18
|
+
'inbound-email-handler-unauthenticated-execution',
|
|
19
|
+
];
|
|
20
|
+
// Ways in for a low-trust principal: external users with public sharing, social sign-on,
|
|
21
|
+
// self-registration, or a confirmed guest exposure. RULE-072.
|
|
22
|
+
const LOW_TRUST_ENTRY = [
|
|
23
|
+
'sharing-model-external-read', 'sharing-model-external-write',
|
|
24
|
+
'auth-providers-social', 'experience-cloud-site-self-registration',
|
|
25
|
+
...GUEST_EXPOSURE,
|
|
26
|
+
];
|
|
27
|
+
// Escalations a non-admin can use. Admins holding admin permissions (`users-super-admin-combo`,
|
|
28
|
+
// `users-author-apex`) are not an escalation: they already have the access. RULE-072.
|
|
29
|
+
const NON_ADMIN_ESCALATION = [
|
|
30
|
+
'escalation-perms-found', 'privileged-access-shadow-admins',
|
|
31
|
+
'separation-of-duties-self-escalation', 'separation-of-duties-identity-takeover', 'separation-of-duties-grant-self-data',
|
|
32
|
+
'login-access-policy-delegated-admins',
|
|
33
|
+
'integration-least-privilege-escalation-permissions',
|
|
34
|
+
];
|
|
8
35
|
export const NAMED_CHAINS = [
|
|
9
36
|
{
|
|
10
37
|
id: 'unauth-bulk-exfil',
|
|
@@ -27,9 +54,13 @@ export const NAMED_CHAINS = [
|
|
|
27
54
|
return null;
|
|
28
55
|
if (!hasAny(present, 'code-exec', 'data-read-bulk', 'data-write'))
|
|
29
56
|
return null;
|
|
57
|
+
// A surface and internal weaknesses are not a path: an unauthenticated visitor must be shown
|
|
58
|
+
// to reach something.
|
|
59
|
+
if (byIds(active, GUEST_EXPOSURE).length === 0)
|
|
60
|
+
return null;
|
|
30
61
|
const steps = byIds(active, [
|
|
31
62
|
'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
|
|
32
|
-
'guest-executable-apex-unprotected', 'guest-executable-apex-exposed',
|
|
63
|
+
'guest-executable-apex-unprotected', 'guest-executable-apex-exposed', 'guest-executable-apex-system-mode',
|
|
33
64
|
'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
|
|
34
65
|
'guest-api-access-enabled', 'guest-api-hard-delete', 'classic-sites-active',
|
|
35
66
|
'guest-user-visibility-view-all-users', 'guest-user-visibility-owd', 'guest-user-visibility-object-read',
|
|
@@ -39,8 +70,15 @@ export const NAMED_CHAINS = [
|
|
|
39
70
|
// analogue of portal-exposed Apex running without sharing.
|
|
40
71
|
'guest-record-access-policy-not-enforced',
|
|
41
72
|
'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
|
|
73
|
+
// An open inbound email handler grants unauth-foothold, so it must appear whenever it
|
|
74
|
+
// is what opened the gate.
|
|
75
|
+
'inbound-email-handler-unauthenticated-execution',
|
|
42
76
|
]);
|
|
43
|
-
|
|
77
|
+
if (steps.length < 2)
|
|
78
|
+
return null;
|
|
79
|
+
// Internal-only weaknesses that widen what a foothold reaches. They join as evidence but
|
|
80
|
+
// never count toward the floor: without a guest-side step they describe no unauthenticated path.
|
|
81
|
+
return [...steps, ...byIds(active, ['data-cloud-data-space-default-overshared', 'restriction-rules-inactive'])];
|
|
44
82
|
},
|
|
45
83
|
},
|
|
46
84
|
{
|
|
@@ -78,25 +116,25 @@ export const NAMED_CHAINS = [
|
|
|
78
116
|
narrative: 'A low-trust authenticated user combines with a privilege-escalation permission ' +
|
|
79
117
|
'(assign permission sets, manage users, author apex, modify metadata) to reach full org control.',
|
|
80
118
|
remediation: 'Remove escalation permissions from non-admin profiles/permission sets and review who holds them.',
|
|
81
|
-
match(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
119
|
+
match(_present, active) {
|
|
120
|
+
// Both ends must be present: a way in for a low-trust principal, and an escalation that
|
|
121
|
+
// principal could use. Admin-held power and a guest user merely existing join only as evidence.
|
|
122
|
+
const entry = byIds(active, LOW_TRUST_ENTRY);
|
|
123
|
+
const escalation = byIds(active, NON_ADMIN_ESCALATION);
|
|
124
|
+
if (entry.length === 0 || escalation.length === 0)
|
|
85
125
|
return null;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
]);
|
|
99
|
-
return steps.length >= 2 ? steps : null;
|
|
126
|
+
return [
|
|
127
|
+
...entry,
|
|
128
|
+
...escalation,
|
|
129
|
+
...byIds(active, [
|
|
130
|
+
// Admin powers: they widen what a takeover reaches but are not themselves the escalation.
|
|
131
|
+
'users-super-admin-combo', 'users-author-apex', 'guest-user-baseline', 'login-access-policy-login-as-enabled',
|
|
132
|
+
'separation-of-duties-code-and-data',
|
|
133
|
+
'delegated-administration-groups-active',
|
|
134
|
+
'auth-provider-registration-handler-admin-exec', 'auth-provider-registration-handler-unverified-email-linking',
|
|
135
|
+
'delegated-authentication-admin-assigned', 'platform-event-subscriber-escalation',
|
|
136
|
+
]),
|
|
137
|
+
];
|
|
100
138
|
},
|
|
101
139
|
},
|
|
102
140
|
{
|
|
@@ -113,6 +151,7 @@ export const NAMED_CHAINS = [
|
|
|
113
151
|
'hardcoded-credentials-found', 'custom-labels-credential-value-match', 'custom-labels-credential-name-match',
|
|
114
152
|
'debug-log-active-traces', 'cors-wildcard-origin', 'cors-broad-origin',
|
|
115
153
|
'named-credentials-inventory', 'named-credentials-http-endpoint', 'remote-sites-inventory',
|
|
154
|
+
'flow-http-callout-hardcoded-secret', 'oauth-device-flow-enabled', 'oauth-password-flow-enabled',
|
|
116
155
|
// A user who can stand up connected apps and bypass API access control has provisioned
|
|
117
156
|
// their own egress path.
|
|
118
157
|
'separation-of-duties-external-exfil-channel',
|
|
@@ -194,18 +233,32 @@ export const NAMED_CHAINS = [
|
|
|
194
233
|
title: 'SalesBleed pattern',
|
|
195
234
|
severity: 'HIGH',
|
|
196
235
|
narrative: 'An active agent can run open-ended record queries (the General CRM topic or Query Records action) and ' +
|
|
197
|
-
'the org has
|
|
236
|
+
'the org has a way to send data out: agent actions that do so (Slack, email, external services) without ' +
|
|
237
|
+
'user confirmation, or a CSP Trusted URL whose domain is parked or no longer resolves, which anyone can ' +
|
|
238
|
+
'register and then receive whatever the agent puts in a link or image it returns. ' +
|
|
198
239
|
'That is two of the three ingredients in SalesBleed (Zenity Labs, Sept 2026) and PipeLeak (Capsule ' +
|
|
199
240
|
'Security, Apr 2026); the third, text an outsider wrote, arrives through Web-to-Lead, Web-to-Case, email or ' +
|
|
200
241
|
'chat in almost every org. One injected instruction in a lead can query Accounts and send the result out.',
|
|
201
242
|
remediation: 'Break any one link: remove open-ended querying from agents that read untrusted records, require user ' +
|
|
202
|
-
'confirmation on every outbound action,
|
|
243
|
+
'confirmation on every outbound action, remove CSP Trusted URLs whose domains you no longer control, or ' +
|
|
244
|
+
'keep the agent that queries separate from the agent that sends.',
|
|
203
245
|
match(_present, active) {
|
|
204
246
|
const reach = byPrefixes(active, ['agent-query-reach-']);
|
|
205
|
-
|
|
247
|
+
// Egress: an outbound action that needs no confirmation, or a trusted domain anyone can claim.
|
|
248
|
+
const outbound = [
|
|
249
|
+
...byIds(active, ['agent-outbound-actions-unconfirmed', 'agent-outbound-actions-unverified']),
|
|
250
|
+
...byPrefixes(active, ['trusted-url-hygiene-parked-', 'trusted-url-hygiene-unresolvable-']),
|
|
251
|
+
];
|
|
206
252
|
if (reach.length === 0 || outbound.length === 0)
|
|
207
253
|
return null;
|
|
208
|
-
|
|
254
|
+
// Where outsider text enters, when the org shows it. Evidence only: the chain fires without
|
|
255
|
+
// it, since Web-to-Lead, Web-to-Case and email exist in almost every org.
|
|
256
|
+
const untrusted = byIds(active, [
|
|
257
|
+
'inbound-email-handler-unauthenticated-execution',
|
|
258
|
+
'guest-user-write-access',
|
|
259
|
+
'guest-object-exposure-guest-owned',
|
|
260
|
+
]);
|
|
261
|
+
return [...untrusted, ...reach, ...outbound];
|
|
209
262
|
},
|
|
210
263
|
},
|
|
211
264
|
{
|
|
@@ -402,6 +455,7 @@ export const NAMED_CHAINS = [
|
|
|
402
455
|
'portal-exposed-apex-without-sharing',
|
|
403
456
|
'flows-autolaunched-without-sharing', 'flows-screen-without-sharing',
|
|
404
457
|
'apex-rest-without-sharing',
|
|
458
|
+
'external-account-hierarchy-super-users', 'external-account-hierarchy-active',
|
|
405
459
|
]);
|
|
406
460
|
if (reach.length === 0)
|
|
407
461
|
return null;
|
|
@@ -544,5 +598,57 @@ export const NAMED_CHAINS = [
|
|
|
544
598
|
return [...vector, ...weakened, ...targets];
|
|
545
599
|
},
|
|
546
600
|
},
|
|
601
|
+
{
|
|
602
|
+
id: 'inbound-email-rce',
|
|
603
|
+
title: 'Unauthenticated inbound email to privileged code execution',
|
|
604
|
+
severity: 'CRITICAL',
|
|
605
|
+
narrative: 'An unauthenticated inbound email service address with no sender allowlist and no SPF/DKIM verification ' +
|
|
606
|
+
'accepts messages from any internet sender, executing Apex logic under a privileged running user or in a class ' +
|
|
607
|
+
'that bypasses CRUD/FLS and sharing. Attackers can trigger unattended data manipulation or code execution without credentials.',
|
|
608
|
+
remediation: 'Populate AuthorizedSenders on each email service address, set AuthenticationFailureAction to reject spoofed email, ' +
|
|
609
|
+
'and ensure email handler Apex classes enforce sharing, validate input, and execute as a dedicated least-privilege user.',
|
|
610
|
+
match(present, active) {
|
|
611
|
+
if (!has(present, 'unauth-foothold', 'code-exec'))
|
|
612
|
+
return null;
|
|
613
|
+
const vector = byIds(active, ['inbound-email-handler-unauthenticated-execution']);
|
|
614
|
+
if (vector.length === 0)
|
|
615
|
+
return null;
|
|
616
|
+
const followOn = byIds(active, [
|
|
617
|
+
'apex-crud-fls-without-sharing', 'soql-injection-risk', 'portal-exposed-apex-without-sharing',
|
|
618
|
+
'flows-autolaunched-without-sharing', 'users-modify-all-data', 'users-super-admin-combo',
|
|
619
|
+
'privileged-access-shadow-admins',
|
|
620
|
+
]);
|
|
621
|
+
return followOn.length > 0 ? [...vector, ...followOn] : null;
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
id: 'platform-event-priv-esc',
|
|
626
|
+
title: 'Guest or low-trust platform event publish to automated process escalation',
|
|
627
|
+
severity: 'CRITICAL',
|
|
628
|
+
narrative: 'A guest or portal user publishes a custom Platform Event that triggers an Apex trigger or Flow subscriber ' +
|
|
629
|
+
'executing as the Automated Process system user or an administrator. This bypasses normal user sharing, CRUD, and FLS, ' +
|
|
630
|
+
'providing an unauthenticated or low-trust path to system-context privilege escalation and state tampering.',
|
|
631
|
+
remediation: 'Revoke Create permissions on Platform Events from guest and Experience Cloud profiles. Configure ' +
|
|
632
|
+
'PlatformEventSubscriberConfig to run event triggers as a dedicated least-privilege user rather than Automated Process or an admin.',
|
|
633
|
+
match(present, active) {
|
|
634
|
+
if (!hasAny(present, 'unauth-foothold', 'low-trust-authenticated'))
|
|
635
|
+
return null;
|
|
636
|
+
if (!hasAny(present, 'priv-esc', 'data-write'))
|
|
637
|
+
return null;
|
|
638
|
+
const escalation = byIds(active, ['platform-event-subscriber-escalation']);
|
|
639
|
+
if (escalation.length === 0)
|
|
640
|
+
return null;
|
|
641
|
+
const foothold = byIds(active, [
|
|
642
|
+
'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
|
|
643
|
+
'sharing-model-external-read', 'sharing-model-external-write', 'experience-cloud-site-self-registration',
|
|
644
|
+
]);
|
|
645
|
+
if (foothold.length === 0)
|
|
646
|
+
return null;
|
|
647
|
+
const targets = byIds(active, [
|
|
648
|
+
'users-super-admin-combo', 'users-modify-all-data', 'privileged-access-shadow-admins',
|
|
649
|
+
]);
|
|
650
|
+
return [...foothold, ...escalation, ...targets];
|
|
651
|
+
},
|
|
652
|
+
},
|
|
547
653
|
];
|
|
548
654
|
//# sourceMappingURL=namedChains.js.map
|
|
@@ -2,11 +2,13 @@ import type { SecurityCheck } from './SecurityCheck.js';
|
|
|
2
2
|
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
3
3
|
import type { AuditResult } from '../findings/AuditResult.js';
|
|
4
4
|
import type { ScoringConfig } from '../findings/ScoringConfig.js';
|
|
5
|
+
import type { WaiverLoader } from '../waivers/WaiverLoader.js';
|
|
5
6
|
export declare class CheckEngine {
|
|
6
7
|
private readonly checks;
|
|
7
8
|
private readonly ctx;
|
|
8
9
|
private readonly scoringConfig?;
|
|
9
|
-
|
|
10
|
+
private readonly waiverLoader?;
|
|
11
|
+
constructor(checks: SecurityCheck[], ctx: AuditContext, scoringConfig?: ScoringConfig | undefined, waiverLoader?: WaiverLoader | undefined);
|
|
10
12
|
run(onProgress?: (current: number, total: number, checkName: string) => void): Promise<AuditResult>;
|
|
11
13
|
private validateCacheOrdering;
|
|
12
14
|
}
|
|
@@ -1,50 +1,86 @@
|
|
|
1
1
|
import { buildAuditResult } from '../findings/scoring.js';
|
|
2
2
|
import { getComplianceTags } from '../compliance/resolve.js';
|
|
3
3
|
import { ChainEngine } from '../chains/ChainEngine.js';
|
|
4
|
-
|
|
4
|
+
import { applyWaivers } from '../waivers/applyWaivers.js';
|
|
5
|
+
import { permissionLabelsFor } from '../preflight/permissions.js';
|
|
6
|
+
const ACCESS_ERROR_CODES = new Set([
|
|
5
7
|
'INSUFFICIENT_ACCESS_RIGHTS',
|
|
8
|
+
'INSUFFICIENT_ACCESS_OR_READONLY',
|
|
6
9
|
'INVALID_CROSS_REFERENCE_KEY',
|
|
7
10
|
'ENTITY_IS_INACCESSIBLE',
|
|
8
|
-
'INVALID_FIELD',
|
|
9
|
-
'INVALID_TYPE',
|
|
10
11
|
]);
|
|
11
|
-
|
|
12
|
+
const REJECTION_ERROR_CODES = new Set(['INVALID_FIELD', 'INVALID_TYPE', 'MALFORMED_QUERY']);
|
|
13
|
+
const PERMISSIONS_DOC = 'https://github.com/cclabsnz/sf-audit-plugin/blob/main/PERMISSIONS.md';
|
|
14
|
+
/**
|
|
15
|
+
* Why a check threw. A query the org rejects (unknown field or object, an unfilterable field,
|
|
16
|
+
* bad syntax) is not an access problem, even though a field hidden by field-level security is
|
|
17
|
+
* also reported as an unknown column: telling an admin to grant access sends them the wrong way.
|
|
18
|
+
*/
|
|
19
|
+
function classifyError(err) {
|
|
12
20
|
if (!(err instanceof Error))
|
|
13
|
-
return
|
|
21
|
+
return 'failed';
|
|
14
22
|
const code = err.errorCode ?? '';
|
|
15
23
|
const msg = err.message ?? '';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
if (ACCESS_ERROR_CODES.has(code) || /INSUFFICIENT_ACCESS|insufficient access|entity type cannot be queried/i.test(msg)) {
|
|
25
|
+
return 'access';
|
|
26
|
+
}
|
|
27
|
+
if (REJECTION_ERROR_CODES.has(code) ||
|
|
28
|
+
/INVALID_FIELD|INVALID_TYPE|MALFORMED_QUERY|No such column|is not supported|can not be filtered|alias is reserved/i.test(msg)) {
|
|
29
|
+
return 'rejected';
|
|
30
|
+
}
|
|
31
|
+
return 'failed';
|
|
32
|
+
}
|
|
33
|
+
function accessRemediation(check) {
|
|
34
|
+
const labels = permissionLabelsFor(check);
|
|
35
|
+
const named = labels.length > 0 ? `This check needs ${labels.join(' and ')}. ` : '';
|
|
36
|
+
return (`${named}Run \`sf audit preflight\` to see which permissions the audit user is missing, and ` +
|
|
37
|
+
`assign the read-only permission set described in PERMISSIONS.md (${PERMISSIONS_DOC}), then re-run the audit.`);
|
|
21
38
|
}
|
|
22
39
|
function buildErrorFinding(check, err) {
|
|
23
40
|
const msg = err instanceof Error ? err.message : String(err);
|
|
24
|
-
const
|
|
41
|
+
const kind = classifyError(err);
|
|
42
|
+
const base = { id: `${check.id}-error`, checkId: check.id, category: check.category, riskLevel: 'INFO' };
|
|
43
|
+
// A check that threw gathered no evidence, whatever the cause.
|
|
44
|
+
if (kind === 'access') {
|
|
45
|
+
return {
|
|
46
|
+
...base,
|
|
47
|
+
title: `${check.name}: insufficient permissions`,
|
|
48
|
+
detail: `This check could not gather evidence because the org denied the audit user access: ${msg}`,
|
|
49
|
+
remediation: accessRemediation(check),
|
|
50
|
+
inconclusive: true,
|
|
51
|
+
notAssessed: true,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (kind === 'rejected') {
|
|
55
|
+
return {
|
|
56
|
+
...base,
|
|
57
|
+
title: `${check.name}: query rejected by the org`,
|
|
58
|
+
detail: `The org rejected this check's query, so it gathered no evidence. Salesforce said: ${msg}. ` +
|
|
59
|
+
'The object or field may not exist in this edition or API version, or field-level security may hide it from the audit user.',
|
|
60
|
+
remediation: 'If the audit user is a System Administrator, this is a defect in the check: please report it at ' +
|
|
61
|
+
'https://github.com/cclabsnz/sf-audit-plugin/issues with the error above. The area this check covers is unassessed, not clean.',
|
|
62
|
+
inconclusive: true,
|
|
63
|
+
notAssessed: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
25
66
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
detail: inconclusive
|
|
32
|
-
? `This check could not gather evidence because the running user lacks the required permissions: ${msg}`
|
|
33
|
-
: `This check encountered an error and could not complete: ${msg}`,
|
|
34
|
-
remediation: inconclusive
|
|
35
|
-
? 'Grant the audit user the permissions listed in the tool documentation, then re-run the audit.'
|
|
36
|
-
: 'Review the error message and verify the running user has the required permissions.',
|
|
37
|
-
inconclusive: inconclusive || undefined,
|
|
67
|
+
...base,
|
|
68
|
+
title: `${check.name}: check failed`,
|
|
69
|
+
detail: `This check encountered an error and could not complete: ${msg}`,
|
|
70
|
+
remediation: 'Review the error message and re-run the audit. The area this check covers is unassessed, not clean.',
|
|
71
|
+
notAssessed: true,
|
|
38
72
|
};
|
|
39
73
|
}
|
|
40
74
|
export class CheckEngine {
|
|
41
75
|
checks;
|
|
42
76
|
ctx;
|
|
43
77
|
scoringConfig;
|
|
44
|
-
|
|
78
|
+
waiverLoader;
|
|
79
|
+
constructor(checks, ctx, scoringConfig, waiverLoader) {
|
|
45
80
|
this.checks = checks;
|
|
46
81
|
this.ctx = ctx;
|
|
47
82
|
this.scoringConfig = scoringConfig;
|
|
83
|
+
this.waiverLoader = waiverLoader;
|
|
48
84
|
this.validateCacheOrdering();
|
|
49
85
|
}
|
|
50
86
|
async run(onProgress) {
|
|
@@ -66,8 +102,11 @@ export class CheckEngine {
|
|
|
66
102
|
findings.push(buildErrorFinding(check, err));
|
|
67
103
|
}
|
|
68
104
|
}
|
|
69
|
-
|
|
70
|
-
|
|
105
|
+
// Waivers apply before correlation but do not remove findings from it: an accepted weakness
|
|
106
|
+
// still forms attack paths with the others.
|
|
107
|
+
const finalFindings = this.waiverLoader ? applyWaivers(findings, this.waiverLoader).findings : findings;
|
|
108
|
+
const attackChains = new ChainEngine().correlate(finalFindings);
|
|
109
|
+
return buildAuditResult(this.ctx, finalFindings, metrics, this.scoringConfig, attackChains);
|
|
71
110
|
}
|
|
72
111
|
validateCacheOrdering() {
|
|
73
112
|
const populated = new Set();
|
|
@@ -188,12 +188,13 @@ export class AgentUserPrivilegeCheck {
|
|
|
188
188
|
return new Set();
|
|
189
189
|
const objList = readableObjects.map((o) => `'${o}'`).join(', ');
|
|
190
190
|
try {
|
|
191
|
-
|
|
191
|
+
// FieldDefinition supports no aggregates (its Id is not aggregatable): list the classified
|
|
192
|
+
// fields and take their objects.
|
|
193
|
+
const rows = await ctx.tooling.query(`SELECT EntityDefinition.QualifiedApiName, QualifiedApiName
|
|
192
194
|
FROM FieldDefinition
|
|
193
195
|
WHERE EntityDefinition.QualifiedApiName IN (${objList})
|
|
194
|
-
AND ComplianceGroup != null
|
|
195
|
-
|
|
196
|
-
return new Set(rows.filter((r) => (r.classifiedCount ?? 0) > 0).map((r) => r.objectName));
|
|
196
|
+
AND ComplianceGroup != null`);
|
|
197
|
+
return new Set(rows.map((r) => r.EntityDefinition?.QualifiedApiName).filter((o) => Boolean(o)));
|
|
197
198
|
}
|
|
198
199
|
catch {
|
|
199
200
|
// No classification feature / no Tooling access: skip the sub-signal silently.
|