@cclabsnz/sf-audit 1.6.1 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -5
- package/lib/apps/analyzeApps.d.ts +1 -1
- package/lib/apps/appResolver.d.ts +1 -1
- package/lib/apps/grantedAccess.d.ts +1 -1
- package/lib/chains/AttackChain.d.ts +1 -1
- package/lib/chains/namedChains.d.ts +1 -1
- package/lib/checks/CheckEngine.d.ts +1 -1
- package/lib/checks/SecurityCheck.d.ts +3 -3
- package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +1 -1
- package/lib/checks/impl/AgentActionSurfaceCheck.js +1 -1
- package/lib/checks/impl/AgentChannelExposureCheck.d.ts +1 -1
- package/lib/checks/impl/AgentInventoryCheck.d.ts +1 -1
- package/lib/checks/impl/AgentInventoryCheck.js +1 -1
- package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +1 -1
- package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +1 -1
- package/lib/checks/impl/AnonymousApexAuditCheck.d.ts +1 -1
- package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
- package/lib/checks/impl/ApexLoggingCheck.d.ts +1 -1
- package/lib/checks/impl/ApexRestEndpointCheck.d.ts +1 -1
- package/lib/checks/impl/ApexSharingCheck.d.ts +1 -1
- package/lib/checks/impl/ApexSharingCheck.js +3 -2
- package/lib/checks/impl/ApiClientPermissionCheck.d.ts +1 -1
- package/lib/checks/impl/ApiLimitsCheck.d.ts +1 -1
- package/lib/checks/impl/AuditTrailCheck.d.ts +1 -1
- package/lib/checks/impl/AuthProvidersCheck.d.ts +1 -1
- package/lib/checks/impl/CertificateExpiryCheck.d.ts +1 -1
- package/lib/checks/impl/ClassicSitesCheck.d.ts +1 -1
- package/lib/checks/impl/CodeSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/CodeSecurityCheck.js +5 -5
- package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
- package/lib/checks/impl/ConnectedAppsCheck.d.ts +1 -1
- package/lib/checks/impl/ContentLinksCheck.d.ts +1 -1
- package/lib/checks/impl/CorsAllowlistCheck.d.ts +1 -1
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -1
- package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
- package/lib/checks/impl/CustomSettingsCheck.d.ts +1 -1
- package/lib/checks/impl/DataClassificationCheck.d.ts +1 -1
- package/lib/checks/impl/DataExportAccessCheck.d.ts +1 -1
- package/lib/checks/impl/DebugLogAccessCheck.d.ts +1 -1
- package/lib/checks/impl/DeploymentIdentityCheck.d.ts +1 -1
- package/lib/checks/impl/EmailSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/EncryptionCoverageCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
- package/lib/checks/impl/EnhancedDomainsCheck.js +2 -2
- package/lib/checks/impl/EscalationPermsCheck.d.ts +1 -1
- package/lib/checks/impl/EventMonitoringCheck.d.ts +1 -1
- package/lib/checks/impl/EventMonitoringCheck.js +1 -1
- package/lib/checks/impl/ExperienceCloudSiteCheck.d.ts +1 -1
- package/lib/checks/impl/ExperienceCspCheck.d.ts +1 -1
- package/lib/checks/impl/ExternalCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/FailedLoginCheck.d.ts +1 -1
- package/lib/checks/impl/FieldHistoryTrackingCheck.d.ts +1 -1
- package/lib/checks/impl/FieldLevelSecurityCheck.d.ts +1 -1
- package/lib/checks/impl/FlowsWithoutSharingCheck.d.ts +1 -1
- package/lib/checks/impl/FlowsWithoutSharingCheck.js +10 -9
- package/lib/checks/impl/GuestApiAccessCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
- package/lib/checks/impl/GuestExecutableApexCheck.js +4 -3
- package/lib/checks/impl/GuestObjectExposureCheck.d.ts +1 -1
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +1 -1
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +1 -1
- package/lib/checks/impl/GuestTrafficAnomalyCheck.js +1 -1
- package/lib/checks/impl/GuestUserAccessCheck.d.ts +1 -1
- package/lib/checks/impl/HardcodedCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/HardcodedCredentialsCheck.js +8 -1
- package/lib/checks/impl/HealthCheckCheck.d.ts +1 -1
- package/lib/checks/impl/HighAssuranceSessionCheck.d.ts +1 -1
- package/lib/checks/impl/InactiveUsersCheck.d.ts +1 -1
- package/lib/checks/impl/InstalledPackagesCheck.d.ts +1 -1
- package/lib/checks/impl/IntegrationUsersCheck.d.ts +1 -1
- package/lib/checks/impl/InternalUserMfaCheck.d.ts +1 -1
- package/lib/checks/impl/IpRestrictionsCheck.d.ts +1 -1
- package/lib/checks/impl/LegacyApiVersionCheck.d.ts +1 -1
- package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/LoginAnomalyCheck.d.ts +1 -1
- package/lib/checks/impl/LoginSessionCheck.d.ts +1 -1
- package/lib/checks/impl/MfaEnforcementCheck.d.ts +1 -1
- package/lib/checks/impl/MfaMethodStrengthCheck.d.ts +1 -1
- package/lib/checks/impl/MfaRegistrationCheck.d.ts +1 -1
- package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/NamedCredentialsCheck.d.ts +1 -1
- package/lib/checks/impl/NamedCredentialsCheck.js +7 -6
- package/lib/checks/impl/OutboundMessagesCheck.d.ts +1 -1
- package/lib/checks/impl/PasswordSessionPolicyCheck.d.ts +2 -2
- package/lib/checks/impl/PermissionsCheck.d.ts +1 -1
- package/lib/checks/impl/PrivilegedAccessCheck.d.ts +1 -1
- package/lib/checks/impl/PublicContentExposureCheck.d.ts +1 -1
- package/lib/checks/impl/PublicGroupSharingCheck.d.ts +1 -1
- package/lib/checks/impl/ReleaseUpdatesCheck.d.ts +1 -1
- package/lib/checks/impl/RemoteSitesCheck.d.ts +1 -1
- package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
- package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +1 -1
- package/lib/checks/impl/ScheduledApexCheck.d.ts +1 -1
- package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +1 -1
- package/lib/checks/impl/SessionHardeningCheck.d.ts +1 -1
- package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
- package/lib/checks/impl/SiemIntegrationCheck.d.ts +1 -1
- package/lib/checks/impl/SsoEnforcementCheck.d.ts +1 -1
- package/lib/checks/impl/StandardProfilesCheck.d.ts +1 -1
- package/lib/checks/impl/ThreatDetectionCheck.d.ts +1 -1
- package/lib/checks/impl/TransactionSecurityPolicyCheck.d.ts +1 -1
- package/lib/checks/impl/TrustedIPRangesCheck.d.ts +1 -1
- package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +1 -1
- package/lib/checks/impl/UsersAndAdminsCheck.d.ts +1 -1
- package/lib/checks/impl/VisualforceXssCheck.d.ts +1 -1
- package/lib/commands/audit/events/pull.d.ts +1 -1
- package/lib/commands/audit/events/pull.js +3 -3
- package/lib/commands/audit/security.js +3 -1
- package/lib/findings/AuditResult.d.ts +1 -1
- package/lib/findings/Finding.d.ts +1 -1
- package/lib/findings/ScoringConfig.d.ts +9 -217
- package/lib/findings/scoring.d.ts +2 -2
- package/lib/findings/scoring.js +1 -1
- package/lib/history/AuditDiff.d.ts +1 -1
- package/lib/history/metricMeta.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/lib/wire.d.ts +6 -6
- package/lib/lib/wire.js +4 -4
- package/lib/renderers/ClientReportRenderer.d.ts +1 -1
- package/lib/renderers/ClientReportRenderer.js +6 -3
- package/lib/renderers/HistoryRenderer.js +2 -1
- package/lib/renderers/HtmlRenderer.js +3 -4
- package/lib/renderers/MarkdownRenderer.js +1 -1
- package/lib/renderers/chartAsset.d.ts +12 -0
- package/lib/renderers/chartAsset.js +25 -0
- package/package.json +20 -18
- package/lib/api/ApiError.d.ts +0 -6
- package/lib/api/ApiError.js +0 -6
- package/lib/api/MetadataClient.d.ts +0 -4
- package/lib/api/MetadataClient.js +0 -2
- package/lib/api/MetadataClientImpl.d.ts +0 -8
- package/lib/api/MetadataClientImpl.js +0 -22
- package/lib/api/RestClient.d.ts +0 -6
- package/lib/api/RestClient.js +0 -2
- package/lib/api/RestClientImpl.d.ts +0 -10
- package/lib/api/RestClientImpl.js +0 -45
- package/lib/api/SoqlClient.d.ts +0 -10
- package/lib/api/SoqlClient.js +0 -2
- package/lib/api/SoqlClientImpl.d.ts +0 -9
- package/lib/api/SoqlClientImpl.js +0 -19
- package/lib/api/ToolingClient.d.ts +0 -5
- package/lib/api/ToolingClient.js +0 -2
- package/lib/api/ToolingClientImpl.d.ts +0 -10
- package/lib/api/ToolingClientImpl.js +0 -29
- package/lib/api/index.d.ts +0 -9
- package/lib/api/index.js +0 -5
- package/lib/checks/eventLogAccess.d.ts +0 -14
- package/lib/checks/eventLogAccess.js +0 -33
- package/lib/context/AuditCache.d.ts +0 -78
- package/lib/context/AuditCache.js +0 -2
- package/lib/context/AuditContext.d.ts +0 -19
- package/lib/context/AuditContext.js +0 -2
- package/lib/context/OrgInfo.d.ts +0 -9
- package/lib/context/OrgInfo.js +0 -2
- package/lib/context/OrgMetrics.d.ts +0 -20
- package/lib/context/OrgMetrics.js +0 -20
- package/lib/events/EventBaselineStore.d.ts +0 -16
- package/lib/events/EventBaselineStore.js +0 -55
- package/lib/events/eventLogQuery.d.ts +0 -21
- package/lib/events/eventLogQuery.js +0 -34
- package/lib/events/pullEventLogs.d.ts +0 -51
- package/lib/events/pullEventLogs.js +0 -79
- package/lib/findings/RiskLevel.d.ts +0 -3
- package/lib/findings/RiskLevel.js +0 -2
- package/lib/renderers/html-utils.d.ts +0 -2
- package/lib/renderers/html-utils.js +0 -8
- package/lib/report/branding.d.ts +0 -18
- package/lib/report/branding.js +0 -19
- package/lib/report/fonts.d.ts +0 -2
- package/lib/report/fonts.js +0 -22
- package/src/assets/fonts/dm-sans-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-sans-normal-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-italic-latin.woff2 +0 -0
- package/src/assets/fonts/dm-serif-display-normal-latin.woff2 +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlowRepository } from '@cclabsnz/sf-core';
|
|
1
2
|
export class FlowsWithoutSharingCheck {
|
|
2
3
|
id = 'flows-without-sharing';
|
|
3
4
|
name = 'Flows Without Sharing Context';
|
|
@@ -6,12 +7,12 @@ export class FlowsWithoutSharingCheck {
|
|
|
6
7
|
async run(ctx) {
|
|
7
8
|
const findings = [];
|
|
8
9
|
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
9
|
-
const flows = await ctx.tooling.
|
|
10
|
+
const flows = await new FlowRepository(ctx.soql, ctx.tooling).listActiveVersions();
|
|
10
11
|
const total = flows.length;
|
|
11
|
-
const autolaunchedWithoutSharing = flows.filter((f) => f.
|
|
12
|
-
(f.
|
|
13
|
-
const screenWithoutSharing = flows.filter((f) => f.
|
|
14
|
-
(f.
|
|
12
|
+
const autolaunchedWithoutSharing = flows.filter((f) => f.processType === 'AutoLaunchedFlow' &&
|
|
13
|
+
(f.runInMode === 'DefaultMode' || f.runInMode === null));
|
|
14
|
+
const screenWithoutSharing = flows.filter((f) => f.processType === 'Flow' &&
|
|
15
|
+
(f.runInMode === 'DefaultMode' || f.runInMode === null));
|
|
15
16
|
if (autolaunchedWithoutSharing.length > 0) {
|
|
16
17
|
const count = autolaunchedWithoutSharing.length;
|
|
17
18
|
findings.push({
|
|
@@ -20,8 +21,8 @@ export class FlowsWithoutSharingCheck {
|
|
|
20
21
|
riskLevel: 'HIGH',
|
|
21
22
|
title: `${count} autolaunched flow(s) run without user sharing context`,
|
|
22
23
|
affectedItems: autolaunchedWithoutSharing.map((f) => ({
|
|
23
|
-
label: f.
|
|
24
|
-
url: `${baseUrl}/builder_platform_interaction/flowBuilder.app?flowId=${f.
|
|
24
|
+
label: f.masterLabel,
|
|
25
|
+
url: `${baseUrl}/builder_platform_interaction/flowBuilder.app?flowId=${f.id}`,
|
|
25
26
|
note: 'Set "Run Flow As" to "User" or document why system context is required',
|
|
26
27
|
})),
|
|
27
28
|
detail: "Autolaunched flows running in Default Mode execute with system-level data access, ignoring the triggering user's record visibility.",
|
|
@@ -36,8 +37,8 @@ export class FlowsWithoutSharingCheck {
|
|
|
36
37
|
riskLevel: 'MEDIUM',
|
|
37
38
|
title: `${count} screen flow(s) run without user sharing context`,
|
|
38
39
|
affectedItems: screenWithoutSharing.map((f) => ({
|
|
39
|
-
label: f.
|
|
40
|
-
url: `${baseUrl}/builder_platform_interaction/flowBuilder.app?flowId=${f.
|
|
40
|
+
label: f.masterLabel,
|
|
41
|
+
url: `${baseUrl}/builder_platform_interaction/flowBuilder.app?flowId=${f.id}`,
|
|
41
42
|
note: 'Review and set "Run Flow As" to "User" where appropriate',
|
|
42
43
|
})),
|
|
43
44
|
detail: "Screen flows in Default Mode may allow users to view or modify records they wouldn't normally have access to.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Flags guest (unauthenticated) users whose profile/permission-sets grant API or
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class GuestExecutableApexCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "guest-executable-apex";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApexRepository } from '@cclabsnz/sf-core';
|
|
1
2
|
const WITHOUT_SHARING = /\bwithout\s+sharing\b/i;
|
|
2
3
|
const WITH_SHARING = /\bwith\s+sharing\b/i;
|
|
3
4
|
export class GuestExecutableApexCheck {
|
|
@@ -40,9 +41,9 @@ export class GuestExecutableApexCheck {
|
|
|
40
41
|
});
|
|
41
42
|
return { findings };
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const nameById = new
|
|
44
|
+
// Ids are validated inside the repository: one malformed value in an IN(...) clause
|
|
45
|
+
// fails the whole query with "invalid ID field", losing every good row with it.
|
|
46
|
+
const nameById = await new ApexRepository(ctx.tooling).namesByIds(classIds);
|
|
46
47
|
const bodies = ctx.cache.apexBodies ?? [];
|
|
47
48
|
const bodyByName = new Map(bodies.map((b) => [b.name, b.body]));
|
|
48
49
|
const unprotected = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Detects every object an unauthenticated guest can READ IN BULK. Unlike
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Verifies the PREVENTIVE guardrail that stops the guest-ownership-defeats-OWD
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Flags two Experience Cloud Network settings that widen the unauthenticated
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class GuestTrafficAnomalyCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "guest-traffic-anomaly";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { classifyEventLogAccessError } from '
|
|
1
|
+
import { classifyEventLogAccessError } from '@cclabsnz/sf-core';
|
|
2
2
|
// EventLogFile types that carry unauthenticated guest request traffic. Sites is
|
|
3
3
|
// the primary guest-page channel; AuraRequest and GraphQlQueryExecution are the
|
|
4
4
|
// data-access vectors abused for recon and bulk read.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class GuestUserAccessCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "guest-user-access";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class HardcodedCredentialsCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "hardcoded-credentials";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApexRepository } from '@cclabsnz/sf-core';
|
|
1
2
|
const HIGH_RISK_PATTERNS = [
|
|
2
3
|
/Bearer\s+[A-Za-z0-9\-_.~+/]{20,}=*/gi, // Bearer tokens (min length to avoid test stubs)
|
|
3
4
|
/Basic\s+[A-Za-z0-9+/]{20,}=*/gi, // Basic auth (min length)
|
|
@@ -31,7 +32,13 @@ export class HardcodedCredentialsCheck {
|
|
|
31
32
|
const findings = [];
|
|
32
33
|
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
33
34
|
const apexClassesUrl = `${baseUrl}/lightning/setup/ApexClasses/home`;
|
|
34
|
-
const records = await ctx.tooling.
|
|
35
|
+
const records = (await new ApexRepository(ctx.tooling).listClasses({ excludeManaged: true })).map((c) => ({
|
|
36
|
+
Id: c.name,
|
|
37
|
+
Name: c.name,
|
|
38
|
+
Body: c.body ?? '',
|
|
39
|
+
LengthWithoutComments: (c.body ?? '').length,
|
|
40
|
+
NamespacePrefix: c.namespace,
|
|
41
|
+
}));
|
|
35
42
|
// Cache apex bodies for downstream checks — exclude test classes and filter null bodies
|
|
36
43
|
const nonTestRecords = records.filter((r) => !IS_TEST_CLASS.test(r.Body ?? ''));
|
|
37
44
|
ctx.cache.apexBodies = nonTestRecords.map((r) => ({ name: r.Name, body: r.Body ?? '' }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class HealthCheckCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "health-check";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class HighAssuranceSessionCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "high-assurance-session";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class InactiveUsersCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "inactive-users";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class InstalledPackagesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "installed-packages";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class IntegrationUsersCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "integration-users";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class InternalUserMfaCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "internal-user-mfa";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class IpRestrictionsCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "ip-restrictions";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class LegacyApiVersionCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "legacy-api-version";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Surfaces impersonation / delegated-administration paths that bypass a user's
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Complements `failed-login-detection` (which only sees failures) by looking at
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class LoginSessionCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "login-session";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class MfaEnforcementCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "mfa-enforcement";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class MfaMethodStrengthCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "mfa-method-strength";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class MfaRegistrationCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "mfa-registration";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class MyDomainLoginPolicyCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "my-domain-login-policy";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class NamedCredentialsCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "named-credentials";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApexRepository } from '@cclabsnz/sf-core';
|
|
1
2
|
export class NamedCredentialsCheck {
|
|
2
3
|
id = 'named-credentials';
|
|
3
4
|
name = 'Named Credentials';
|
|
@@ -12,7 +13,7 @@ export class NamedCredentialsCheck {
|
|
|
12
13
|
const records = await ctx.tooling.query('SELECT Id, MasterLabel, DeveloperName, Endpoint, PrincipalType FROM NamedCredential');
|
|
13
14
|
const count = records.length;
|
|
14
15
|
// Cache the endpoints for use by HardcodedCredentialsCheck
|
|
15
|
-
ctx.cache.namedCredentialEndpoints = records.map((r) => r.Endpoint);
|
|
16
|
+
ctx.cache.namedCredentialEndpoints = records.map((r) => r.Endpoint).filter((e) => !!e);
|
|
16
17
|
if (count === 0) {
|
|
17
18
|
findings.push({
|
|
18
19
|
id: 'named-credentials-none',
|
|
@@ -29,8 +30,8 @@ export class NamedCredentialsCheck {
|
|
|
29
30
|
let apexBodies = ctx.cache.apexBodies ?? [];
|
|
30
31
|
if (apexBodies.length === 0) {
|
|
31
32
|
try {
|
|
32
|
-
const apexRecords = await ctx.tooling.
|
|
33
|
-
apexBodies = apexRecords.map((r) => ({ name: r.
|
|
33
|
+
const apexRecords = await new ApexRepository(ctx.tooling).listClasses({ excludeManaged: true });
|
|
34
|
+
apexBodies = apexRecords.map((r) => ({ name: r.name, body: r.body ?? '' }));
|
|
34
35
|
}
|
|
35
36
|
catch {
|
|
36
37
|
// If we can't scan Apex, emit inventory only
|
|
@@ -44,7 +45,7 @@ export class NamedCredentialsCheck {
|
|
|
44
45
|
affectedItems: records.map((r) => ({
|
|
45
46
|
label: r.MasterLabel,
|
|
46
47
|
url: setupUrl,
|
|
47
|
-
note: r.Endpoint,
|
|
48
|
+
note: r.Endpoint ?? '(no endpoint — External Credential)',
|
|
48
49
|
})),
|
|
49
50
|
});
|
|
50
51
|
return { findings, metrics: { namedCredentialsCount: count, unusedNamedCredentialsCount: 0 } };
|
|
@@ -69,7 +70,7 @@ export class NamedCredentialsCheck {
|
|
|
69
70
|
affectedItems: records.map((r) => ({
|
|
70
71
|
label: r.MasterLabel,
|
|
71
72
|
url: setupUrl,
|
|
72
|
-
note: r.Endpoint,
|
|
73
|
+
note: r.Endpoint ?? '(no endpoint — External Credential)',
|
|
73
74
|
})),
|
|
74
75
|
});
|
|
75
76
|
// Flag unused credentials
|
|
@@ -89,7 +90,7 @@ export class NamedCredentialsCheck {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
// SBS-INT-003: flag plaintext HTTP endpoints — credentials transmitted unencrypted in transit.
|
|
92
|
-
const httpEndpoints = records.filter((r) => r.Endpoint
|
|
93
|
+
const httpEndpoints = records.filter((r) => r.Endpoint?.startsWith('http://') ?? false);
|
|
93
94
|
if (httpEndpoints.length > 0) {
|
|
94
95
|
findings.push({
|
|
95
96
|
id: 'named-credentials-http-endpoint',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class OutboundMessagesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "outbound-messages";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
-
import type { AuditCache } from '
|
|
3
|
+
import type { AuditCache } from '@cclabsnz/sf-core';
|
|
4
4
|
export declare class PasswordSessionPolicyCheck implements SecurityCheck {
|
|
5
5
|
readonly id = "password-session-policy";
|
|
6
6
|
readonly name = "Password and Session Policy";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class PermissionsCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "permissions";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class PrivilegedAccessCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "privileged-access";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class PublicContentExposureCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "public-content-exposure";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class PublicGroupSharingCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "public-group-sharing";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class ReleaseUpdatesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "release-updates";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class RemoteSitesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "remote-sites";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class ReportFolderAccessCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "report-folder-access";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Advisory for sandboxes: production data copied into a sandbox and left unmasked
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class ScheduledApexCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "scheduled-apex";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class SeparationOfDutiesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "separation-of-duties";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Re-slices the Health Check risk set (populated by HealthCheckCheck, so no extra
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class SharingModelCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "sharing-model";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class SiemIntegrationCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "siem-integration";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class SsoEnforcementCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "sso-enforcement";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class StandardProfilesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "standard-profiles";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
/**
|
|
4
4
|
* Verifies that Threat Detection event storage (especially Guest User Anomaly) is
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class TransactionSecurityPolicyCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "transaction-security-policy";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class TrustedIPRangesCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "trusted-ip-ranges";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class TrustedUrlHygieneCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "trusted-url-hygiene";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class UsersAndAdminsCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "users-and-admins";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuditContext } from '
|
|
1
|
+
import type { AuditContext } from '@cclabsnz/sf-core';
|
|
2
2
|
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
3
|
export declare class VisualforceXssCheck implements SecurityCheck {
|
|
4
4
|
readonly id = "visualforce-xss";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { type EventsPullResult } from '
|
|
2
|
+
import { type EventsPullResult } from '@cclabsnz/sf-core';
|
|
3
3
|
export default class AuditEventsPullCommand extends SfCommand<EventsPullResult> {
|
|
4
4
|
static summary: string;
|
|
5
5
|
static description: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/commands/audit/events/pull.ts
|
|
2
2
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
3
3
|
import { buildAuditContext, resolveOrgInfo } from '../../../lib/wire.js';
|
|
4
|
-
import { EventBaselineStore } from '
|
|
5
|
-
import { pullEventLogs } from '
|
|
6
|
-
import { sanitizeTypes } from '
|
|
4
|
+
import { EventBaselineStore } from '@cclabsnz/sf-core';
|
|
5
|
+
import { pullEventLogs } from '@cclabsnz/sf-core';
|
|
6
|
+
import { sanitizeTypes } from '@cclabsnz/sf-core';
|
|
7
7
|
export default class AuditEventsPullCommand extends SfCommand {
|
|
8
8
|
static summary = 'Capture free EventLogFile daily logs to local disk';
|
|
9
9
|
static description = 'Downloads the org\'s free (Daily-interval) EventLogFile CSV logs to ~/.sf/event-baseline/{orgId} so they ' +
|
|
@@ -7,7 +7,7 @@ import { JsonRenderer } from '../../renderers/JsonRenderer.js';
|
|
|
7
7
|
import { HtmlRenderer } from '../../renderers/HtmlRenderer.js';
|
|
8
8
|
import { MarkdownRenderer } from '../../renderers/MarkdownRenderer.js';
|
|
9
9
|
import { ClientReportRenderer } from '../../renderers/ClientReportRenderer.js';
|
|
10
|
-
import { resolveBranding } from '
|
|
10
|
+
import { resolveBranding } from '@cclabsnz/sf-core';
|
|
11
11
|
import { resolveFrameworks } from '../../compliance/resolve.js';
|
|
12
12
|
import { buildAuditContext, resolveOrgInfo } from '../../lib/wire.js';
|
|
13
13
|
import { loadScoringConfig } from '../../findings/loadScoringConfig.js';
|
|
@@ -107,6 +107,8 @@ export default class SecurityAuditCommand extends SfCommand {
|
|
|
107
107
|
store.archive(result);
|
|
108
108
|
this.log('');
|
|
109
109
|
this.printSummary(result);
|
|
110
|
+
this.log('');
|
|
111
|
+
this.log(' Deep dives: https://softwareinsights.dev · Remediation help: https://cloudcounsel.co.nz');
|
|
110
112
|
if (flags['fail-on']) {
|
|
111
113
|
this.handleFailOn(result, flags['fail-on']);
|
|
112
114
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Finding } from './Finding.js';
|
|
2
|
-
import type { OrgMetrics } from '
|
|
2
|
+
import type { OrgMetrics } from '@cclabsnz/sf-core';
|
|
3
3
|
import type { AttackChain } from '../chains/AttackChain.js';
|
|
4
4
|
export interface AuditResult {
|
|
5
5
|
generatedAt: Date;
|