@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.
Files changed (142) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +135 -31
  3. package/lib/api/MetadataClient.d.ts +4 -0
  4. package/lib/api/MetadataClient.js +2 -0
  5. package/lib/api/MetadataClientImpl.d.ts +8 -0
  6. package/lib/api/MetadataClientImpl.js +22 -0
  7. package/lib/api/RestClient.d.ts +1 -0
  8. package/lib/api/RestClientImpl.d.ts +1 -0
  9. package/lib/api/RestClientImpl.js +6 -0
  10. package/lib/chains/CapabilityRegistry.js +19 -0
  11. package/lib/chains/namedChains.js +26 -4
  12. package/lib/checks/eventLogAccess.d.ts +14 -0
  13. package/lib/checks/eventLogAccess.js +33 -0
  14. package/lib/checks/impl/AnonymousApexAuditCheck.js +5 -5
  15. package/lib/checks/impl/ApexCrudFLSCheck.d.ts +1 -1
  16. package/lib/checks/impl/ApexCrudFLSCheck.js +4 -4
  17. package/lib/checks/impl/ApexLoggingCheck.js +10 -10
  18. package/lib/checks/impl/ApexRestEndpointCheck.js +5 -5
  19. package/lib/checks/impl/ApexSharingCheck.js +3 -3
  20. package/lib/checks/impl/ApiClientPermissionCheck.js +2 -2
  21. package/lib/checks/impl/AuthProvidersCheck.d.ts +17 -0
  22. package/lib/checks/impl/AuthProvidersCheck.js +88 -0
  23. package/lib/checks/impl/CertificateExpiryCheck.js +1 -1
  24. package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
  25. package/lib/checks/impl/ClassicSitesCheck.js +65 -0
  26. package/lib/checks/impl/ConnectedAppInactivityCheck.d.ts +1 -1
  27. package/lib/checks/impl/ConnectedAppInactivityCheck.js +5 -5
  28. package/lib/checks/impl/ConnectedAppScopeCheck.d.ts +1 -1
  29. package/lib/checks/impl/ConnectedAppScopeCheck.js +4 -4
  30. package/lib/checks/impl/ConnectedAppsCheck.js +2 -2
  31. package/lib/checks/impl/ContentLinksCheck.js +6 -6
  32. package/lib/checks/impl/CorsAllowlistCheck.js +3 -3
  33. package/lib/checks/impl/CustomLabelsCredentialCheck.d.ts +1 -1
  34. package/lib/checks/impl/CustomLabelsCredentialCheck.js +7 -7
  35. package/lib/checks/impl/DataClassificationCheck.js +6 -6
  36. package/lib/checks/impl/DataExportAccessCheck.d.ts +19 -0
  37. package/lib/checks/impl/DataExportAccessCheck.js +79 -0
  38. package/lib/checks/impl/DebugLogAccessCheck.js +6 -6
  39. package/lib/checks/impl/DeploymentIdentityCheck.js +8 -8
  40. package/lib/checks/impl/EmailSecurityCheck.d.ts +10 -0
  41. package/lib/checks/impl/EmailSecurityCheck.js +117 -0
  42. package/lib/checks/impl/EncryptionCoverageCheck.d.ts +19 -0
  43. package/lib/checks/impl/EncryptionCoverageCheck.js +108 -0
  44. package/lib/checks/impl/EnhancedDomainsCheck.d.ts +1 -1
  45. package/lib/checks/impl/EnhancedDomainsCheck.js +6 -6
  46. package/lib/checks/impl/EscalationPermsCheck.js +2 -2
  47. package/lib/checks/impl/EventMonitoringCheck.js +14 -11
  48. package/lib/checks/impl/ExperienceCloudSiteCheck.js +3 -3
  49. package/lib/checks/impl/ExperienceCspCheck.d.ts +18 -0
  50. package/lib/checks/impl/ExperienceCspCheck.js +57 -0
  51. package/lib/checks/impl/ExternalCredentialsCheck.d.ts +17 -0
  52. package/lib/checks/impl/ExternalCredentialsCheck.js +74 -0
  53. package/lib/checks/impl/FailedLoginCheck.js +5 -5
  54. package/lib/checks/impl/FieldHistoryTrackingCheck.js +3 -3
  55. package/lib/checks/impl/FieldLevelSecurityCheck.js +2 -2
  56. package/lib/checks/impl/GuestApiAccessCheck.d.ts +19 -0
  57. package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
  58. package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
  59. package/lib/checks/impl/GuestExecutableApexCheck.js +5 -5
  60. package/lib/checks/impl/GuestObjectExposureCheck.d.ts +44 -0
  61. package/lib/checks/impl/GuestObjectExposureCheck.js +241 -0
  62. package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +34 -0
  63. package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +120 -0
  64. package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +18 -0
  65. package/lib/checks/impl/GuestSiteOptionsCheck.js +92 -0
  66. package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +23 -0
  67. package/lib/checks/impl/GuestTrafficAnomalyCheck.js +343 -0
  68. package/lib/checks/impl/GuestUserAccessCheck.js +5 -5
  69. package/lib/checks/impl/HealthCheckCheck.js +2 -2
  70. package/lib/checks/impl/HighAssuranceSessionCheck.js +4 -4
  71. package/lib/checks/impl/InstalledPackagesCheck.js +5 -5
  72. package/lib/checks/impl/IntegrationUsersCheck.js +5 -5
  73. package/lib/checks/impl/InternalUserMfaCheck.js +2 -2
  74. package/lib/checks/impl/IpRestrictionsCheck.js +3 -3
  75. package/lib/checks/impl/LegacyApiVersionCheck.js +1 -1
  76. package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +26 -0
  77. package/lib/checks/impl/LoginAccessPolicyCheck.js +117 -0
  78. package/lib/checks/impl/LoginAnomalyCheck.d.ts +17 -0
  79. package/lib/checks/impl/LoginAnomalyCheck.js +98 -0
  80. package/lib/checks/impl/MfaEnforcementCheck.js +3 -3
  81. package/lib/checks/impl/MfaMethodStrengthCheck.js +3 -3
  82. package/lib/checks/impl/MfaRegistrationCheck.js +2 -2
  83. package/lib/checks/impl/MyDomainLoginPolicyCheck.d.ts +1 -1
  84. package/lib/checks/impl/MyDomainLoginPolicyCheck.js +9 -9
  85. package/lib/checks/impl/NamedCredentialsCheck.js +3 -3
  86. package/lib/checks/impl/OutboundMessagesCheck.d.ts +10 -0
  87. package/lib/checks/impl/OutboundMessagesCheck.js +88 -0
  88. package/lib/checks/impl/PasswordSessionPolicyCheck.js +3 -3
  89. package/lib/checks/impl/PermissionsCheck.js +3 -3
  90. package/lib/checks/impl/PrivilegedAccessCheck.d.ts +11 -0
  91. package/lib/checks/impl/PrivilegedAccessCheck.js +111 -0
  92. package/lib/checks/impl/PublicContentExposureCheck.d.ts +10 -0
  93. package/lib/checks/impl/PublicContentExposureCheck.js +98 -0
  94. package/lib/checks/impl/PublicGroupSharingCheck.js +1 -1
  95. package/lib/checks/impl/ReleaseUpdatesCheck.js +2 -2
  96. package/lib/checks/impl/RemoteSitesCheck.js +1 -1
  97. package/lib/checks/impl/ReportFolderAccessCheck.d.ts +1 -1
  98. package/lib/checks/impl/ReportFolderAccessCheck.js +4 -4
  99. package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +17 -0
  100. package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
  101. package/lib/checks/impl/ScheduledApexCheck.js +1 -1
  102. package/lib/checks/impl/SeparationOfDutiesCheck.d.ts +11 -0
  103. package/lib/checks/impl/SeparationOfDutiesCheck.js +114 -0
  104. package/lib/checks/impl/SessionHardeningCheck.d.ts +21 -0
  105. package/lib/checks/impl/SessionHardeningCheck.js +134 -0
  106. package/lib/checks/impl/SharingModelCheck.d.ts +1 -1
  107. package/lib/checks/impl/SharingModelCheck.js +8 -8
  108. package/lib/checks/impl/SiemIntegrationCheck.js +4 -4
  109. package/lib/checks/impl/SsoEnforcementCheck.js +5 -5
  110. package/lib/checks/impl/StandardProfilesCheck.js +2 -2
  111. package/lib/checks/impl/ThreatDetectionCheck.d.ts +17 -0
  112. package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
  113. package/lib/checks/impl/TransactionSecurityPolicyCheck.js +2 -2
  114. package/lib/checks/impl/TrustedIPRangesCheck.js +5 -5
  115. package/lib/checks/impl/VisualforceXssCheck.js +6 -6
  116. package/lib/checks/permCatalog.d.ts +15 -0
  117. package/lib/checks/permCatalog.js +42 -0
  118. package/lib/checks/registry.js +45 -0
  119. package/lib/commands/audit/diff.js +9 -5
  120. package/lib/commands/audit/events/pull.d.ts +17 -0
  121. package/lib/commands/audit/events/pull.js +88 -0
  122. package/lib/commands/audit/security.d.ts +4 -0
  123. package/lib/commands/audit/security.js +41 -17
  124. package/lib/compliance/mapping.js +34 -7
  125. package/lib/context/AuditCache.d.ts +12 -0
  126. package/lib/context/AuditContext.d.ts +2 -0
  127. package/lib/events/EventBaselineStore.d.ts +16 -0
  128. package/lib/events/EventBaselineStore.js +55 -0
  129. package/lib/events/eventLogQuery.d.ts +21 -0
  130. package/lib/events/eventLogQuery.js +34 -0
  131. package/lib/events/pullEventLogs.d.ts +51 -0
  132. package/lib/events/pullEventLogs.js +79 -0
  133. package/lib/findings/CheckMeta.js +24 -3
  134. package/lib/lib/wire.d.ts +2 -0
  135. package/lib/lib/wire.js +3 -0
  136. package/lib/renderers/ClientReportRenderer.js +4 -4
  137. package/lib/renderers/DiffHtmlRenderer.js +1 -1
  138. package/lib/renderers/HistoryRenderer.js +1 -1
  139. package/lib/renderers/HtmlRenderer.js +3 -3
  140. package/lib/renderers/MarkdownRenderer.js +2 -2
  141. package/messages/audit.security.md +30 -2
  142. package/package.json +14 -2
