@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
|
@@ -18,15 +18,36 @@ export const NAMED_CHAINS = [
|
|
|
18
18
|
const steps = byIds(active, [
|
|
19
19
|
'guest-user-read-access', 'guest-user-write-access', 'guest-user-sharing-exposure', 'guest-user-baseline',
|
|
20
20
|
'guest-executable-apex-unprotected', 'guest-executable-apex-exposed',
|
|
21
|
+
'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
|
|
22
|
+
'guest-api-access-enabled', 'guest-api-hard-delete', 'classic-sites-active',
|
|
21
23
|
'portal-exposed-apex-without-sharing', 'sharing-model-external-read', 'sharing-model-external-write',
|
|
22
24
|
'field-level-security-high', 'field-level-security-medium',
|
|
23
25
|
]);
|
|
24
26
|
return steps.length >= 2 ? steps : null;
|
|
25
27
|
},
|
|
26
28
|
},
|
|
29
|
+
{
|
|
30
|
+
id: 'active-guest-exfil',
|
|
31
|
+
title: 'Active guest reconnaissance against an exposed data surface',
|
|
32
|
+
severity: 'CRITICAL',
|
|
33
|
+
narrative: 'Live EventLogFile evidence shows unauthenticated guests probing from anonymizer/hosting IPs or ' +
|
|
34
|
+
'running GraphQL object-enumeration (totalCount) sweeps, AND the org exposes objects that are ' +
|
|
35
|
+
'bulk-readable by those same guests. This is not a theoretical exposure — it is reconnaissance ' +
|
|
36
|
+
'against a confirmed exfiltration surface, i.e. an incident likely already in progress.',
|
|
37
|
+
remediation: 'Treat as an active incident: block the source IPs at the WAF/CDN, close the guest bulk-read surface ' +
|
|
38
|
+
'(set external OWD to Private, strip guest object read, enforce "Secure guest user record access"), ' +
|
|
39
|
+
'and preserve/forward the event logs before the short EventLogFile retention window closes.',
|
|
40
|
+
match(_present, active) {
|
|
41
|
+
const traffic = byIds(active, ['guest-traffic-anomaly-recon', 'guest-traffic-anomaly-anonymizer']);
|
|
42
|
+
const exposure = byIds(active, ['guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned']);
|
|
43
|
+
if (traffic.length === 0 || exposure.length === 0)
|
|
44
|
+
return null;
|
|
45
|
+
return [...traffic, ...exposure];
|
|
46
|
+
},
|
|
47
|
+
},
|
|
27
48
|
{
|
|
28
49
|
id: 'standard-to-takeover',
|
|
29
|
-
title: 'Standard user
|
|
50
|
+
title: 'Standard user to org takeover',
|
|
30
51
|
severity: 'CRITICAL',
|
|
31
52
|
narrative: 'A low-trust authenticated user combines with a privilege-escalation permission ' +
|
|
32
53
|
'(assign permission sets, manage users, author apex, modify metadata) to reach full org control.',
|
|
@@ -39,13 +60,14 @@ export const NAMED_CHAINS = [
|
|
|
39
60
|
const steps = byIds(active, [
|
|
40
61
|
'sharing-model-external-read', 'sharing-model-external-write', 'guest-user-baseline',
|
|
41
62
|
'escalation-perms-found', 'users-author-apex', 'users-super-admin-combo',
|
|
63
|
+
'login-access-policy-delegated-admins', 'login-access-policy-login-as-enabled',
|
|
42
64
|
]);
|
|
43
65
|
return steps.length >= 2 ? steps : null;
|
|
44
66
|
},
|
|
45
67
|
},
|
|
46
68
|
{
|
|
47
69
|
id: 'cred-theft-pivot',
|
|
48
|
-
title: 'Credential theft
|
|
70
|
+
title: 'Credential theft to external pivot',
|
|
49
71
|
severity: 'CRITICAL',
|
|
50
72
|
narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels, debug logs, or broad CORS) ' +
|
|
51
73
|
'combine with an external egress path (named credential or remote site) to exfiltrate data to attacker infrastructure.',
|
|
@@ -63,7 +85,7 @@ export const NAMED_CHAINS = [
|
|
|
63
85
|
},
|
|
64
86
|
{
|
|
65
87
|
id: 'soql-injection-read',
|
|
66
|
-
title: 'SOQL injection
|
|
88
|
+
title: 'SOQL injection to mass read',
|
|
67
89
|
severity: 'HIGH',
|
|
68
90
|
narrative: 'Injectable dynamic SOQL combines with bulk data readability to let an attacker extract large datasets.',
|
|
69
91
|
remediation: 'Use bind variables in all dynamic SOQL and enforce CRUD/FLS; restrict bulk read access.',
|
|
@@ -82,7 +104,7 @@ export const NAMED_CHAINS = [
|
|
|
82
104
|
},
|
|
83
105
|
{
|
|
84
106
|
id: 'mfa-bypass-admin',
|
|
85
|
-
title: 'MFA bypass
|
|
107
|
+
title: 'MFA bypass to privileged compromise',
|
|
86
108
|
severity: 'HIGH',
|
|
87
109
|
narrative: 'Weak MFA enforcement or trusted-IP MFA bypass combines with the presence of highly-privileged ' +
|
|
88
110
|
'accounts, so a credential-stuffing or phishing attacker can take over an admin without a second factor.',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EventLogAccess } from '../context/AuditCache.js';
|
|
2
|
+
/**
|
|
3
|
+
* Classifies why an `EventLogFile` query failed so callers can tell the two very
|
|
4
|
+
* different "no data" causes apart:
|
|
5
|
+
* - 'not-enabled' : Event Monitoring is not licensed/enabled (EventLogFile is
|
|
6
|
+
* an unknown/blocked sObject) — the org captures nothing.
|
|
7
|
+
* - 'no-permission' : the feature is on, but the running audit user lacks the
|
|
8
|
+
* "View Event Log Files" permission — logs exist, we can't read them.
|
|
9
|
+
* - 'unknown' : could not be attributed to either.
|
|
10
|
+
* Both are BLIND for guest-traffic analysis, but the remediation differs (license
|
|
11
|
+
* vs. grant a permission), so the distinction is worth surfacing.
|
|
12
|
+
*/
|
|
13
|
+
export declare function classifyEventLogAccessError(err: unknown): EventLogAccess;
|
|
14
|
+
//# sourceMappingURL=eventLogAccess.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isApiError } from '../api/ApiError.js';
|
|
2
|
+
/**
|
|
3
|
+
* Classifies why an `EventLogFile` query failed so callers can tell the two very
|
|
4
|
+
* different "no data" causes apart:
|
|
5
|
+
* - 'not-enabled' : Event Monitoring is not licensed/enabled (EventLogFile is
|
|
6
|
+
* an unknown/blocked sObject) — the org captures nothing.
|
|
7
|
+
* - 'no-permission' : the feature is on, but the running audit user lacks the
|
|
8
|
+
* "View Event Log Files" permission — logs exist, we can't read them.
|
|
9
|
+
* - 'unknown' : could not be attributed to either.
|
|
10
|
+
* Both are BLIND for guest-traffic analysis, but the remediation differs (license
|
|
11
|
+
* vs. grant a permission), so the distinction is worth surfacing.
|
|
12
|
+
*/
|
|
13
|
+
export function classifyEventLogAccessError(err) {
|
|
14
|
+
if (isApiError(err)) {
|
|
15
|
+
if (err.statusCode === 403 || /ACCESS|INSUFFICIENT/i.test(err.errorCode))
|
|
16
|
+
return 'no-permission';
|
|
17
|
+
if (/INVALID_TYPE|NOT_FOUND|MALFORMED_QUERY/i.test(err.errorCode) || err.statusCode === 404 || err.statusCode === 400) {
|
|
18
|
+
return 'not-enabled';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
|
|
22
|
+
if (msg.includes('insufficient') || msg.includes('permission') || msg.includes('view event log'))
|
|
23
|
+
return 'no-permission';
|
|
24
|
+
if (msg.includes('not supported') ||
|
|
25
|
+
msg.includes('invalid type') ||
|
|
26
|
+
msg.includes("sobject type 'eventlogfile'") ||
|
|
27
|
+
msg.includes('not enabled') ||
|
|
28
|
+
msg.includes('licens')) {
|
|
29
|
+
return 'not-enabled';
|
|
30
|
+
}
|
|
31
|
+
return 'unknown';
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=eventLogAccess.js.map
|
|
@@ -30,7 +30,7 @@ export class AnonymousApexAuditCheck {
|
|
|
30
30
|
category: this.category,
|
|
31
31
|
riskLevel: 'INFO',
|
|
32
32
|
inconclusive: true,
|
|
33
|
-
title: 'SetupAuditTrail could not be queried
|
|
33
|
+
title: 'SetupAuditTrail could not be queried: anonymous Apex execution cannot be verified',
|
|
34
34
|
detail: 'The SetupAuditTrail object was not accessible. This may indicate insufficient permissions to view the org audit trail.',
|
|
35
35
|
remediation: 'Grant "View Setup and Configuration" permission to the audit user. Review anonymous Apex execution manually in Setup → Audit Trail.',
|
|
36
36
|
affectedItems: [{ label: 'Setup Audit Trail', url: auditTrailUrl }],
|
|
@@ -76,12 +76,12 @@ export class AnonymousApexAuditCheck {
|
|
|
76
76
|
category: this.category,
|
|
77
77
|
riskLevel: 'HIGH',
|
|
78
78
|
title: `${nonAdminUsers.length} non-admin user(s) executed anonymous Apex in the last 90 days`,
|
|
79
|
-
detail: 'Anonymous Apex execution in production is a privileged, hard-to-audit operation. Anon Apex runs as the executing user but leaves no code artifact
|
|
79
|
+
detail: 'Anonymous Apex execution in production is a privileged, hard-to-audit operation. Anon Apex runs as the executing user but leaves no code artifact. It cannot be reviewed, versioned, or rolled back. Non-admin users executing anonymous Apex indicates a significant control gap: these users have Developer Console access in production and can manipulate data or bypass sharing rules without leaving a traceable code change.',
|
|
80
80
|
remediation: 'Remove Developer Console access from non-admin users. Revoke the "Author Apex" permission from all profiles and permission sets that do not require it. All code changes in production must go through a formal deployment process (change sets, Salesforce DX). Review each execution instance to determine what code was run and what data was affected.',
|
|
81
81
|
affectedItems: nonAdminUsers.map((u) => ({
|
|
82
82
|
label: u.username,
|
|
83
83
|
url: auditTrailUrl,
|
|
84
|
-
note: `${u.count} execution(s)
|
|
84
|
+
note: `${u.count} execution(s). Latest: ${new Date(u.latest).toISOString().split('T')[0]}. Profile: ${u.profile}`,
|
|
85
85
|
})),
|
|
86
86
|
});
|
|
87
87
|
}
|
|
@@ -90,13 +90,13 @@ export class AnonymousApexAuditCheck {
|
|
|
90
90
|
id: 'anonymous-apex-admin-only',
|
|
91
91
|
category: this.category,
|
|
92
92
|
riskLevel: 'MEDIUM',
|
|
93
|
-
title: `Anonymous Apex executed by ${adminOnlyUsers.length} admin-profile user(s) in the last 90 days
|
|
93
|
+
title: `Anonymous Apex executed by ${adminOnlyUsers.length} admin-profile user(s) in the last 90 days: monitoring recommended`,
|
|
94
94
|
detail: 'Anonymous Apex execution by administrator-profile users still represents a risk in production: it bypasses change management, leaves no deployable artifact, and cannot be peer-reviewed. Even legitimate use by admins should be tracked, approved, and documented as part of a change management process.',
|
|
95
95
|
remediation: 'Establish a policy requiring pre-approval for any anonymous Apex execution in production. Log approvals in your change management system. Prefer metadata deployments over anonymous Apex for all production data or configuration changes. Consider restricting Developer Console to a dedicated integration user only.',
|
|
96
96
|
affectedItems: adminOnlyUsers.map((u) => ({
|
|
97
97
|
label: u.username,
|
|
98
98
|
url: auditTrailUrl,
|
|
99
|
-
note: `${u.count} execution(s)
|
|
99
|
+
note: `${u.count} execution(s). Latest: ${new Date(u.latest).toISOString().split('T')[0]}. Profile: ${u.profile}`,
|
|
100
100
|
})),
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -4,7 +4,7 @@ export declare class ApexCrudFLSCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "apex-crud-fls";
|
|
5
5
|
readonly name = "Apex CRUD/FLS Enforcement";
|
|
6
6
|
readonly category = "Code Security";
|
|
7
|
-
readonly description = "Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions
|
|
7
|
+
readonly description = "Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions: OWASP Top 10 for Salesforce";
|
|
8
8
|
readonly dependsOnCache: readonly ["apexBodies"];
|
|
9
9
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ export class ApexCrudFLSCheck {
|
|
|
12
12
|
id = 'apex-crud-fls';
|
|
13
13
|
name = 'Apex CRUD/FLS Enforcement';
|
|
14
14
|
category = 'Code Security';
|
|
15
|
-
description = 'Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions
|
|
15
|
+
description = 'Flags Apex classes that perform DML or SOQL without checking CRUD/FLS permissions: OWASP Top 10 for Salesforce';
|
|
16
16
|
dependsOnCache = ['apexBodies'];
|
|
17
17
|
async run(ctx) {
|
|
18
18
|
const findings = [];
|
|
@@ -24,7 +24,7 @@ export class ApexCrudFLSCheck {
|
|
|
24
24
|
category: this.category,
|
|
25
25
|
riskLevel: 'INFO',
|
|
26
26
|
inconclusive: true,
|
|
27
|
-
title: 'Apex class bodies not available
|
|
27
|
+
title: 'Apex class bodies not available: CRUD/FLS check skipped',
|
|
28
28
|
detail: 'Apex class bodies were not cached. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
29
29
|
remediation: 'Verify registry ordering so HardcodedCredentialsCheck (which populates apexBodies) precedes ApexCrudFLSCheck.',
|
|
30
30
|
});
|
|
@@ -62,7 +62,7 @@ export class ApexCrudFLSCheck {
|
|
|
62
62
|
affectedItems: withoutSharingNoFls.slice(0, 30).map((n) => ({
|
|
63
63
|
label: n,
|
|
64
64
|
url: apexClassesUrl,
|
|
65
|
-
note: '"without sharing" + DML/SOQL + no FLS check
|
|
65
|
+
note: '"without sharing" + DML/SOQL + no FLS check: highest risk',
|
|
66
66
|
})),
|
|
67
67
|
});
|
|
68
68
|
}
|
|
@@ -77,7 +77,7 @@ export class ApexCrudFLSCheck {
|
|
|
77
77
|
affectedItems: withDmlNoFls.slice(0, 30).map((n) => ({
|
|
78
78
|
label: n,
|
|
79
79
|
url: apexClassesUrl,
|
|
80
|
-
note: 'DML/SOQL without FLS check
|
|
80
|
+
note: 'DML/SOQL without FLS check: add Security.stripInaccessible() or isAccessible() guards',
|
|
81
81
|
})),
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -37,8 +37,8 @@ export class ApexLoggingCheck {
|
|
|
37
37
|
category: this.category,
|
|
38
38
|
riskLevel: 'INFO',
|
|
39
39
|
inconclusive: true,
|
|
40
|
-
title: 'Apex class bodies not available
|
|
41
|
-
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache
|
|
40
|
+
title: 'Apex class bodies not available: SBS-CODE-003/004 check skipped',
|
|
41
|
+
detail: 'SBS-CODE-003/004 require scanning Apex class bodies for logging patterns. Apex bodies were not available in the audit cache. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
42
42
|
remediation: 'Verify HardcodedCredentialsCheck is registered before ApexLoggingCheck in the check registry.',
|
|
43
43
|
});
|
|
44
44
|
return { findings };
|
|
@@ -70,7 +70,7 @@ export class ApexLoggingCheck {
|
|
|
70
70
|
category: this.category,
|
|
71
71
|
riskLevel: 'LOW',
|
|
72
72
|
passed: true,
|
|
73
|
-
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework
|
|
73
|
+
title: `${persistentLoggerClasses.length} Apex class(es) use a persistent logging framework: SBS-CODE-003`,
|
|
74
74
|
detail: `SBS-CODE-003 requires Apex to use a persistent logging framework rather than transient System.debug calls. ${persistentLoggerClasses.length} class(es) reference a persistent logger. Examples: ${persistentLoggerClasses.slice(0, 5).join(', ')}${persistentLoggerClasses.length > 5 ? ` (+${persistentLoggerClasses.length - 5} more)` : ''}.`,
|
|
75
75
|
remediation: 'Extend persistent logging coverage to all production classes that handle significant business logic or integration operations.',
|
|
76
76
|
});
|
|
@@ -80,15 +80,15 @@ export class ApexLoggingCheck {
|
|
|
80
80
|
id: 'apex-logging-debug-only',
|
|
81
81
|
category: this.category,
|
|
82
82
|
riskLevel: scheduledDebugClasses.length > 0 ? 'MEDIUM' : 'LOW',
|
|
83
|
-
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug
|
|
84
|
-
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs
|
|
83
|
+
title: `${debugOnlyClasses.length} Apex class(es) use only System.debug: SBS-CODE-003`,
|
|
84
|
+
detail: `SBS-CODE-003 requires a persistent logging framework so that audit and error events are durable and searchable after the fact. ${debugOnlyClasses.length} production class(es) rely solely on System.debug, whose output is transient and unavailable once the debug log expires. ${scheduledDebugClasses.length > 0 ? `${scheduledDebugClasses.length} of these are scheduled or batch jobs. Persistent logging is especially important for operational visibility in background processes.` : ''}`,
|
|
85
85
|
remediation: 'Adopt a persistent logging framework (a custom Log__c object, Platform Events, or an open-source framework) and migrate System.debug calls to it for all classes handling critical business logic.',
|
|
86
86
|
affectedItems: debugOnlyClasses.slice(0, 30).map((name) => ({
|
|
87
87
|
label: name,
|
|
88
88
|
url: apexClassesUrl,
|
|
89
89
|
note: scheduledClassNames.has(name)
|
|
90
|
-
? 'scheduled/batch job
|
|
91
|
-
: 'System.debug only
|
|
90
|
+
? 'scheduled/batch job: high priority to add persistent logging'
|
|
91
|
+
: 'System.debug only: no persistent log trail',
|
|
92
92
|
})),
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -97,13 +97,13 @@ export class ApexLoggingCheck {
|
|
|
97
97
|
id: 'apex-logging-sensitive-data',
|
|
98
98
|
category: this.category,
|
|
99
99
|
riskLevel: 'HIGH',
|
|
100
|
-
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data
|
|
100
|
+
title: `${sensitiveLogClasses.length} Apex class(es) may log sensitive data: SBS-CODE-004`,
|
|
101
101
|
detail: 'SBS-CODE-004 prohibits logging sensitive data (passwords, tokens, session IDs, PII) in Apex. The flagged classes appear to pass sensitive variable names or credential values directly to System.debug(), which writes them to debug logs accessible to any administrator who can view debug logs.',
|
|
102
102
|
remediation: 'Remove all logging of passwords, tokens, API keys, and PII from Apex code. Review each flagged class and mask, redact, or entirely exclude sensitive values before passing them to any logging call.',
|
|
103
103
|
affectedItems: sensitiveLogClasses.map((name) => ({
|
|
104
104
|
label: name,
|
|
105
105
|
url: apexClassesUrl,
|
|
106
|
-
note: 'Review System.debug() calls
|
|
106
|
+
note: 'Review System.debug() calls: sensitive variable names detected near logging statements',
|
|
107
107
|
})),
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -113,7 +113,7 @@ export class ApexLoggingCheck {
|
|
|
113
113
|
category: this.category,
|
|
114
114
|
riskLevel: 'LOW',
|
|
115
115
|
passed: true,
|
|
116
|
-
title: 'No System.debug-only logging or sensitive-data logging patterns found
|
|
116
|
+
title: 'No System.debug-only logging or sensitive-data logging patterns found: SBS-CODE-003/004',
|
|
117
117
|
detail: 'SBS-CODE-003 requires a persistent logging framework and SBS-CODE-004 prohibits sensitive data in logs. No violations were detected in the scanned Apex classes.',
|
|
118
118
|
remediation: 'Continue monitoring as new Apex classes are added to the org.',
|
|
119
119
|
});
|
|
@@ -21,7 +21,7 @@ export class ApexRestEndpointCheck {
|
|
|
21
21
|
category: this.category,
|
|
22
22
|
riskLevel: 'INFO',
|
|
23
23
|
inconclusive: true,
|
|
24
|
-
title: 'Apex class bodies not available
|
|
24
|
+
title: 'Apex class bodies not available: REST endpoint check skipped',
|
|
25
25
|
detail: 'Apex bodies were not cached. Ensure HardcodedCredentialsCheck runs before this check.',
|
|
26
26
|
remediation: 'Verify registry ordering.',
|
|
27
27
|
});
|
|
@@ -51,7 +51,7 @@ export class ApexRestEndpointCheck {
|
|
|
51
51
|
affectedItems: restClasses.map(({ name }) => ({
|
|
52
52
|
label: name,
|
|
53
53
|
url: apexClassesUrl,
|
|
54
|
-
note: 'Custom REST endpoint
|
|
54
|
+
note: 'Custom REST endpoint: review access controls',
|
|
55
55
|
})),
|
|
56
56
|
});
|
|
57
57
|
// Flag endpoints declared without sharing — REST callers bypass record-level access
|
|
@@ -62,12 +62,12 @@ export class ApexRestEndpointCheck {
|
|
|
62
62
|
category: this.category,
|
|
63
63
|
riskLevel: 'HIGH',
|
|
64
64
|
title: `${withoutSharing.length} REST endpoint class(es) declared "without sharing"`,
|
|
65
|
-
detail: `Apex REST endpoints declared "without sharing" execute with elevated system privileges
|
|
65
|
+
detail: `Apex REST endpoints declared "without sharing" execute with elevated system privileges. Any authenticated (or, if the endpoint is exposed via a Community, unauthenticated) caller can retrieve or modify records regardless of the running user's sharing rules. This is a common vector for horizontal privilege escalation in Salesforce integrations.`,
|
|
66
66
|
remediation: 'Change declarations to "with sharing" so that record-level access is enforced for REST callers. Where system-level access is genuinely required (e.g. an integration service account), document the justification and ensure the endpoint is not accessible to end-user profiles.',
|
|
67
67
|
affectedItems: withoutSharing.map(({ name }) => ({
|
|
68
68
|
label: name,
|
|
69
69
|
url: apexClassesUrl,
|
|
70
|
-
note: '"without sharing" REST endpoint
|
|
70
|
+
note: '"without sharing" REST endpoint: callers bypass record sharing rules',
|
|
71
71
|
})),
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -84,7 +84,7 @@ export class ApexRestEndpointCheck {
|
|
|
84
84
|
affectedItems: noSharingDeclaration.map(({ name }) => ({
|
|
85
85
|
label: name,
|
|
86
86
|
url: apexClassesUrl,
|
|
87
|
-
note: 'No sharing declaration
|
|
87
|
+
note: 'No sharing declaration: add "with sharing" explicitly',
|
|
88
88
|
})),
|
|
89
89
|
});
|
|
90
90
|
}
|
|
@@ -79,15 +79,15 @@ export class ApexSharingCheck {
|
|
|
79
79
|
id: 'portal-exposed-apex-without-sharing',
|
|
80
80
|
category: this.category,
|
|
81
81
|
riskLevel: 'CRITICAL',
|
|
82
|
-
title: `${allPortalRisk.length} portal-exposed Apex class(es) (@AuraEnabled/@RemoteAction) lack "with sharing"
|
|
82
|
+
title: `${allPortalRisk.length} portal-exposed Apex class(es) (@AuraEnabled/@RemoteAction) lack "with sharing": IDOR risk`,
|
|
83
83
|
detail: 'Classes with @AuraEnabled or @RemoteAction methods that use "without sharing" or have no sharing declaration execute without record-level access control. Attackers can supply arbitrary record IDs to read or manipulate data they should not access (IDOR). SBS-CPORTAL-001 requires server-side authorization for every record accessed via portal Apex.',
|
|
84
84
|
remediation: 'Add "with sharing" to all @AuraEnabled and @RemoteAction classes. Validate user ownership or sharing on every record accessed inside these methods.',
|
|
85
85
|
affectedItems: allPortalRisk.map((name) => ({
|
|
86
86
|
label: name,
|
|
87
87
|
url: apexClassesUrl,
|
|
88
88
|
note: portalExposedWithoutSharing.includes(name)
|
|
89
|
-
? 'Uses explicit "without sharing"
|
|
90
|
-
: 'No sharing declaration
|
|
89
|
+
? 'Uses explicit "without sharing": replace with "with sharing"'
|
|
90
|
+
: 'No sharing declaration: add "with sharing"',
|
|
91
91
|
})),
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -32,7 +32,7 @@ export class ApiClientPermissionCheck {
|
|
|
32
32
|
id: 'api-client-permission-assigned',
|
|
33
33
|
category: this.category,
|
|
34
34
|
riskLevel: profileGrantors.length > 0 ? 'HIGH' : 'MEDIUM',
|
|
35
|
-
title: `${users.length} user(s) have the "Use Any API Client" permission
|
|
35
|
+
title: `${users.length} user(s) have the "Use Any API Client" permission: SBS-ACS-006`,
|
|
36
36
|
detail: 'SBS-ACS-006 requires documented justification for this permission and states it must not be granted to end-users. "Use Any API Client" bypasses API Access Control, allowing the user to connect via any third-party API client regardless of allowed-list restrictions. This significantly expands the attack surface for unauthorised data access.',
|
|
37
37
|
remediation: 'Review each assignment. Remove from all end-users. Only keep for documented technical users (integration accounts) with a recorded justification in the system of record. Prefer granting through a dedicated permission set, not a profile.',
|
|
38
38
|
affectedItems: users.map((r) => ({
|
|
@@ -48,7 +48,7 @@ export class ApiClientPermissionCheck {
|
|
|
48
48
|
category: this.category,
|
|
49
49
|
riskLevel: 'INFO',
|
|
50
50
|
inconclusive: true,
|
|
51
|
-
title: '"Use Any API Client" permission check could not run
|
|
51
|
+
title: '"Use Any API Client" permission check could not run: field may not exist in this org edition',
|
|
52
52
|
detail: 'SBS-ACS-006 requires documented justification for the "Use Any API Client" permission. This field is part of the API Access Control feature and may not be available in all Salesforce editions.',
|
|
53
53
|
remediation: 'Verify in Setup → Permission Sets whether "Use Any API Client" is available and review assignments if so.',
|
|
54
54
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reviews external identity federation — Auth Providers and SAML SSO configs.
|
|
5
|
+
* Every configured provider is a way into the org that does not use a Salesforce
|
|
6
|
+
* password, so an unvetted or misconfigured provider (especially social login with
|
|
7
|
+
* just-in-time user creation) can let attackers federate in or auto-provision
|
|
8
|
+
* over-privileged users.
|
|
9
|
+
*/
|
|
10
|
+
export declare class AuthProvidersCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "auth-providers";
|
|
12
|
+
readonly name = "Auth Providers & External IdPs";
|
|
13
|
+
readonly category = "Authentication";
|
|
14
|
+
readonly description = "Reviews configured Auth Providers and SAML SSO configurations \u2014 external login paths that bypass Salesforce credentials and can auto-provision users";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=AuthProvidersCheck.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Consumer/social identity providers — higher risk when they can create users
|
|
2
|
+
// via just-in-time provisioning, because an attacker-controlled account at the
|
|
3
|
+
// provider becomes an org login.
|
|
4
|
+
const SOCIAL_TYPES = new Set(['Facebook', 'Google', 'Twitter', 'LinkedIn', 'GitHub', 'OpenIdConnect']);
|
|
5
|
+
/**
|
|
6
|
+
* Reviews external identity federation — Auth Providers and SAML SSO configs.
|
|
7
|
+
* Every configured provider is a way into the org that does not use a Salesforce
|
|
8
|
+
* password, so an unvetted or misconfigured provider (especially social login with
|
|
9
|
+
* just-in-time user creation) can let attackers federate in or auto-provision
|
|
10
|
+
* over-privileged users.
|
|
11
|
+
*/
|
|
12
|
+
export class AuthProvidersCheck {
|
|
13
|
+
id = 'auth-providers';
|
|
14
|
+
name = 'Auth Providers & External IdPs';
|
|
15
|
+
category = 'Authentication';
|
|
16
|
+
description = 'Reviews configured Auth Providers and SAML SSO configurations — external login paths that bypass Salesforce credentials and can auto-provision users';
|
|
17
|
+
async run(ctx) {
|
|
18
|
+
const findings = [];
|
|
19
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
20
|
+
let providers = [];
|
|
21
|
+
let providersFailed = false;
|
|
22
|
+
try {
|
|
23
|
+
providers = await ctx.soql.queryAll('SELECT Id, DeveloperName, ProviderType, FriendlyName FROM AuthProvider');
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
providersFailed = true;
|
|
27
|
+
}
|
|
28
|
+
let saml = [];
|
|
29
|
+
try {
|
|
30
|
+
saml = await ctx.soql.queryAll('SELECT Id, DeveloperName, Issuer FROM SamlSsoConfig');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// SAML config not accessible / not configured — handled together with providers below.
|
|
34
|
+
}
|
|
35
|
+
if (providersFailed) {
|
|
36
|
+
findings.push({
|
|
37
|
+
id: 'auth-providers-inconclusive',
|
|
38
|
+
category: this.category,
|
|
39
|
+
riskLevel: 'INFO',
|
|
40
|
+
inconclusive: true,
|
|
41
|
+
title: 'Auth Providers could not be queried (insufficient access)',
|
|
42
|
+
detail: 'The AuthProvider object was not accessible, so external identity federation could not be evaluated.',
|
|
43
|
+
remediation: 'Grant the audit user View Setup and Configuration and re-run. Also review Setup → Auth. Providers and Single Sign-On Settings manually.',
|
|
44
|
+
});
|
|
45
|
+
return { findings };
|
|
46
|
+
}
|
|
47
|
+
const social = providers.filter((p) => SOCIAL_TYPES.has(p.ProviderType));
|
|
48
|
+
if (social.length > 0) {
|
|
49
|
+
findings.push({
|
|
50
|
+
id: 'auth-providers-social',
|
|
51
|
+
category: this.category,
|
|
52
|
+
riskLevel: 'MEDIUM',
|
|
53
|
+
title: `${social.length} social/consumer Auth Provider(s) configured`,
|
|
54
|
+
detail: 'Social and OpenID Connect auth providers let users authenticate with external consumer identities. If the registration handler provisions users just-in-time, an attacker who controls (or creates) an account at the provider may obtain an org login — potentially with a default profile that is more privileged than intended.',
|
|
55
|
+
remediation: 'Confirm each social provider is intentional, review its Apex registration handler for least-privilege user creation (and that it does not auto-activate high-privilege profiles), and disable providers that are not required.',
|
|
56
|
+
affectedItems: social.map((p) => ({ label: `${p.FriendlyName ?? p.DeveloperName} (${p.ProviderType})`, url: `${baseUrl}/lightning/setup/AuthProviders/home` })),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const nonSocial = providers.filter((p) => !SOCIAL_TYPES.has(p.ProviderType));
|
|
60
|
+
if (nonSocial.length > 0 || saml.length > 0) {
|
|
61
|
+
findings.push({
|
|
62
|
+
id: 'auth-providers-inventory',
|
|
63
|
+
category: this.category,
|
|
64
|
+
riskLevel: 'INFO',
|
|
65
|
+
title: `${nonSocial.length} other Auth Provider(s) and ${saml.length} SAML SSO config(s) configured`,
|
|
66
|
+
detail: 'These external identity paths let users sign in without a Salesforce password. Each SAML config and enterprise auth provider should be a known, trusted IdP with certificate validation and no stale/duplicate entries.',
|
|
67
|
+
remediation: 'Review each SAML SSO config (Issuer, signing certificate, and that "Just-in-time provisioning" creates least-privilege users) and each auth provider. Remove any that are unused or unrecognised.',
|
|
68
|
+
affectedItems: [
|
|
69
|
+
...nonSocial.map((p) => ({ label: `Auth Provider: ${p.FriendlyName ?? p.DeveloperName} (${p.ProviderType})`, url: `${baseUrl}/lightning/setup/AuthProviders/home` })),
|
|
70
|
+
...saml.map((s) => ({ label: `SAML: ${s.DeveloperName}${s.Issuer ? ` (${s.Issuer})` : ''}`, url: `${baseUrl}/lightning/setup/SingleSignOn/home` })),
|
|
71
|
+
].slice(0, 40),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (providers.length === 0 && saml.length === 0) {
|
|
75
|
+
findings.push({
|
|
76
|
+
id: 'auth-providers-none',
|
|
77
|
+
category: this.category,
|
|
78
|
+
riskLevel: 'LOW',
|
|
79
|
+
passed: true,
|
|
80
|
+
title: 'No external Auth Providers or SAML SSO configured',
|
|
81
|
+
detail: 'No AuthProvider or SamlSsoConfig records exist, so there is no external federation surface to review.',
|
|
82
|
+
remediation: 'If external identity is added later, restrict just-in-time provisioning to least-privilege profiles and validate the IdP certificate.',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return { findings };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=AuthProvidersCheck.js.map
|
|
@@ -59,7 +59,7 @@ export class CertificateExpiryCheck {
|
|
|
59
59
|
return 'no expiry date';
|
|
60
60
|
const daysLeft = Math.ceil((new Date(cert.ExpirationDate).getTime() - now) / 86_400_000);
|
|
61
61
|
const expiryStr = new Date(cert.ExpirationDate).toISOString().split('T')[0];
|
|
62
|
-
return `${daysLeft} day(s) until expiry
|
|
62
|
+
return `${daysLeft} day(s) until expiry: expires ${expiryStr}`;
|
|
63
63
|
}
|
|
64
64
|
if (critical.length > 0) {
|
|
65
65
|
findings.push({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Audits classic Force.com Sites (Visualforce sites), a public unauthenticated
|
|
5
|
+
* surface that runs in PARALLEL to Experience Cloud and is missed by the
|
|
6
|
+
* Network-based guest checks. Each active classic site has its own guest user
|
|
7
|
+
* whose profile can expose Apex, Visualforce pages, and objects to anonymous
|
|
8
|
+
* visitors (the vector behind classic `/apex/…` public pages).
|
|
9
|
+
*/
|
|
10
|
+
export declare class ClassicSitesCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "classic-sites";
|
|
12
|
+
readonly name = "Classic Force.com Sites";
|
|
13
|
+
readonly category = "Access Control";
|
|
14
|
+
readonly description = "Flags active classic (Visualforce) Force.com Sites and their guest users \u2014 an unauthenticated public surface separate from Experience Cloud";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=ClassicSitesCheck.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Classic (non-Experience-Builder) public site types. Siteforce = Experience
|
|
2
|
+
// Builder sites, which the Network-based guest checks already cover.
|
|
3
|
+
const CLASSIC_TYPES = new Set(['Visualforce', 'ChatterNetworkPicasso']);
|
|
4
|
+
/**
|
|
5
|
+
* Audits classic Force.com Sites (Visualforce sites), a public unauthenticated
|
|
6
|
+
* surface that runs in PARALLEL to Experience Cloud and is missed by the
|
|
7
|
+
* Network-based guest checks. Each active classic site has its own guest user
|
|
8
|
+
* whose profile can expose Apex, Visualforce pages, and objects to anonymous
|
|
9
|
+
* visitors (the vector behind classic `/apex/…` public pages).
|
|
10
|
+
*/
|
|
11
|
+
export class ClassicSitesCheck {
|
|
12
|
+
id = 'classic-sites';
|
|
13
|
+
name = 'Classic Force.com Sites';
|
|
14
|
+
category = 'Access Control';
|
|
15
|
+
description = 'Flags active classic (Visualforce) Force.com Sites and their guest users — an unauthenticated public surface separate from Experience Cloud';
|
|
16
|
+
async run(ctx) {
|
|
17
|
+
const findings = [];
|
|
18
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
19
|
+
let sites;
|
|
20
|
+
try {
|
|
21
|
+
sites = await ctx.soql.queryAll('SELECT Id, Name, Status, SiteType, GuestUserId, MasterLabel FROM Site');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
findings.push({
|
|
25
|
+
id: 'classic-sites-inconclusive',
|
|
26
|
+
category: this.category,
|
|
27
|
+
riskLevel: 'INFO',
|
|
28
|
+
inconclusive: true,
|
|
29
|
+
title: 'Force.com Sites could not be queried (insufficient access)',
|
|
30
|
+
detail: 'The Site object was not accessible, so classic public sites could not be evaluated. This may mean Sites is not enabled.',
|
|
31
|
+
remediation: 'Grant the audit user View Setup and Configuration and re-run. If Sites is not used, this check is not applicable.',
|
|
32
|
+
});
|
|
33
|
+
return { findings };
|
|
34
|
+
}
|
|
35
|
+
const classicActive = sites.filter((s) => CLASSIC_TYPES.has(s.SiteType) && s.Status === 'Active');
|
|
36
|
+
if (classicActive.length > 0) {
|
|
37
|
+
const withGuest = classicActive.filter((s) => s.GuestUserId);
|
|
38
|
+
findings.push({
|
|
39
|
+
id: 'classic-sites-active',
|
|
40
|
+
category: this.category,
|
|
41
|
+
riskLevel: 'HIGH',
|
|
42
|
+
title: `${classicActive.length} active classic (Visualforce) Force.com site(s)`,
|
|
43
|
+
detail: `Classic Force.com Sites serve pages to unauthenticated visitors through a dedicated guest user, separate from Experience Cloud. ${withGuest.length} of these have a guest user whose profile governs anonymous access to Apex, Visualforce pages, and objects. This surface is easy to forget because the guest/Experience-Cloud checks only inspect Experience (Network) sites.`,
|
|
44
|
+
remediation: 'For each active classic site, review the guest user profile (object/field permissions, guest-executable Apex, exposed VF pages) exactly as for Experience Cloud guests. Deactivate sites that are no longer needed. Re-run guest-object-exposure/guest-executable-apex to grade the exposure of these guest users.',
|
|
45
|
+
affectedItems: classicActive.slice(0, 30).map((s) => ({
|
|
46
|
+
label: `${s.MasterLabel ?? s.Name} (${s.SiteType}${s.GuestUserId ? ', guest user present' : ', no guest user'})`,
|
|
47
|
+
url: `${baseUrl}/lightning/setup/CustomDomains/home`,
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
findings.push({
|
|
53
|
+
id: 'classic-sites-ok',
|
|
54
|
+
category: this.category,
|
|
55
|
+
riskLevel: 'LOW',
|
|
56
|
+
passed: true,
|
|
57
|
+
title: 'No active classic Force.com sites',
|
|
58
|
+
detail: 'No active Visualforce Force.com Sites were found, so there is no classic unauthenticated site surface.',
|
|
59
|
+
remediation: 'If a classic site is activated later, review its guest user profile before it goes live.',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return { findings };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=ClassicSitesCheck.js.map
|
|
@@ -4,7 +4,7 @@ export declare class ConnectedAppInactivityCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "connected-app-inactivity";
|
|
5
5
|
readonly name = "Inactive Connected Apps";
|
|
6
6
|
readonly category = "App Security";
|
|
7
|
-
readonly description = "Flags connected apps with no OAuth logins in the past 90 days
|
|
7
|
+
readonly description = "Flags connected apps with no OAuth logins in the past 90 days: stale apps are unused attack surface";
|
|
8
8
|
readonly dependsOnCache: readonly ["connectedAppNames"];
|
|
9
9
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
10
10
|
}
|
|
@@ -2,7 +2,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
2
2
|
id = 'connected-app-inactivity';
|
|
3
3
|
name = 'Inactive Connected Apps';
|
|
4
4
|
category = 'App Security';
|
|
5
|
-
description = 'Flags connected apps with no OAuth logins in the past 90 days
|
|
5
|
+
description = 'Flags connected apps with no OAuth logins in the past 90 days: stale apps are unused attack surface';
|
|
6
6
|
dependsOnCache = ['connectedAppNames'];
|
|
7
7
|
async run(ctx) {
|
|
8
8
|
const findings = [];
|
|
@@ -41,7 +41,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
41
41
|
category: this.category,
|
|
42
42
|
riskLevel: 'INFO',
|
|
43
43
|
inconclusive: true,
|
|
44
|
-
title: 'Connected app activity could not be determined
|
|
44
|
+
title: 'Connected app activity could not be determined: LoginHistory not accessible',
|
|
45
45
|
detail: 'LoginHistory was not accessible. Connected app inactivity cannot be computed without login history.',
|
|
46
46
|
remediation: 'Grant LoginHistory read access to the audit user.',
|
|
47
47
|
});
|
|
@@ -56,12 +56,12 @@ export class ConnectedAppInactivityCheck {
|
|
|
56
56
|
category: this.category,
|
|
57
57
|
riskLevel: inactiveApps.length > 5 ? 'MEDIUM' : 'LOW',
|
|
58
58
|
title: `${inactiveApps.length} connected app(s) have had no OAuth logins in 90 days`,
|
|
59
|
-
detail: `${inactiveApps.length} of ${connectedAppNames.length} connected apps show no OAuth login activity in the past 90 days. Inactive apps still hold valid OAuth credentials and expand the attack surface
|
|
59
|
+
detail: `${inactiveApps.length} of ${connectedAppNames.length} connected apps show no OAuth login activity in the past 90 days. Inactive apps still hold valid OAuth credentials and expand the attack surface. A compromised or leaked client secret for an inactive app can be used to obtain access tokens without triggering activity alerts.`,
|
|
60
60
|
remediation: 'Review each inactive connected app. If the integration is no longer in use, delete or disable the app to revoke its OAuth credentials. Ensure active integrations are documented with an owner.',
|
|
61
61
|
affectedItems: inactiveApps.map((name) => ({
|
|
62
62
|
label: name,
|
|
63
63
|
url: setupUrl,
|
|
64
|
-
note: 'No OAuth logins in 90 days
|
|
64
|
+
note: 'No OAuth logins in 90 days: verify if still needed and delete if not',
|
|
65
65
|
})),
|
|
66
66
|
});
|
|
67
67
|
}
|
|
@@ -76,7 +76,7 @@ export class ConnectedAppInactivityCheck {
|
|
|
76
76
|
affectedItems: activeApps.map((name) => ({
|
|
77
77
|
label: name,
|
|
78
78
|
url: setupUrl,
|
|
79
|
-
note: 'Active
|
|
79
|
+
note: 'Active: verify documented owner and justification',
|
|
80
80
|
})),
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -4,7 +4,7 @@ export declare class ConnectedAppScopeCheck implements SecurityCheck {
|
|
|
4
4
|
readonly id = "connected-app-scope";
|
|
5
5
|
readonly name = "Connected App OAuth Scopes & Token Policy";
|
|
6
6
|
readonly category = "App Security";
|
|
7
|
-
readonly description = "Flags connected apps granting Full OAuth scope or using infinite refresh token policies
|
|
7
|
+
readonly description = "Flags connected apps granting Full OAuth scope or using infinite refresh token policies: both expand the blast radius of a compromised token";
|
|
8
8
|
run(ctx: AuditContext): Promise<CheckResult>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=ConnectedAppScopeCheck.d.ts.map
|