@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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags guest (unauthenticated) users whose profile/permission-sets grant API or
|
|
3
|
+
* Bulk API access. The other guest checks cover the UI-API/GraphQL vector; this
|
|
4
|
+
* covers the *programmatic* one: a guest with "API Enabled" can drive the REST/SOAP/
|
|
5
|
+
* Bulk API directly, turning any readable object into a scriptable bulk pull, and
|
|
6
|
+
* "Bulk API Hard Delete" additionally lets an anonymous caller permanently destroy
|
|
7
|
+
* records (bypassing the recycle bin).
|
|
8
|
+
*/
|
|
9
|
+
export class GuestApiAccessCheck {
|
|
10
|
+
id = 'guest-api-access';
|
|
11
|
+
name = 'Guest API & Bulk Access';
|
|
12
|
+
category = 'Access Control';
|
|
13
|
+
description = 'Flags guest users granted API Enabled or Bulk API Hard Delete — programmatic bulk read/delete access for unauthenticated visitors';
|
|
14
|
+
async run(ctx) {
|
|
15
|
+
const findings = [];
|
|
16
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
17
|
+
let guests;
|
|
18
|
+
try {
|
|
19
|
+
guests = await ctx.soql.queryAll("SELECT Id, Username FROM User WHERE UserType = 'Guest' AND IsActive = true");
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
findings.push(this.inconclusive('Guest users could not be queried'));
|
|
23
|
+
return { findings };
|
|
24
|
+
}
|
|
25
|
+
if (guests.length === 0) {
|
|
26
|
+
findings.push({
|
|
27
|
+
id: 'guest-api-access-none',
|
|
28
|
+
category: this.category,
|
|
29
|
+
riskLevel: 'LOW',
|
|
30
|
+
passed: true,
|
|
31
|
+
title: 'No active guest users',
|
|
32
|
+
detail: 'There are no active guest users, so there is no guest API surface.',
|
|
33
|
+
remediation: 'If a public site is added later, keep API Enabled and Bulk API permissions off the guest profile.',
|
|
34
|
+
});
|
|
35
|
+
return { findings };
|
|
36
|
+
}
|
|
37
|
+
const inIds = guests.map((g) => `'${g.Id}'`).join(', ');
|
|
38
|
+
let psa;
|
|
39
|
+
try {
|
|
40
|
+
psa = await ctx.soql.queryAll(`SELECT AssigneeId, PermissionSet.Label, PermissionSet.PermissionsApiEnabled, PermissionSet.PermissionsBulkApiHardDelete
|
|
41
|
+
FROM PermissionSetAssignment WHERE AssigneeId IN (${inIds})`);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
findings.push(this.inconclusive('Guest permission sets could not be queried'));
|
|
45
|
+
return { findings };
|
|
46
|
+
}
|
|
47
|
+
const guestById = new Map(guests.map((g) => [g.Id, g]));
|
|
48
|
+
const apiGuests = new Map(); // guestId -> permset labels granting API
|
|
49
|
+
const hardDeleteGuests = new Map();
|
|
50
|
+
for (const a of psa) {
|
|
51
|
+
if (!a.PermissionSet)
|
|
52
|
+
continue;
|
|
53
|
+
if (a.PermissionSet.PermissionsApiEnabled) {
|
|
54
|
+
(apiGuests.get(a.AssigneeId) ?? apiGuests.set(a.AssigneeId, new Set()).get(a.AssigneeId)).add(a.PermissionSet.Label);
|
|
55
|
+
}
|
|
56
|
+
if (a.PermissionSet.PermissionsBulkApiHardDelete) {
|
|
57
|
+
(hardDeleteGuests.get(a.AssigneeId) ?? hardDeleteGuests.set(a.AssigneeId, new Set()).get(a.AssigneeId)).add(a.PermissionSet.Label);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (apiGuests.size > 0) {
|
|
61
|
+
findings.push({
|
|
62
|
+
id: 'guest-api-access-enabled',
|
|
63
|
+
category: this.category,
|
|
64
|
+
riskLevel: 'HIGH',
|
|
65
|
+
title: `${apiGuests.size} guest user(s) have API access enabled`,
|
|
66
|
+
detail: '"API Enabled" on a guest user lets an unauthenticated caller drive the REST/SOAP/Bulk API directly, not just the site UI. Every object the guest can read becomes a scriptable bulk-extraction target, and this bypasses UI-only assumptions about what guests can reach.',
|
|
67
|
+
remediation: 'Remove "API Enabled" from the guest profile and any permission set assigned to the guest user. Guests should interact only through the site\'s Apex/LWC, never the raw API.',
|
|
68
|
+
affectedItems: [...apiGuests.entries()].slice(0, 30).map(([id, sets]) => ({
|
|
69
|
+
label: `${guestById.get(id)?.Username ?? id} — via ${[...sets].join(', ')}`,
|
|
70
|
+
url: `${baseUrl}/lightning/setup/PermSets/home`,
|
|
71
|
+
})),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (hardDeleteGuests.size > 0) {
|
|
75
|
+
findings.push({
|
|
76
|
+
id: 'guest-api-hard-delete',
|
|
77
|
+
category: this.category,
|
|
78
|
+
riskLevel: 'CRITICAL',
|
|
79
|
+
title: `${hardDeleteGuests.size} guest user(s) have Bulk API Hard Delete`,
|
|
80
|
+
detail: '"Bulk API Hard Delete" lets the holder permanently delete records, skipping the recycle bin. On a guest user this hands an unauthenticated visitor an irreversible destructive capability.',
|
|
81
|
+
remediation: 'Immediately remove "Bulk API Hard Delete" from all guest profiles/permission sets.',
|
|
82
|
+
affectedItems: [...hardDeleteGuests.entries()].slice(0, 30).map(([id, sets]) => ({
|
|
83
|
+
label: `${guestById.get(id)?.Username ?? id} — via ${[...sets].join(', ')}`,
|
|
84
|
+
url: `${baseUrl}/lightning/setup/PermSets/home`,
|
|
85
|
+
})),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (findings.length === 0) {
|
|
89
|
+
findings.push({
|
|
90
|
+
id: 'guest-api-access-ok',
|
|
91
|
+
category: this.category,
|
|
92
|
+
riskLevel: 'LOW',
|
|
93
|
+
passed: true,
|
|
94
|
+
title: `${guests.length} guest user(s); no API or Bulk API access`,
|
|
95
|
+
detail: 'No active guest user has "API Enabled" or "Bulk API Hard Delete", so guests cannot drive the raw API.',
|
|
96
|
+
remediation: 'Keep API and Bulk permissions off guest profiles as sites change.',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return { findings };
|
|
100
|
+
}
|
|
101
|
+
inconclusive(what) {
|
|
102
|
+
return {
|
|
103
|
+
id: 'guest-api-access-inconclusive',
|
|
104
|
+
category: this.category,
|
|
105
|
+
riskLevel: 'INFO',
|
|
106
|
+
inconclusive: true,
|
|
107
|
+
title: `${what} (insufficient access)`,
|
|
108
|
+
detail: 'The audit user could not gather the data needed to evaluate guest API access.',
|
|
109
|
+
remediation: 'Grant the audit user View Setup and Configuration and re-run.',
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=GuestApiAccessCheck.js.map
|
|
@@ -4,7 +4,7 @@ export declare class GuestExecutableApexCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "guest-executable-apex";
|
|
5
5
|
readonly name = "Guest-Executable Apex";
|
|
6
6
|
readonly category = "Access Control";
|
|
7
|
-
readonly description = "Finds Apex classes that unauthenticated guest profiles can execute, flagging those that run without sharing
|
|
7
|
+
readonly description = "Finds Apex classes that unauthenticated guest profiles can execute, flagging those that run without sharing: the classic unauthenticated data-exfiltration vector";
|
|
8
8
|
readonly dependsOnCache: readonly ["apexBodies"];
|
|
9
9
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ export class GuestExecutableApexCheck {
|
|
|
4
4
|
id = 'guest-executable-apex';
|
|
5
5
|
name = 'Guest-Executable Apex';
|
|
6
6
|
category = 'Access Control';
|
|
7
|
-
description = 'Finds Apex classes that unauthenticated guest profiles can execute, flagging those that run without sharing
|
|
7
|
+
description = 'Finds Apex classes that unauthenticated guest profiles can execute, flagging those that run without sharing: the classic unauthenticated data-exfiltration vector';
|
|
8
8
|
// Use cached Apex bodies (from HardcodedCredentialsCheck) when available to classify sharing.
|
|
9
9
|
dependsOnCache = ['apexBodies'];
|
|
10
10
|
async run(ctx) {
|
|
@@ -17,7 +17,7 @@ export class GuestExecutableApexCheck {
|
|
|
17
17
|
category: this.category,
|
|
18
18
|
riskLevel: 'LOW',
|
|
19
19
|
passed: true,
|
|
20
|
-
title: 'No active guest users
|
|
20
|
+
title: 'No active guest users: guest-executable Apex not a concern',
|
|
21
21
|
detail: 'There are no active guest users, so no Apex class is reachable by unauthenticated visitors.',
|
|
22
22
|
remediation: 'If an Experience Cloud/Sites guest user is added later, re-run this audit.',
|
|
23
23
|
});
|
|
@@ -70,9 +70,9 @@ export class GuestExecutableApexCheck {
|
|
|
70
70
|
title: `${unprotected.length} guest-executable Apex class(es) run without "with sharing"`,
|
|
71
71
|
detail: 'These Apex classes can be invoked by unauthenticated guest users AND do not enforce record-level sharing. ' +
|
|
72
72
|
'This is the classic Salesforce guest-user exploit chain: an attacker calls the class and reads or writes ' +
|
|
73
|
-
'business data in bulk with no login. Object-level guest permissions do not mitigate this
|
|
73
|
+
'business data in bulk with no login. Object-level guest permissions do not mitigate this: the class runs in system context.',
|
|
74
74
|
remediation: 'Add "with sharing" to every guest-reachable Apex class, enforce CRUD/FLS, and remove guest execution access from any class that does not strictly need it.',
|
|
75
|
-
affectedItems: unprotected.map((n) => ({ label: n, url: apexUrl, note: 'Guest-executable + without/with-no sharing
|
|
75
|
+
affectedItems: unprotected.map((n) => ({ label: n, url: apexUrl, note: 'Guest-executable + without/with-no sharing: fix immediately' })),
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
if (exposed.length > 0) {
|
|
@@ -84,7 +84,7 @@ export class GuestExecutableApexCheck {
|
|
|
84
84
|
detail: 'Guest user profiles can execute these Apex classes. Even with "with sharing", any guest-reachable Apex is ' +
|
|
85
85
|
'unauthenticated attack surface and must enforce CRUD/FLS and validate all input.',
|
|
86
86
|
remediation: 'Review each class for least-privilege: confirm "with sharing", CRUD/FLS checks, and input validation. Remove guest access where unnecessary.',
|
|
87
|
-
affectedItems: exposed.map((n) => ({ label: n, url: apexUrl, note: 'Guest-executable
|
|
87
|
+
affectedItems: exposed.map((n) => ({ label: n, url: apexUrl, note: 'Guest-executable: review for least privilege' })),
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
return { findings };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Detects every object an unauthenticated guest can READ IN BULK. Unlike
|
|
5
|
+
* GuestUserAccessCheck (a fixed list of standard objects + sharing rules), this
|
|
6
|
+
* auto-discovers ALL objects the guest profile/permission-sets can read, then
|
|
7
|
+
* decides whether records are actually reachable:
|
|
8
|
+
* - public external OWD (Read/ReadWrite) => every record is readable, OR
|
|
9
|
+
* - Private OWD but the guest OWNS records (public-form submissions) => those
|
|
10
|
+
* records are still readable, because an owner can always read its own records.
|
|
11
|
+
*
|
|
12
|
+
* Sharing-model readability is necessary but not sufficient: the Experience Cloud
|
|
13
|
+
* UI API (GraphQL) can only return objects it MODELS. Objects like Calendar,
|
|
14
|
+
* AuthSession, or OauthToken can be readable in the sharing model yet fail the UI
|
|
15
|
+
* API `object-info` endpoint, so they are NOT reachable through the guest GraphQL
|
|
16
|
+
* vector. This check therefore probes `object-info` per exposed object and grades:
|
|
17
|
+
* - Tier 1 (CRITICAL): sharing-readable AND UI-API-modeled => actually pullable.
|
|
18
|
+
* - Tier 2 (MEDIUM): sharing-readable but NOT UI-API-modeled => defense-in-depth
|
|
19
|
+
* only (remove the grant, but it is not the bulk-exfiltration vector).
|
|
20
|
+
* Where a live record exists, UserRecordAccess is queried as ground-truth read
|
|
21
|
+
* confirmation and surfaced in the finding evidence.
|
|
22
|
+
*/
|
|
23
|
+
export declare class GuestObjectExposureCheck implements SecurityCheck {
|
|
24
|
+
readonly id = "guest-object-exposure";
|
|
25
|
+
readonly name = "Guest Object Exposure (Bulk Read via UI API)";
|
|
26
|
+
readonly category = "Access Control";
|
|
27
|
+
readonly description = "Auto-discovers every object an unauthenticated guest can read in bulk via the UI API (GraphQL), including records exposed by guest ownership despite a Private org-wide default";
|
|
28
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Probes the UI API `object-info` endpoint. Returns true if the object is
|
|
31
|
+
* modelled (reachable via executeGraphQL), false if the endpoint reports it is
|
|
32
|
+
* not modelled, or null if the probe could not be performed at all.
|
|
33
|
+
*/
|
|
34
|
+
private isUiApiModeled;
|
|
35
|
+
/**
|
|
36
|
+
* Ground-truth read confirmation via UserRecordAccess for a single sample
|
|
37
|
+
* record. Returns null when there is no record to test or the probe fails.
|
|
38
|
+
*/
|
|
39
|
+
private confirmGuestRead;
|
|
40
|
+
private evidenceNote;
|
|
41
|
+
private ok;
|
|
42
|
+
private inconclusive;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=GuestObjectExposureCheck.d.ts.map
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// External sharing models that expose ALL records of an object to external (guest) users.
|
|
2
|
+
const PUBLIC_OWD = new Set(['Read', 'ReadWrite', 'ReadSelect']);
|
|
3
|
+
/**
|
|
4
|
+
* Detects every object an unauthenticated guest can READ IN BULK. Unlike
|
|
5
|
+
* GuestUserAccessCheck (a fixed list of standard objects + sharing rules), this
|
|
6
|
+
* auto-discovers ALL objects the guest profile/permission-sets can read, then
|
|
7
|
+
* decides whether records are actually reachable:
|
|
8
|
+
* - public external OWD (Read/ReadWrite) => every record is readable, OR
|
|
9
|
+
* - Private OWD but the guest OWNS records (public-form submissions) => those
|
|
10
|
+
* records are still readable, because an owner can always read its own records.
|
|
11
|
+
*
|
|
12
|
+
* Sharing-model readability is necessary but not sufficient: the Experience Cloud
|
|
13
|
+
* UI API (GraphQL) can only return objects it MODELS. Objects like Calendar,
|
|
14
|
+
* AuthSession, or OauthToken can be readable in the sharing model yet fail the UI
|
|
15
|
+
* API `object-info` endpoint, so they are NOT reachable through the guest GraphQL
|
|
16
|
+
* vector. This check therefore probes `object-info` per exposed object and grades:
|
|
17
|
+
* - Tier 1 (CRITICAL): sharing-readable AND UI-API-modeled => actually pullable.
|
|
18
|
+
* - Tier 2 (MEDIUM): sharing-readable but NOT UI-API-modeled => defense-in-depth
|
|
19
|
+
* only (remove the grant, but it is not the bulk-exfiltration vector).
|
|
20
|
+
* Where a live record exists, UserRecordAccess is queried as ground-truth read
|
|
21
|
+
* confirmation and surfaced in the finding evidence.
|
|
22
|
+
*/
|
|
23
|
+
export class GuestObjectExposureCheck {
|
|
24
|
+
id = 'guest-object-exposure';
|
|
25
|
+
name = 'Guest Object Exposure (Bulk Read via UI API)';
|
|
26
|
+
category = 'Access Control';
|
|
27
|
+
description = 'Auto-discovers every object an unauthenticated guest can read in bulk via the UI API (GraphQL), including records exposed by guest ownership despite a Private org-wide default';
|
|
28
|
+
async run(ctx) {
|
|
29
|
+
const findings = [];
|
|
30
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
31
|
+
let guests;
|
|
32
|
+
try {
|
|
33
|
+
guests = await ctx.soql.queryAll("SELECT Id, ProfileId, Username FROM User WHERE UserType = 'Guest' AND IsActive = true");
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
findings.push(this.inconclusive('guest-object-exposure-inaccessible', 'Guest users could not be queried'));
|
|
37
|
+
return { findings };
|
|
38
|
+
}
|
|
39
|
+
if (guests.length === 0) {
|
|
40
|
+
findings.push({
|
|
41
|
+
id: 'guest-object-exposure-none',
|
|
42
|
+
category: this.category,
|
|
43
|
+
riskLevel: 'LOW',
|
|
44
|
+
passed: true,
|
|
45
|
+
title: 'No active guest users',
|
|
46
|
+
detail: 'There are no active guest users, so no unauthenticated UI-API bulk-read surface exists.',
|
|
47
|
+
remediation: 'If an Experience Cloud or Sites site is added later, re-run this check.',
|
|
48
|
+
});
|
|
49
|
+
return { findings };
|
|
50
|
+
}
|
|
51
|
+
const guestIds = guests.map((g) => g.Id);
|
|
52
|
+
const inIds = guestIds.map((i) => `'${i}'`).join(', ');
|
|
53
|
+
// Permission sets (profile-owned + assigned) that grant the guests their access.
|
|
54
|
+
let permSetIds;
|
|
55
|
+
try {
|
|
56
|
+
const psa = await ctx.soql.queryAll(`SELECT AssigneeId, PermissionSetId FROM PermissionSetAssignment WHERE AssigneeId IN (${inIds})`);
|
|
57
|
+
permSetIds = [...new Set(psa.map((p) => p.PermissionSetId))];
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
findings.push(this.inconclusive('guest-object-exposure-perms-inaccessible', 'Guest permission sets could not be queried'));
|
|
61
|
+
return { findings };
|
|
62
|
+
}
|
|
63
|
+
if (permSetIds.length === 0) {
|
|
64
|
+
findings.push(this.ok(guests.length, 0));
|
|
65
|
+
return { findings };
|
|
66
|
+
}
|
|
67
|
+
// Every object the guest can read — auto-discovered, not a fixed list.
|
|
68
|
+
const psIn = permSetIds.map((i) => `'${i}'`).join(', ');
|
|
69
|
+
let perms;
|
|
70
|
+
try {
|
|
71
|
+
perms = await ctx.soql.queryAll(`SELECT ParentId, SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit, PermissionsDelete
|
|
72
|
+
FROM ObjectPermissions WHERE ParentId IN (${psIn}) AND PermissionsRead = true`);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
findings.push(this.inconclusive('guest-object-exposure-objperms-inaccessible', 'Guest object permissions could not be queried'));
|
|
76
|
+
return { findings };
|
|
77
|
+
}
|
|
78
|
+
const writable = new Set(perms.filter((p) => p.PermissionsCreate || p.PermissionsEdit || p.PermissionsDelete).map((p) => p.SobjectType));
|
|
79
|
+
const readable = [...new Set(perms.map((p) => p.SobjectType))];
|
|
80
|
+
if (readable.length === 0) {
|
|
81
|
+
findings.push(this.ok(guests.length, 0));
|
|
82
|
+
return { findings };
|
|
83
|
+
}
|
|
84
|
+
// External OWD for each readable object.
|
|
85
|
+
const owd = new Map();
|
|
86
|
+
try {
|
|
87
|
+
const objList = readable.map((o) => `'${o}'`).join(', ');
|
|
88
|
+
const defs = await ctx.soql.queryAll(`SELECT QualifiedApiName, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName IN (${objList})`);
|
|
89
|
+
for (const d of defs)
|
|
90
|
+
owd.set(d.QualifiedApiName, d.ExternalSharingModel ?? 'Unknown');
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Proceed without OWD: objects fall through to the ownership check below.
|
|
94
|
+
}
|
|
95
|
+
const exposed = [];
|
|
96
|
+
for (const obj of readable) {
|
|
97
|
+
const model = owd.get(obj) ?? 'Unknown';
|
|
98
|
+
if (PUBLIC_OWD.has(model)) {
|
|
99
|
+
exposed.push({ obj, owd: model, write: writable.has(obj), kind: 'public', uiApi: null, confirmed: null });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
// Private or Unknown OWD: records are still exposed if the guest OWNS them.
|
|
103
|
+
try {
|
|
104
|
+
const r = await ctx.soql.query(`SELECT COUNT() FROM ${obj} WHERE OwnerId IN (${inIds})`);
|
|
105
|
+
if (r.totalSize > 0)
|
|
106
|
+
exposed.push({ obj, count: r.totalSize, write: writable.has(obj), kind: 'owned', uiApi: null, confirmed: null });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// Object has no OwnerId / does not support COUNT — not an ownership-bypass surface.
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Grade each sharing-readable object by ACTUAL UI-API reachability + ground-truth read.
|
|
113
|
+
for (const e of exposed) {
|
|
114
|
+
e.uiApi = await this.isUiApiModeled(ctx, e.obj);
|
|
115
|
+
e.confirmed = await this.confirmGuestRead(ctx, e.obj, guestIds[0]);
|
|
116
|
+
}
|
|
117
|
+
// uiApi === false is the ONLY signal that de-escalates (object-info explicitly said
|
|
118
|
+
// "not modeled"). true and null (couldn't probe) both stay in the reachable tier.
|
|
119
|
+
const reachablePublic = exposed.filter((e) => e.kind === 'public' && e.uiApi !== false);
|
|
120
|
+
const reachableOwned = exposed.filter((e) => e.kind === 'owned' && e.uiApi !== false);
|
|
121
|
+
const sharingOnly = exposed.filter((e) => e.uiApi === false);
|
|
122
|
+
const uiApiNote = 'Reachable unauthenticated via the Experience Cloud UI API (GraphQL) through aura://RecordUiController/ACTION$executeGraphQL on /s/sfsites/aura (aura.token=null).';
|
|
123
|
+
if (reachablePublic.length > 0) {
|
|
124
|
+
findings.push({
|
|
125
|
+
id: 'guest-object-exposure-public-owd',
|
|
126
|
+
category: this.category,
|
|
127
|
+
riskLevel: 'CRITICAL',
|
|
128
|
+
title: `${reachablePublic.length} object(s) fully readable by unauthenticated guests (public external OWD)`,
|
|
129
|
+
detail: 'These objects have an external org-wide default of Read or ReadWrite, are readable by the guest profile, and are modelled by the UI API, so every record is reachable by any unauthenticated visitor who can enumerate counts and page through records in bulk. ' +
|
|
130
|
+
uiApiNote,
|
|
131
|
+
remediation: 'Set external OWD to Private for these objects, and remove Read from the guest profile/permission sets unless a specific public dataset is intended. Then verify no guest-accessible Apex returns the data.',
|
|
132
|
+
affectedItems: reachablePublic.map((e) => ({
|
|
133
|
+
label: `${e.obj} (external OWD: ${e.owd}${e.write ? ', guest WRITE too' : ''})`,
|
|
134
|
+
url: `${baseUrl}/lightning/setup/SecuritySharing/page`,
|
|
135
|
+
note: this.evidenceNote(e),
|
|
136
|
+
})),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (reachableOwned.length > 0) {
|
|
140
|
+
findings.push({
|
|
141
|
+
id: 'guest-object-exposure-guest-owned',
|
|
142
|
+
category: this.category,
|
|
143
|
+
riskLevel: 'CRITICAL',
|
|
144
|
+
title: `${reachableOwned.length} object(s) expose guest-owned records despite a Private OWD`,
|
|
145
|
+
detail: 'These objects have a Private external OWD, but the guest user OWNS records in them (typically public-form submissions created as the guest user). An owner can always read its own records, so Private OWD does not protect them, and the UI API models the object, so all guest-owned records are readable unauthenticated in bulk. ' +
|
|
146
|
+
uiApiNote,
|
|
147
|
+
remediation: 'Reparent guest-created records to a default or integration owner (enable "Assign records created by guest users to the default owner" and "Secure guest user record access"), and remove Read on these objects from the guest profile.',
|
|
148
|
+
affectedItems: reachableOwned.map((e) => ({
|
|
149
|
+
label: `${e.obj}: ${e.count} guest-owned record(s)${e.write ? ' (guest WRITE too)' : ''}`,
|
|
150
|
+
url: `${baseUrl}/${e.obj}`,
|
|
151
|
+
note: this.evidenceNote(e),
|
|
152
|
+
})),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (sharingOnly.length > 0) {
|
|
156
|
+
findings.push({
|
|
157
|
+
id: 'guest-object-exposure-sharing-only',
|
|
158
|
+
category: this.category,
|
|
159
|
+
riskLevel: 'MEDIUM',
|
|
160
|
+
title: `${sharingOnly.length} object(s) readable in the sharing model but NOT reachable via the UI API`,
|
|
161
|
+
detail: 'The guest can read these objects in the sharing model (object permission + public OWD or guest ownership), but the UI API `object-info` endpoint does not model them, so they are NOT pullable through the guest GraphQL vector (this is the tier that Calendar, AuthSession, OauthToken and similar system objects fall into). This is a defense-in-depth grant to tighten, not an active bulk-exfiltration surface.',
|
|
162
|
+
remediation: 'Remove Read from the guest profile/permission sets for these objects unless specifically required. Because they are not UI-API-modelled they are lower priority than the CRITICAL findings, but a stripped guest profile should not hold these grants at all.',
|
|
163
|
+
affectedItems: sharingOnly.map((e) => ({
|
|
164
|
+
label: `${e.obj} (${e.kind === 'public' ? `external OWD: ${e.owd}` : `${e.count} guest-owned`}${e.write ? ', guest WRITE too' : ''})`,
|
|
165
|
+
url: `${baseUrl}/lightning/setup/SecuritySharing/page`,
|
|
166
|
+
note: 'Sharing-readable; UI API object-info = not modelled (not GraphQL-reachable)',
|
|
167
|
+
})),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (exposed.length === 0) {
|
|
171
|
+
findings.push(this.ok(guests.length, readable.length));
|
|
172
|
+
}
|
|
173
|
+
return { findings };
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Probes the UI API `object-info` endpoint. Returns true if the object is
|
|
177
|
+
* modelled (reachable via executeGraphQL), false if the endpoint reports it is
|
|
178
|
+
* not modelled, or null if the probe could not be performed at all.
|
|
179
|
+
*/
|
|
180
|
+
async isUiApiModeled(ctx, obj) {
|
|
181
|
+
if (typeof ctx.rest?.get !== 'function')
|
|
182
|
+
return null;
|
|
183
|
+
try {
|
|
184
|
+
await ctx.rest.get(`/ui-api/object-info/${obj}`);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
// 404 / UNSUPPORTED_OBJECT => the UI API does not model this object.
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Ground-truth read confirmation via UserRecordAccess for a single sample
|
|
194
|
+
* record. Returns null when there is no record to test or the probe fails.
|
|
195
|
+
*/
|
|
196
|
+
async confirmGuestRead(ctx, obj, guestId) {
|
|
197
|
+
try {
|
|
198
|
+
const sample = await ctx.soql.query(`SELECT Id FROM ${obj} LIMIT 1`);
|
|
199
|
+
const recId = sample.records?.[0]?.Id;
|
|
200
|
+
if (!recId)
|
|
201
|
+
return null;
|
|
202
|
+
const access = await ctx.soql.queryAll(`SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE UserId = '${guestId}' AND RecordId = '${recId}'`);
|
|
203
|
+
return access[0]?.HasReadAccess === true;
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
evidenceNote(e) {
|
|
210
|
+
if (e.confirmed === true)
|
|
211
|
+
return 'Read CONFIRMED via UserRecordAccess; UI-API-modelled (GraphQL-reachable)';
|
|
212
|
+
if (e.confirmed === false)
|
|
213
|
+
return 'UI-API-modelled, but UserRecordAccess did not confirm read on the sampled record';
|
|
214
|
+
return 'UI-API-modelled (GraphQL-reachable); no sample record available to confirm read';
|
|
215
|
+
}
|
|
216
|
+
ok(guestCount, readableCount) {
|
|
217
|
+
return {
|
|
218
|
+
id: 'guest-object-exposure-ok',
|
|
219
|
+
category: this.category,
|
|
220
|
+
riskLevel: 'LOW',
|
|
221
|
+
passed: true,
|
|
222
|
+
title: `${guestCount} active guest user(s); no objects bulk-exposed`,
|
|
223
|
+
detail: readableCount === 0
|
|
224
|
+
? 'Guest profiles grant Read on no business objects, so there is no UI-API bulk-read surface.'
|
|
225
|
+
: `Guest profiles can read ${readableCount} object(s), but all have a Private external OWD with no guest-owned records, so no records are bulk-readable.`,
|
|
226
|
+
remediation: 'Continue to review guest object permissions and record ownership as forms and sites change.',
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
inconclusive(id, what) {
|
|
230
|
+
return {
|
|
231
|
+
id,
|
|
232
|
+
category: this.category,
|
|
233
|
+
riskLevel: 'INFO',
|
|
234
|
+
inconclusive: true,
|
|
235
|
+
title: `${what} (insufficient access)`,
|
|
236
|
+
detail: 'The audit user could not gather the data needed to evaluate guest object exposure.',
|
|
237
|
+
remediation: 'Grant the audit user View Setup and Configuration plus read on the relevant objects, then re-run.',
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=GuestObjectExposureCheck.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Verifies the PREVENTIVE guardrail that stops the guest-ownership-defeats-OWD
|
|
5
|
+
* exfiltration vector: "Secure guest user record access".
|
|
6
|
+
*
|
|
7
|
+
* This is the policy complement to GuestObjectExposureCheck (which detects the
|
|
8
|
+
* SYMPTOM — guest-owned records readable under a Private OWD). Once "Secure guest
|
|
9
|
+
* user record access" is enforced, guests can no longer be granted record access
|
|
10
|
+
* except via explicit guest user sharing rules, and — paired with "Assign new
|
|
11
|
+
* records created by guest users to the default owner" — guests stop OWNING the
|
|
12
|
+
* records they submit, which is what otherwise nullifies a Private OWD for
|
|
13
|
+
* guest-submitted records (an owner can always read its own records).
|
|
14
|
+
*
|
|
15
|
+
* The enforcement ships as a Salesforce Release Update ("Secure guest user record
|
|
16
|
+
* access", api-visible as a CriticalUpdate). This check reads that update's
|
|
17
|
+
* activation state via the Tooling API and grades:
|
|
18
|
+
* - update present & IsEnabled = false => HIGH: guardrail available, NOT activated.
|
|
19
|
+
* - update present & IsEnabled = true => pass: guardrail enforced.
|
|
20
|
+
* - update absent (older orgs where it was auto-activated long ago, or not
|
|
21
|
+
* surfaced) => LOW advisory: confirm the Sharing
|
|
22
|
+
* Settings checkboxes manually, since the API no longer exposes the toggle.
|
|
23
|
+
* Degrades to inconclusive if guest users or the Tooling API cannot be read.
|
|
24
|
+
*/
|
|
25
|
+
export declare class GuestRecordAccessPolicyCheck implements SecurityCheck {
|
|
26
|
+
readonly id = "guest-record-access-policy";
|
|
27
|
+
readonly name = "Secure Guest User Record Access";
|
|
28
|
+
readonly category = "Access Control";
|
|
29
|
+
readonly description = "Verifies the \"Secure guest user record access\" enforcement is activated, the guardrail that stops guest-owned records defeating a Private org-wide default";
|
|
30
|
+
private matchesSecureGuestAccess;
|
|
31
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
32
|
+
private inconclusive;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=GuestRecordAccessPolicyCheck.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verifies the PREVENTIVE guardrail that stops the guest-ownership-defeats-OWD
|
|
3
|
+
* exfiltration vector: "Secure guest user record access".
|
|
4
|
+
*
|
|
5
|
+
* This is the policy complement to GuestObjectExposureCheck (which detects the
|
|
6
|
+
* SYMPTOM — guest-owned records readable under a Private OWD). Once "Secure guest
|
|
7
|
+
* user record access" is enforced, guests can no longer be granted record access
|
|
8
|
+
* except via explicit guest user sharing rules, and — paired with "Assign new
|
|
9
|
+
* records created by guest users to the default owner" — guests stop OWNING the
|
|
10
|
+
* records they submit, which is what otherwise nullifies a Private OWD for
|
|
11
|
+
* guest-submitted records (an owner can always read its own records).
|
|
12
|
+
*
|
|
13
|
+
* The enforcement ships as a Salesforce Release Update ("Secure guest user record
|
|
14
|
+
* access", api-visible as a CriticalUpdate). This check reads that update's
|
|
15
|
+
* activation state via the Tooling API and grades:
|
|
16
|
+
* - update present & IsEnabled = false => HIGH: guardrail available, NOT activated.
|
|
17
|
+
* - update present & IsEnabled = true => pass: guardrail enforced.
|
|
18
|
+
* - update absent (older orgs where it was auto-activated long ago, or not
|
|
19
|
+
* surfaced) => LOW advisory: confirm the Sharing
|
|
20
|
+
* Settings checkboxes manually, since the API no longer exposes the toggle.
|
|
21
|
+
* Degrades to inconclusive if guest users or the Tooling API cannot be read.
|
|
22
|
+
*/
|
|
23
|
+
export class GuestRecordAccessPolicyCheck {
|
|
24
|
+
id = 'guest-record-access-policy';
|
|
25
|
+
name = 'Secure Guest User Record Access';
|
|
26
|
+
category = 'Access Control';
|
|
27
|
+
description = 'Verifies the "Secure guest user record access" enforcement is activated, the guardrail that stops guest-owned records defeating a Private org-wide default';
|
|
28
|
+
// Matches the release update / sharing setting regardless of the exact label
|
|
29
|
+
// Salesforce uses across versions: the name/description mentions guests AND
|
|
30
|
+
// record access.
|
|
31
|
+
matchesSecureGuestAccess(u) {
|
|
32
|
+
const hay = `${u.Name} ${u.Description ?? ''}`.toLowerCase();
|
|
33
|
+
const guest = hay.includes('guest');
|
|
34
|
+
const record = hay.includes('record access') || hay.includes('record-level') || hay.includes("access to records") || hay.includes('securely access');
|
|
35
|
+
return guest && record;
|
|
36
|
+
}
|
|
37
|
+
async run(ctx) {
|
|
38
|
+
const findings = [];
|
|
39
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/SecuritySharing/page`;
|
|
40
|
+
let guests;
|
|
41
|
+
try {
|
|
42
|
+
guests = await ctx.soql.queryAll("SELECT Id FROM User WHERE UserType = 'Guest' AND IsActive = true");
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
findings.push(this.inconclusive('guest-record-access-policy-inaccessible', 'Guest users could not be queried'));
|
|
46
|
+
return { findings };
|
|
47
|
+
}
|
|
48
|
+
if (guests.length === 0) {
|
|
49
|
+
findings.push({
|
|
50
|
+
id: 'guest-record-access-policy-none',
|
|
51
|
+
category: this.category,
|
|
52
|
+
riskLevel: 'LOW',
|
|
53
|
+
passed: true,
|
|
54
|
+
title: 'No active guest users',
|
|
55
|
+
detail: 'There are no active guest users, so guest record-access enforcement has no attack surface to protect.',
|
|
56
|
+
remediation: 'If an Experience Cloud or Sites site is added later, ensure "Secure guest user record access" is enforced before going live.',
|
|
57
|
+
});
|
|
58
|
+
return { findings };
|
|
59
|
+
}
|
|
60
|
+
let updates;
|
|
61
|
+
try {
|
|
62
|
+
updates = await ctx.tooling.query('SELECT Id, Name, Description, IsEnabled FROM CriticalUpdate');
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
findings.push(this.inconclusive('guest-record-access-policy-tooling-inaccessible', 'Release updates could not be queried'));
|
|
66
|
+
return { findings };
|
|
67
|
+
}
|
|
68
|
+
const match = updates.find((u) => this.matchesSecureGuestAccess(u));
|
|
69
|
+
if (match && !match.IsEnabled) {
|
|
70
|
+
findings.push({
|
|
71
|
+
id: 'guest-record-access-policy-not-enforced',
|
|
72
|
+
category: this.category,
|
|
73
|
+
riskLevel: 'HIGH',
|
|
74
|
+
title: `"Secure guest user record access" is available but NOT activated (${guests.length} active guest user(s))`,
|
|
75
|
+
detail: 'The "Secure guest user record access" Release Update is present but not enabled. Until it is activated, guest users can be granted record access through legacy sharing mechanisms and can own the records they submit via public forms. Because an owner can always read its own records, a Private org-wide default does not protect guest-owned records — this is the exact vector that turns a public submission form into an unauthenticated bulk-read surface.',
|
|
76
|
+
remediation: 'Activate "Secure guest user record access" in Setup → Release Updates, and enable "Assign new records created by guest users to the default owner" in Setup → Sharing Settings. Reparent existing guest-owned records to an internal default/integration owner. After enforcement, grant guest read access only through explicit, minimal guest user sharing rules.',
|
|
77
|
+
affectedItems: [{ label: match.Name, url: `${ctx.orgInfo.instanceUrl}/lightning/setup/ReleaseUpdates/home`, note: 'Release Update present, IsEnabled = false' }],
|
|
78
|
+
});
|
|
79
|
+
return { findings };
|
|
80
|
+
}
|
|
81
|
+
if (match && match.IsEnabled) {
|
|
82
|
+
findings.push({
|
|
83
|
+
id: 'guest-record-access-policy-enforced',
|
|
84
|
+
category: this.category,
|
|
85
|
+
riskLevel: 'LOW',
|
|
86
|
+
passed: true,
|
|
87
|
+
title: '"Secure guest user record access" is enforced',
|
|
88
|
+
detail: 'The "Secure guest user record access" Release Update is enabled, so guests cannot be granted record access except through explicit guest user sharing rules. Verify "Assign new records created by guest users to the default owner" is also enabled so guests do not own the records they submit.',
|
|
89
|
+
remediation: 'Confirm "Assign new records created by guest users to the default owner" is enabled in Setup → Sharing Settings, and periodically review guest user sharing rules for least privilege.',
|
|
90
|
+
affectedItems: [{ label: match.Name, url: setupUrl, note: 'Release Update enabled' }],
|
|
91
|
+
});
|
|
92
|
+
return { findings };
|
|
93
|
+
}
|
|
94
|
+
// No matching update surfaced — typical of orgs where it was auto-activated in
|
|
95
|
+
// an earlier release and no longer appears in CriticalUpdate. We got data, so
|
|
96
|
+
// this is advisory (LOW), not inconclusive: point the operator at the manual toggles.
|
|
97
|
+
findings.push({
|
|
98
|
+
id: 'guest-record-access-policy-verify-manually',
|
|
99
|
+
category: this.category,
|
|
100
|
+
riskLevel: 'LOW',
|
|
101
|
+
title: `Confirm guest record-access guardrails manually (${guests.length} active guest user(s))`,
|
|
102
|
+
detail: 'The "Secure guest user record access" Release Update is no longer exposed via the API (usually because it was auto-activated in an earlier Salesforce release). Enforcement is therefore assumed but not API-verifiable. The two settings that jointly close the guest-ownership-defeats-OWD vector cannot be read programmatically.',
|
|
103
|
+
remediation: 'In Setup → Sharing Settings, confirm "Secure guest user record access" is on and "Assign new records created by guest users to the default owner" is enabled. Then confirm no guest user OWNS records (see the guest-object-exposure finding) and that guest access is granted only via minimal guest user sharing rules.',
|
|
104
|
+
affectedItems: [{ label: 'Sharing Settings', url: setupUrl, note: 'Manual verification required' }],
|
|
105
|
+
});
|
|
106
|
+
return { findings };
|
|
107
|
+
}
|
|
108
|
+
inconclusive(id, what) {
|
|
109
|
+
return {
|
|
110
|
+
id,
|
|
111
|
+
category: this.category,
|
|
112
|
+
riskLevel: 'INFO',
|
|
113
|
+
inconclusive: true,
|
|
114
|
+
title: `${what} (insufficient access)`,
|
|
115
|
+
detail: 'The audit user could not gather the data needed to evaluate guest record-access enforcement.',
|
|
116
|
+
remediation: 'Grant the audit user View Setup and Configuration plus Tooling API access, then re-run.',
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=GuestRecordAccessPolicyCheck.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Flags two Experience Cloud Network settings that widen the unauthenticated
|
|
5
|
+
* guest surface and are not covered by the self-registration / guest-user checks:
|
|
6
|
+
* - OptionsGuestFileAccessEnabled: guests can access public files (ContentVersion/
|
|
7
|
+
* Attachment), enabling file enumeration and download.
|
|
8
|
+
* - OptionsGuestMemberVisibility: guests can see other site members (User records),
|
|
9
|
+
* leaking member identities to unauthenticated visitors.
|
|
10
|
+
*/
|
|
11
|
+
export declare class GuestSiteOptionsCheck implements SecurityCheck {
|
|
12
|
+
readonly id = "guest-site-options";
|
|
13
|
+
readonly name = "Experience Cloud Guest Site Options";
|
|
14
|
+
readonly category = "Access Control";
|
|
15
|
+
readonly description = "Checks Experience Cloud sites for guest file access and guest member visibility, which expose files and member identities to unauthenticated visitors";
|
|
16
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=GuestSiteOptionsCheck.d.ts.map
|