@@ -62,6 +62,30 @@ import { ReportFolderAccessCheck } from './impl/ReportFolderAccessCheck.js';
62
62
  import { EscalationPermsCheck } from './impl/EscalationPermsCheck.js';
63
63
  import { CorsAllowlistCheck } from './impl/CorsAllowlistCheck.js';
64
64
  import { GuestExecutableApexCheck } from './impl/GuestExecutableApexCheck.js';
65
+ // External-surface checks (no cache deps)
66
+ import { EmailSecurityCheck } from './impl/EmailSecurityCheck.js';
67
+ import { OutboundMessagesCheck } from './impl/OutboundMessagesCheck.js';
68
+ import { PublicContentExposureCheck } from './impl/PublicContentExposureCheck.js';
69
+ import { GuestObjectExposureCheck } from './impl/GuestObjectExposureCheck.js';
70
+ import { GuestSiteOptionsCheck } from './impl/GuestSiteOptionsCheck.js';
71
+ import { GuestRecordAccessPolicyCheck } from './impl/GuestRecordAccessPolicyCheck.js';
72
+ import { GuestTrafficAnomalyCheck } from './impl/GuestTrafficAnomalyCheck.js';
73
+ import { ThreatDetectionCheck } from './impl/ThreatDetectionCheck.js';
74
+ // Org-surface hardening checks (no cache deps)
75
+ import { LoginAccessPolicyCheck } from './impl/LoginAccessPolicyCheck.js';
76
+ import { DataExportAccessCheck } from './impl/DataExportAccessCheck.js';
77
+ import { ClassicSitesCheck } from './impl/ClassicSitesCheck.js';
78
+ import { AuthProvidersCheck } from './impl/AuthProvidersCheck.js';
79
+ import { GuestApiAccessCheck } from './impl/GuestApiAccessCheck.js';
80
+ import { ExternalCredentialsCheck } from './impl/ExternalCredentialsCheck.js';
81
+ import { LoginAnomalyCheck } from './impl/LoginAnomalyCheck.js';
82
+ import { SessionHardeningCheck } from './impl/SessionHardeningCheck.js';
83
+ import { EncryptionCoverageCheck } from './impl/EncryptionCoverageCheck.js';
84
+ import { ExperienceCspCheck } from './impl/ExperienceCspCheck.js';
85
+ import { SandboxDataMaskingCheck } from './impl/SandboxDataMaskingCheck.js';
86
+ // Access-control depth: effective-permission resolution + combination analysis
87
+ import { PrivilegedAccessCheck } from './impl/PrivilegedAccessCheck.js';
88
+ import { SeparationOfDutiesCheck } from './impl/SeparationOfDutiesCheck.js';
65
89
  // Order matters: a check's dependsOnCache must be satisfied by a preceding check's populatesCache.
66
90
  // CheckEngine.validateCacheOrdering() enforces this at startup.
67
91
  export const CHECKS = [
@@ -117,6 +141,25 @@ export const CHECKS = [
117
141
  new ReportFolderAccessCheck(), // public report folders — mass data exfiltration risk
118
142
  new EscalationPermsCheck(), // priv-esc permission cluster (chain ingredient)
119
143
  new CorsAllowlistCheck(), // wildcard/broad CORS origins (chain ingredient)
144
+ new EmailSecurityCheck(), // inbound email services + send-as spoofing
145
+ new OutboundMessagesCheck(), // outbound message session-id leak + cleartext endpoints
146
+ new PublicContentExposureCheck(), // externally available Documents + public static resources
147
+ new GuestObjectExposureCheck(), // auto-discovered guest bulk-read surface (UI API) + ownership-defeats-OWD
148
+ new GuestSiteOptionsCheck(), // guest file access + guest member visibility on Experience sites
149
+ new GuestRecordAccessPolicyCheck(), // "Secure guest user record access" enforcement (ownership-defeats-OWD guardrail)
150
+ new ThreatDetectionCheck(), // Guest User Anomaly / Threat Detection event storage enabled
151
+ new LoginAccessPolicyCheck(), // delegated admin + login-as impersonation paths
152
+ new DataExportAccessCheck(), // Weekly Export / API+ViewAll bulk-exfil capability
153
+ new ClassicSitesCheck(), // classic Visualforce Force.com Sites (unauth surface)
154
+ new AuthProvidersCheck(), // external Auth Providers / SAML IdP federation review
155
+ new GuestApiAccessCheck(), // guest users with API Enabled / Bulk API Hard Delete
156
+ new ExternalCredentialsCheck(), // External Credential weak/no authentication
157
+ new LoginAnomalyCheck(), // successful logins from many distinct IPs
158
+ new SessionHardeningCheck(), // reads healthCheckRisks — clickjack/CSRF/session-lock/XSS
159
+ new EncryptionCoverageCheck(), // classified sensitive fields not encrypted at rest
160
+ new ExperienceCspCheck(), // Experience Cloud CSP / Lightning Web Security advisory
161
+ new SandboxDataMaskingCheck(), // sandbox with populated (likely unmasked) PII
162
+ new PrivilegedAccessCheck(), // writes: effectivePermissions; shadow-admin detection
120
163
  // Cache-dependent checks — must come after their producers
121
164
  new DeploymentIdentityCheck(), // reads connectedAppNames
122
165
  new ApexLoggingCheck(), // reads apexBodies + scheduledApexClassNames
@@ -126,9 +169,11 @@ export const CHECKS = [
126
169
  new ApexRestEndpointCheck(), // reads apexBodies
127
170
  new VisualforceXssCheck(), // writes vfPageBodies
128
171
  new EventMonitoringCheck(), // writes eventLogSummary
172
+ new GuestTrafficAnomalyCheck(), // reads eventLogSummary — anonymizer IPs, bursts, GraphQL recon in guest logs
129
173
  new MfaRegistrationCheck(), // writes mfaRegistrations
130
174
  new SiemIntegrationCheck(), // reads namedCredentialEndpoints, remoteSiteUrls,
131
175
  // connectedAppNames, scheduledApexClassNames, eventLogSummary
132
176
  new MfaMethodStrengthCheck(), // reads mfaRegistrations
177
+ new SeparationOfDutiesCheck(), // reads effectivePermissions — toxic permission combinations
133
178
  ];
134
179
  //# sourceMappingURL=registry.js.map
@@ -43,16 +43,20 @@ export default class AuditDiffCommand extends SfCommand {
43
43
  this.warn(`Org IDs differ: baseline=${baseline.orgId}, current=${current.orgId}. Continuing anyway.`);
44
44
  }
45
45
  const diff = computeDiff(baseline, current);
46
- const formats = flags.format.split(',').map((f) => f.trim());
46
+ const formats = flags.format.split(',').map((f) => f.trim()).filter(Boolean);
47
+ const bad = formats.filter((f) => !DIFF_RENDERERS[f]);
48
+ if (bad.length > 0 || formats.length === 0) {
49
+ this.error(bad.length > 0 ? `Unknown output format(s): ${bad.join(', ')}` : 'No output format specified.', {
50
+ suggestions: ['Valid formats: html, json'],
51
+ });
52
+ }
47
53
  const baseTs = baseline.generatedAt.getTime();
48
54
  const curTs = current.generatedAt.getTime();
49
55
  fs.mkdirSync(flags.output, { recursive: true });
50
56
  for (const format of formats) {
51
57
  const renderer = DIFF_RENDERERS[format];
52
- if (!renderer) {
53
- this.warn(`Unknown format '${format}' — skipping. Valid formats: html, json`);
54
- continue;
55
- }
58
+ if (!renderer)
59
+ continue; // unreachable: validated above
56
60
  const filename = `sf-audit-diff-${baseline.orgId}-${baseTs}-vs-${curTs}${renderer.fileExtension}`;
57
61
  const outputPath = path.join(flags.output, filename);
58
62
  fs.writeFileSync(outputPath, renderer.render(diff), 'utf-8');
@@ -0,0 +1,17 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { type EventsPullResult } from '../../../events/pullEventLogs.js';
3
+ export default class AuditEventsPullCommand extends SfCommand<EventsPullResult> {
4
+ static summary: string;
5
+ static description: string;
6
+ static examples: string[];
7
+ static flags: {
8
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
9
+ since: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
10
+ types: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<EventsPullResult>;
14
+ private accessMessage;
15
+ private printSummary;
16
+ }
17
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1,88 @@
1
+ // src/commands/audit/events/pull.ts
2
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
3
+ import { buildAuditContext, resolveOrgInfo } from '../../../lib/wire.js';
4
+ import { EventBaselineStore } from '../../../events/EventBaselineStore.js';
5
+ import { pullEventLogs } from '../../../events/pullEventLogs.js';
6
+ import { sanitizeTypes } from '../../../events/eventLogQuery.js';
7
+ export default class AuditEventsPullCommand extends SfCommand {
8
+ static summary = 'Capture free EventLogFile daily logs to local disk';
9
+ static description = 'Downloads the org\'s free (Daily-interval) EventLogFile CSV logs to ~/.sf/event-baseline/{orgId} so they ' +
10
+ 'survive the free tier\'s ~1-day retention window. Read-only (GET only). Idempotent: rows already saved are ' +
11
+ 'skipped, so it is safe to run daily via cron or a scheduled GitHub Action to build a rolling local baseline ' +
12
+ 'of login, API, and error activity without the paid Event Monitoring / Shield add-on.';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> --target-org myOrg',
15
+ '<%= config.bin %> <%= command.id %> --target-org myOrg --since 3',
16
+ '<%= config.bin %> <%= command.id %> --target-org myOrg --types Login,ApiTotalUsage',
17
+ '<%= config.bin %> <%= command.id %> --target-org myOrg --output ./event-baseline',
18
+ ];
19
+ static flags = {
20
+ 'target-org': Flags.requiredOrg(),
21
+ since: Flags.integer({
22
+ summary: 'Number of days of LogDate to request (LAST_N_DAYS window).',
23
+ default: 1,
24
+ helpValue: '1',
25
+ }),
26
+ types: Flags.string({
27
+ summary: 'Restrict to specific EventTypes (comma-separated). Omit to pull every available type.',
28
+ helpValue: 'Login,ApiTotalUsage',
29
+ }),
30
+ output: Flags.string({
31
+ char: 'o',
32
+ summary: 'Base directory to store logs under. Defaults to ~/.sf/event-baseline.',
33
+ helpValue: './event-baseline',
34
+ }),
35
+ };
36
+ async run() {
37
+ const { flags } = await this.parse(AuditEventsPullCommand);
38
+ const conn = flags['target-org'].getConnection('62.0');
39
+ const orgInfo = await resolveOrgInfo(conn);
40
+ const ctx = buildAuditContext(conn, orgInfo);
41
+ const store = new EventBaselineStore(flags.output);
42
+ const types = sanitizeTypes(flags.types);
43
+ this.log(`Pulling free EventLogFile logs for org: ${orgInfo.name} (${orgInfo.id})`);
44
+ if (types.length > 0)
45
+ this.log(`Restricting to event type(s): ${types.join(', ')}`);
46
+ const result = await pullEventLogs({ soql: ctx.soql, rest: ctx.rest, store, orgId: orgInfo.id }, { since: flags.since, types, warn: (msg) => this.warn(msg) });
47
+ if (result.accessError) {
48
+ this.warn(this.accessMessage(result.accessError));
49
+ return result;
50
+ }
51
+ if (result.found === 0) {
52
+ this.log(`No EventLogFile records found for the last ${flags.since} day(s). Free daily logs need ` +
53
+ 'Enterprise/Unlimited/Performance edition and appear ~24h after the activity.');
54
+ return result;
55
+ }
56
+ this.printSummary(result);
57
+ return result;
58
+ }
59
+ accessMessage(access) {
60
+ switch (access) {
61
+ case 'no-permission':
62
+ return ('EventLogFile is not readable by this org user: the "View Event Log Files" permission is missing. ' +
63
+ 'Grant it to the running user and re-run.');
64
+ case 'not-enabled':
65
+ return ('EventLogFile is not available on this org/edition. Free daily logs require Enterprise/Unlimited/' +
66
+ 'Performance edition (Developer Edition also exposes them); other editions need the Event Monitoring add-on.');
67
+ default:
68
+ return 'EventLogFile could not be queried. Verify the org connection and that EventLogFile is accessible.';
69
+ }
70
+ }
71
+ printSummary(result) {
72
+ this.log('');
73
+ this.log('─────────────────────────────');
74
+ this.log(' Event Baseline Pull');
75
+ this.log('─────────────────────────────');
76
+ this.log(` Found ${String(result.found).padStart(4)}`);
77
+ this.log(` Downloaded ${String(result.downloaded).padStart(4)}`);
78
+ this.log(` Skipped ${String(result.skipped).padStart(4)} (already saved)`);
79
+ if (result.failed > 0)
80
+ this.log(` Failed ${String(result.failed).padStart(4)}`);
81
+ this.log(` Total bytes ${String(result.totalBytes).padStart(4)}`);
82
+ this.log('─────────────────────────────');
83
+ this.log(` Saved to: ${result.storagePath}`);
84
+ if (result.manifestPath)
85
+ this.log(` Manifest: ${result.manifestPath}`);
86
+ }
87
+ }
88
+ //# sourceMappingURL=pull.js.map
@@ -17,6 +17,10 @@ export default class SecurityAuditCommand extends SfCommand<AuditResult> {
17
17
  frameworks: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
18
18
  };
19
19
  run(): Promise<AuditResult>;
20
+ /** Resolve --checks to the checks to run, erroring on any unknown ID. */
21
+ private resolveChecks;
22
+ /** Resolve --format to a validated list, erroring on any unknown format. */
23
+ private resolveFormats;
20
24
  private rendererFor;
21
25
  private printSummary;
22
26
  private handleFailOn;
@@ -29,7 +29,7 @@ export default class SecurityAuditCommand extends SfCommand {
29
29
  'target-org': Flags.requiredOrg(),
30
30
  format: Flags.string({
31
31
  char: 'f',
32
- summary: 'Output format(s), comma-separated: html, md, json',
32
+ summary: 'Output format(s), comma-separated: html, md, json, executive',
33
33
  default: 'html',
34
34
  }),
35
35
  output: Flags.string({
@@ -67,19 +67,14 @@ export default class SecurityAuditCommand extends SfCommand {
67
67
  };
68
68
  async run() {
69
69
  const { flags } = await this.parse(SecurityAuditCommand);
70
+ // Validate the selection and output formats up front, so a typo fails fast with
71
+ // a clear message instead of silently running a partial/empty audit or writing
72
+ // no report after the (potentially long) run completes.
73
+ const checksToRun = this.resolveChecks(flags.checks);
74
+ const formats = this.resolveFormats(flags.format);
70
75
  const conn = flags['target-org'].getConnection('62.0');
71
76
  const orgInfo = await resolveOrgInfo(conn);
72
77
  const ctx = buildAuditContext(conn, orgInfo);
73
- const checksToRun = flags.checks
74
- ? (() => {
75
- const ids = new Set(flags.checks.split(',').map((s) => s.trim()));
76
- const unknown = [...ids].filter((id) => !CHECKS.some((c) => c.id === id));
77
- if (unknown.length > 0) {
78
- this.warn(`Unknown check ID(s): ${unknown.join(', ')}. Run 'sf audit list' to see available checks.`);
79
- }
80
- return CHECKS.filter((c) => ids.has(c.id));
81
- })()
82
- : CHECKS;
83
78
  const knownCheckIds = new Set(CHECKS.map((c) => c.id));
84
79
  const scoringConfig = loadScoringConfig(flags['scoring-config'], knownCheckIds, (msg) => this.warn(msg));
85
80
  this.log(`Auditing org: ${orgInfo.name} (${orgInfo.id})`);
@@ -89,14 +84,11 @@ export default class SecurityAuditCommand extends SfCommand {
89
84
  const result = await engine.run((current, total, checkName) => {
90
85
  this.log(`[${String(current).padStart(2)}/${total}] ${checkName}`);
91
86
  });
92
- const formats = flags.format.split(',').map((f) => f.trim());
93
87
  fs.mkdirSync(flags.output, { recursive: true });
94
88
  for (const format of formats) {
95
89
  const renderer = this.rendererFor(format, flags);
96
- if (!renderer) {
97
- this.warn(`Unknown format '${format}' — skipping. Valid formats: html, md, json, executive`);
98
- continue;
99
- }
90
+ if (!renderer)
91
+ continue; // unreachable: formats validated up front
100
92
  const output = renderer.render(result);
101
93
  const prefix = renderer.filenamePrefix ?? 'sf-audit';
102
94
  const filename = `${prefix}-${orgInfo.id}-${Date.now()}${renderer.fileExtension}`;
@@ -114,6 +106,38 @@ export default class SecurityAuditCommand extends SfCommand {
114
106
  }
115
107
  return result;
116
108
  }
109
+ /** Resolve --checks to the checks to run, erroring on any unknown ID. */
110
+ resolveChecks(raw) {
111
+ if (!raw)
112
+ return CHECKS;
113
+ const ids = raw.split(',').map((s) => s.trim()).filter(Boolean);
114
+ const unknown = ids.filter((id) => !CHECKS.some((c) => c.id === id));
115
+ if (unknown.length > 0) {
116
+ this.error(`Unknown check ID(s): ${unknown.join(', ')}`, {
117
+ suggestions: ["Run 'sf audit list' to see all valid check IDs."],
118
+ });
119
+ }
120
+ const set = new Set(ids);
121
+ const selected = CHECKS.filter((c) => set.has(c.id));
122
+ if (selected.length === 0) {
123
+ this.error('No checks were selected by --checks.', {
124
+ suggestions: ["Run 'sf audit list' to see valid check IDs, or omit --checks to run all."],
125
+ });
126
+ }
127
+ return selected;
128
+ }
129
+ /** Resolve --format to a validated list, erroring on any unknown format. */
130
+ resolveFormats(raw) {
131
+ const valid = ['html', 'md', 'json', 'executive'];
132
+ const formats = raw.split(',').map((f) => f.trim()).filter(Boolean);
133
+ const bad = formats.filter((f) => !valid.includes(f));
134
+ if (bad.length > 0 || formats.length === 0) {
135
+ this.error(bad.length > 0 ? `Unknown output format(s): ${bad.join(', ')}` : 'No output format specified.', {
136
+ suggestions: [`Valid formats: ${valid.join(', ')}`],
137
+ });
138
+ }
139
+ return formats;
140
+ }
117
141
  rendererFor(format, flags) {
118
142
  if (format === 'executive') {
119
143
  let overrides;
@@ -142,7 +166,7 @@ export default class SecurityAuditCommand extends SfCommand {
142
166
  const threshold = ORDER.indexOf(failOn);
143
167
  const violations = result.findings.filter((f) => ORDER.indexOf(f.riskLevel) <= threshold);
144
168
  if (violations.length > 0) {
145
- this.log(`\nFail-on threshold: ${failOn} — ${violations.length} finding${violations.length !== 1 ? 's' : ''} at or above threshold:`);
169
+ this.log(`\nFail-on threshold: ${failOn}, ${violations.length} finding${violations.length !== 1 ? 's' : ''} at or above threshold:`);
146
170
  for (const f of violations) {
147
171
  this.log(` [${f.riskLevel}] ${f.title}`);
148
172
  }
@@ -66,6 +66,27 @@ const BASE_CHECK_CONTROL_MAP = {
66
66
  'escalation-perms': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-004'],
67
67
  'cors-allowlist': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.8.26'],
68
68
  'guest-executable-apex': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-001', 'SBS-CPORTAL-002'],
69
+ 'email-security': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.5.14'],
70
+ 'outbound-messages': ['OWASP-A05', 'OWASP-A10', 'SOC2-CC6.6', 'ISO-A.8.26'],
71
+ 'public-content-exposure': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.14'],
72
+ 'privileged-access': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-004'],
73
+ 'separation-of-duties': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-004'],
74
+ 'guest-object-exposure': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
75
+ 'guest-site-options': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.14', 'SBS-CPORTAL-003'],
76
+ 'guest-record-access-policy': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
77
+ 'guest-traffic-anomaly': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003'],
78
+ 'threat-detection': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-001'],
79
+ 'login-access-policy': ['OWASP-A01', 'SOC2-CC6.3', 'ISO-A.5.18', 'SBS-ACS-004'],
80
+ 'data-export-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3'],
81
+ 'classic-sites': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-CPORTAL-003'],
82
+ 'auth-providers': ['OWASP-A07', 'SOC2-CC6.1', 'ISO-A.8.3', 'SBS-AUTH-001'],
83
+ 'guest-api-access': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-CPORTAL-002'],
84
+ 'external-credentials': ['OWASP-A02', 'SOC2-CC6.7', 'ISO-A.8.3', 'SBS-INT-003'],
85
+ 'login-anomaly': ['OWASP-A09', 'SOC2-CC7.2', 'ISO-A.8.15', 'SBS-MON-003'],
86
+ 'session-hardening': ['OWASP-A05', 'SOC2-CC6.1', 'ISO-A.8.26'],
87
+ 'encryption-coverage': ['OWASP-A02', 'SOC2-CC6.1', 'ISO-A.8.24'],
88
+ 'experience-csp': ['OWASP-A05', 'SOC2-CC6.6', 'ISO-A.8.26'],
89
+ 'sandbox-data-masking': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.12'],
69
90
  };
70
91
  // NZ pack crosswalk — each check belongs to one domain; the domain's NZ control ids are
71
92
  // layered onto its base entry. HISO/NZISM are domain/chapter-level drafts; Privacy Act IPPs
@@ -75,24 +96,30 @@ const NZ_CROSSWALK = [
75
96
  checks: ['users-and-admins', 'permissions', 'sharing-model', 'public-group-sharing', 'guest-user-access',
76
97
  'field-level-security', 'standard-profiles', 'api-client-permission', 'integration-users',
77
98
  'escalation-perms', 'report-folder-access', 'apex-crud-fls', 'apex-rest-endpoint',
78
- 'guest-executable-apex', 'experience-cloud-site', 'content-links', 'apex-sharing', 'flows-without-sharing'] },
99
+ 'guest-executable-apex', 'experience-cloud-site', 'content-links', 'apex-sharing', 'flows-without-sharing',
100
+ 'public-content-exposure', 'privileged-access', 'separation-of-duties',
101
+ 'guest-object-exposure', 'guest-site-options', 'guest-record-access-policy',
102
+ 'login-access-policy', 'data-export-access', 'classic-sites', 'guest-api-access'] },
79
103
  { controls: ['HISO-AUTH', 'NZISM-AUTH', 'PRIVACY-IPP5'],
80
104
  checks: ['login-session', 'ip-restrictions', 'password-session-policy', 'sso-enforcement', 'mfa-enforcement',
81
105
  'trusted-ip-ranges', 'my-domain-login-policy', 'high-assurance-session', 'internal-user-mfa',
82
- 'mfa-registration', 'mfa-method-strength', 'failed-login-detection', 'enhanced-domains'] },
106
+ 'mfa-registration', 'mfa-method-strength', 'failed-login-detection', 'enhanced-domains',
107
+ 'auth-providers'] },
83
108
  { controls: ['HISO-CRYPTO', 'NZISM-CRYPTO', 'PRIVACY-IPP5'],
84
- checks: ['named-credentials', 'hardcoded-credentials', 'custom-settings', 'certificate-expiry', 'custom-labels-credential'] },
109
+ checks: ['named-credentials', 'hardcoded-credentials', 'custom-settings', 'certificate-expiry', 'custom-labels-credential', 'external-credentials', 'encryption-coverage'] },
85
110
  { controls: ['HISO-LOG', 'NZISM-LOG'],
86
111
  checks: ['audit-trail', 'apex-logging', 'event-monitoring', 'siem-integration', 'anonymous-apex-audit',
87
- 'debug-log-access', 'transaction-security-policy'] },
112
+ 'debug-log-access', 'transaction-security-policy', 'threat-detection', 'guest-traffic-anomaly',
113
+ 'login-anomaly'] },
88
114
  { controls: ['HISO-DEV', 'NZISM-SW'],
89
115
  checks: ['code-security', 'visualforce-xss', 'scheduled-apex'] },
90
116
  { controls: ['HISO-COMM', 'NZISM-NET', 'PRIVACY-IPP12'],
91
- checks: ['remote-sites', 'csp-trusted-sites', 'connected-apps', 'connected-app-scope', 'connected-app-inactivity', 'cors-allowlist'] },
117
+ checks: ['remote-sites', 'csp-trusted-sites', 'connected-apps', 'connected-app-scope', 'connected-app-inactivity', 'cors-allowlist',
118
+ 'email-security', 'outbound-messages', 'experience-csp'] },
92
119
  { controls: ['HISO-DATA', 'PRIVACY-IPP5'],
93
- checks: ['data-classification', 'field-history-tracking'] },
120
+ checks: ['data-classification', 'field-history-tracking', 'sandbox-data-masking'] },
94
121
  { controls: ['HISO-GOV', 'NZISM-CONFIG'],
95
- checks: ['health-check', 'api-limits', 'release-updates', 'legacy-api-version', 'installed-packages', 'deployment-identity'] },
122
+ checks: ['health-check', 'api-limits', 'release-updates', 'legacy-api-version', 'installed-packages', 'deployment-identity', 'session-hardening'] },
96
123
  { controls: ['PRIVACY-IPP9'],
97
124
  checks: ['inactive-users'] },
98
125
  ];
@@ -12,10 +12,13 @@ export interface VfPageBody {
12
12
  name: string;
13
13
  markup: string;
14
14
  }
15
+ export type EventLogAccess = 'no-permission' | 'not-enabled' | 'unknown';
15
16
  export interface EventLogSummary {
16
17
  earliestDate: string | null;
17
18
  totalFiles: number;
18
19
  eventTypes: string[];
20
+ accessible?: boolean;
21
+ accessError?: EventLogAccess;
19
22
  }
20
23
  export interface MfaRegistration {
21
24
  userId: string;
@@ -23,6 +26,14 @@ export interface MfaRegistration {
23
26
  profileName: string;
24
27
  methods: string[];
25
28
  }
29
+ export interface EffectivePermissionGrant {
30
+ userId: string;
31
+ username: string;
32
+ name: string;
33
+ profileName: string;
34
+ /** Stable permission keys from DANGEROUS_PERMS held by this user. */
35
+ perms: string[];
36
+ }
26
37
  export interface AuditCache {
27
38
  healthCheckRisks?: HealthCheckRisk[];
28
39
  apexBodies?: ApexClassBody[];
@@ -34,5 +45,6 @@ export interface AuditCache {
34
45
  eventLogSummary?: EventLogSummary;
35
46
  mfaRegistrations?: MfaRegistration[];
36
47
  vfPageBodies?: VfPageBody[];
48
+ effectivePermissions?: EffectivePermissionGrant[];
37
49
  }
38
50
  //# sourceMappingURL=AuditCache.d.ts.map
@@ -1,12 +1,14 @@
1
1
  import type { SoqlClient } from '../api/SoqlClient.js';
2
2
  import type { ToolingClient } from '../api/ToolingClient.js';
3
3
  import type { RestClient } from '../api/RestClient.js';
4
+ import type { MetadataClient } from '../api/MetadataClient.js';
4
5
  import type { OrgInfo } from './OrgInfo.js';
5
6
  import type { AuditCache } from './AuditCache.js';
6
7
  export interface AuditContext {
7
8
  readonly soql: SoqlClient;
8
9
  readonly tooling: ToolingClient;
9
10
  readonly rest: RestClient;
11
+ readonly metadata?: MetadataClient;
10
12
  readonly orgInfo: OrgInfo;
11
13
  cache: AuditCache;
12
14
  }
@@ -0,0 +1,16 @@
1
+ export declare class EventBaselineStore {
2
+ private readonly root;
3
+ constructor(root?: string);
4
+ static defaultRoot(): string;
5
+ /** The per-org base directory logs for this org are stored under. */
6
+ orgDir(orgId: string): string;
7
+ /** Absolute path a given log file is (or would be) stored at. */
8
+ pathFor(orgId: string, eventType: string, logDate: string, id: string): string;
9
+ /** True when this EventLogFile is already on disk — the dedup / idempotency check. */
10
+ has(orgId: string, eventType: string, logDate: string, id: string): boolean;
11
+ /** Write a CSV body verbatim; returns the saved path. Best-effort. */
12
+ save(orgId: string, eventType: string, logDate: string, id: string, body: string): string;
13
+ /** Write a per-run manifest JSON under {root}/{orgId}/_manifests/; returns its path. */
14
+ writeManifest(orgId: string, manifest: unknown): string;
15
+ }
16
+ //# sourceMappingURL=EventBaselineStore.d.ts.map
@@ -0,0 +1,55 @@
1
+ // src/events/EventBaselineStore.ts
2
+ // Local, on-disk archive of free EventLogFile CSVs. Mirrors HistoryStore: writes under
3
+ // ~/.sf/event-baseline/{orgId}/, takes an optional root for testability, and is best-effort
4
+ // (warns rather than throws) so a daily cron run never dies on a filesystem hiccup.
5
+ import * as fs from 'node:fs';
6
+ import * as os from 'node:os';
7
+ import * as path from 'node:path';
8
+ export class EventBaselineStore {
9
+ root;
10
+ constructor(root) {
11
+ this.root = root ?? EventBaselineStore.defaultRoot();
12
+ }
13
+ static defaultRoot() {
14
+ return path.join(os.homedir(), '.sf', 'event-baseline');
15
+ }
16
+ /** The per-org base directory logs for this org are stored under. */
17
+ orgDir(orgId) {
18
+ return path.join(this.root, orgId);
19
+ }
20
+ /** Absolute path a given log file is (or would be) stored at. */
21
+ pathFor(orgId, eventType, logDate, id) {
22
+ return path.join(this.root, orgId, eventType, `${logDate}-${id}.csv`);
23
+ }
24
+ /** True when this EventLogFile is already on disk — the dedup / idempotency check. */
25
+ has(orgId, eventType, logDate, id) {
26
+ return fs.existsSync(this.pathFor(orgId, eventType, logDate, id));
27
+ }
28
+ /** Write a CSV body verbatim; returns the saved path. Best-effort. */
29
+ save(orgId, eventType, logDate, id, body) {
30
+ const filePath = this.pathFor(orgId, eventType, logDate, id);
31
+ try {
32
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
33
+ fs.writeFileSync(filePath, body, 'utf-8');
34
+ }
35
+ catch (err) {
36
+ process.stderr.write(`[sf-audit] Warning: could not save event log ${id}: ${String(err)}\n`);
37
+ }
38
+ return filePath;
39
+ }
40
+ /** Write a per-run manifest JSON under {root}/{orgId}/_manifests/; returns its path. */
41
+ writeManifest(orgId, manifest) {
42
+ const dir = path.join(this.root, orgId, '_manifests');
43
+ const suffix = Math.random().toString(36).slice(2, 8);
44
+ const filePath = path.join(dir, `manifest-${Date.now()}-${suffix}.json`);
45
+ try {
46
+ fs.mkdirSync(dir, { recursive: true });
47
+ fs.writeFileSync(filePath, JSON.stringify(manifest, null, 2), 'utf-8');
48
+ }
49
+ catch (err) {
50
+ process.stderr.write(`[sf-audit] Warning: could not write event manifest: ${String(err)}\n`);
51
+ }
52
+ return filePath;
53
+ }
54
+ }
55
+ //# sourceMappingURL=EventBaselineStore.js.map
@@ -0,0 +1,21 @@
1
+ export interface EventLogQueryOptions {
2
+ /** Number of days of LogDate to request (LAST_N_DAYS:N). */
3
+ since: number;
4
+ /** Optional EventType allow-list (already sanitised or not — we sanitise again). */
5
+ types?: string[];
6
+ }
7
+ /**
8
+ * Reduce free-form `--types` input to safe EventType tokens. EventTypes are PascalCase
9
+ * identifiers (Login, ApiTotalUsage, LightningError, …), so we strip anything that is not
10
+ * alphanumeric. This doubles as the SOQL-injection guard for the IN clause.
11
+ */
12
+ export declare function sanitizeTypes(raw: string | undefined): string[];
13
+ /** Normalise a Salesforce LogDate (datetime) to a YYYY-MM-DD string for filenames. */
14
+ export declare function toLogDate(raw: string): string;
15
+ /**
16
+ * Build the read-only EventLogFile discovery query. `Interval = 'Daily'` excludes the paid
17
+ * hourly logs; `LogDate = LAST_N_DAYS:N` bounds the window. `since` is coerced to a
18
+ * non-negative integer and `types` are sanitised, so the interpolated string is injection-safe.
19
+ */
20
+ export declare function buildEventLogQuery(opts: EventLogQueryOptions): string;
21
+ //# sourceMappingURL=eventLogQuery.d.ts.map
@@ -0,0 +1,34 @@
1
+ // Pure helpers for the `audit events pull` command. Kept free of I/O so they are
2
+ // unit-testable without an org connection or the oclif command harness.
3
+ /**
4
+ * Reduce free-form `--types` input to safe EventType tokens. EventTypes are PascalCase
5
+ * identifiers (Login, ApiTotalUsage, LightningError, …), so we strip anything that is not
6
+ * alphanumeric. This doubles as the SOQL-injection guard for the IN clause.
7
+ */
8
+ export function sanitizeTypes(raw) {
9
+ if (!raw)
10
+ return [];
11
+ return raw
12
+ .split(',')
13
+ .map((t) => t.replace(/[^A-Za-z0-9]/g, '').trim())
14
+ .filter((t) => t.length > 0);
15
+ }
16
+ /** Normalise a Salesforce LogDate (datetime) to a YYYY-MM-DD string for filenames. */
17
+ export function toLogDate(raw) {
18
+ return String(raw).slice(0, 10);
19
+ }
20
+ /**
21
+ * Build the read-only EventLogFile discovery query. `Interval = 'Daily'` excludes the paid
22
+ * hourly logs; `LogDate = LAST_N_DAYS:N` bounds the window. `since` is coerced to a
23
+ * non-negative integer and `types` are sanitised, so the interpolated string is injection-safe.
24
+ */
25
+ export function buildEventLogQuery(opts) {
26
+ const since = Math.max(0, Math.trunc(opts.since));
27
+ const types = (opts.types ?? []).filter((t) => t.length > 0);
28
+ const typeClause = types.length > 0 ? ` AND EventType IN (${types.map((t) => `'${t}'`).join(', ')})` : '';
29
+ return ('SELECT Id, EventType, LogDate, LogFileLength, Interval, LogFileFieldNames ' +
30
+ 'FROM EventLogFile ' +
31
+ `WHERE Interval = 'Daily' AND LogDate = LAST_N_DAYS:${since}${typeClause} ` +
32
+ 'ORDER BY LogDate');
33
+ }
34
+ //# sourceMappingURL=eventLogQuery.js.map
@@ -0,0 +1,51 @@
1
+ import type { SoqlClient } from '../api/SoqlClient.js';
2
+ import type { RestClient } from '../api/RestClient.js';
3
+ import type { EventLogAccess } from '../context/AuditCache.js';
4
+ import { EventBaselineStore } from './EventBaselineStore.js';
5
+ /** The subset of EventLogFile fields the discovery query returns. */
6
+ export interface EventLogFileRow {
7
+ Id: string;
8
+ EventType: string;
9
+ LogDate: string;
10
+ LogFileLength?: number;
11
+ Interval?: string;
12
+ LogFileFieldNames?: string;
13
+ }
14
+ /** Outcome for one EventLogFile row in a run. */
15
+ export interface PulledLog {
16
+ id: string;
17
+ eventType: string;
18
+ logDate: string;
19
+ bytes: number;
20
+ savedPath: string;
21
+ status: 'downloaded' | 'skipped' | 'failed';
22
+ }
23
+ /** Structured result of a pull run — returned by the command. */
24
+ export interface EventsPullResult {
25
+ orgId: string;
26
+ since: number;
27
+ storagePath: string;
28
+ found: number;
29
+ downloaded: number;
30
+ skipped: number;
31
+ failed: number;
32
+ totalBytes: number;
33
+ logs: PulledLog[];
34
+ manifestPath?: string;
35
+ /** Set when the EventLogFile query itself failed (no crash); tells license vs permission apart. */
36
+ accessError?: EventLogAccess;
37
+ }
38
+ export interface PullDeps {
39
+ soql: SoqlClient;
40
+ rest: RestClient;
41
+ store: EventBaselineStore;
42
+ orgId: string;
43
+ }
44
+ export interface PullOptions {
45
+ since: number;
46
+ types?: string[];
47
+ /** Optional sink for non-fatal warnings (per-file download failures). */
48
+ warn?: (msg: string) => void;
49
+ }
50
+ export declare function pullEventLogs(deps: PullDeps, opts: PullOptions): Promise<EventsPullResult>;
51
+ //# sourceMappingURL=pullEventLogs.d.ts.map