@cclabsnz/sf-audit 1.3.0 → 1.6.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 (102) hide show
  1. package/README.md +193 -12
  2. package/lib/api/MetadataClient.d.ts +4 -0
  3. package/lib/api/MetadataClient.js +2 -0
  4. package/lib/api/MetadataClientImpl.d.ts +8 -0
  5. package/lib/api/MetadataClientImpl.js +22 -0
  6. package/lib/api/RestClient.d.ts +2 -0
  7. package/lib/api/RestClientImpl.d.ts +2 -0
  8. package/lib/api/RestClientImpl.js +33 -0
  9. package/lib/apps/analyzeApps.d.ts +8 -0
  10. package/lib/apps/analyzeApps.js +19 -0
  11. package/lib/apps/appResolver.d.ts +4 -0
  12. package/lib/apps/appResolver.js +50 -0
  13. package/lib/apps/grantedAccess.d.ts +4 -0
  14. package/lib/apps/grantedAccess.js +36 -0
  15. package/lib/apps/leastPrivilege.d.ts +6 -0
  16. package/lib/apps/leastPrivilege.js +47 -0
  17. package/lib/apps/renderApps.d.ts +5 -0
  18. package/lib/apps/renderApps.js +23 -0
  19. package/lib/apps/standardAppCatalog.d.ts +11 -0
  20. package/lib/apps/standardAppCatalog.js +14 -0
  21. package/lib/apps/types.d.ts +64 -0
  22. package/lib/apps/types.js +2 -0
  23. package/lib/apps/usageCollector.d.ts +9 -0
  24. package/lib/apps/usageCollector.js +104 -0
  25. package/lib/chains/CapabilityRegistry.js +19 -0
  26. package/lib/chains/namedChains.js +67 -0
  27. package/lib/checks/eventLogAccess.d.ts +14 -0
  28. package/lib/checks/eventLogAccess.js +33 -0
  29. package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +13 -0
  30. package/lib/checks/impl/AgentActionSurfaceCheck.js +125 -0
  31. package/lib/checks/impl/AgentChannelExposureCheck.d.ts +15 -0
  32. package/lib/checks/impl/AgentChannelExposureCheck.js +223 -0
  33. package/lib/checks/impl/AgentInventoryCheck.d.ts +15 -0
  34. package/lib/checks/impl/AgentInventoryCheck.js +228 -0
  35. package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +12 -0
  36. package/lib/checks/impl/AgentMonitoringCoverageCheck.js +97 -0
  37. package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +13 -0
  38. package/lib/checks/impl/AgentUserPrivilegeCheck.js +204 -0
  39. package/lib/checks/impl/AuthProvidersCheck.d.ts +17 -0
  40. package/lib/checks/impl/AuthProvidersCheck.js +88 -0
  41. package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
  42. package/lib/checks/impl/ClassicSitesCheck.js +65 -0
  43. package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -0
  44. package/lib/checks/impl/CspTrustedSitesCheck.js +10 -1
  45. package/lib/checks/impl/DataExportAccessCheck.d.ts +19 -0
  46. package/lib/checks/impl/DataExportAccessCheck.js +79 -0
  47. package/lib/checks/impl/EncryptionCoverageCheck.d.ts +19 -0
  48. package/lib/checks/impl/EncryptionCoverageCheck.js +108 -0
  49. package/lib/checks/impl/EventMonitoringCheck.js +8 -5
  50. package/lib/checks/impl/ExperienceCspCheck.d.ts +18 -0
  51. package/lib/checks/impl/ExperienceCspCheck.js +57 -0
  52. package/lib/checks/impl/ExternalCredentialsCheck.d.ts +17 -0
  53. package/lib/checks/impl/ExternalCredentialsCheck.js +74 -0
  54. package/lib/checks/impl/GuestApiAccessCheck.d.ts +19 -0
  55. package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
  56. package/lib/checks/impl/GuestObjectExposureCheck.d.ts +44 -0
  57. package/lib/checks/impl/GuestObjectExposureCheck.js +241 -0
  58. package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +34 -0
  59. package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +120 -0
  60. package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +18 -0
  61. package/lib/checks/impl/GuestSiteOptionsCheck.js +92 -0
  62. package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +23 -0
  63. package/lib/checks/impl/GuestTrafficAnomalyCheck.js +343 -0
  64. package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +26 -0
  65. package/lib/checks/impl/LoginAccessPolicyCheck.js +117 -0
  66. package/lib/checks/impl/LoginAnomalyCheck.d.ts +17 -0
  67. package/lib/checks/impl/LoginAnomalyCheck.js +98 -0
  68. package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +17 -0
  69. package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
  70. package/lib/checks/impl/SessionHardeningCheck.d.ts +21 -0
  71. package/lib/checks/impl/SessionHardeningCheck.js +134 -0
  72. package/lib/checks/impl/ThreatDetectionCheck.d.ts +17 -0
  73. package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
  74. package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +16 -0
  75. package/lib/checks/impl/TrustedUrlHygieneCheck.js +198 -0
  76. package/lib/checks/registry.js +52 -0
  77. package/lib/commands/audit/apps.d.ts +16 -0
  78. package/lib/commands/audit/apps.js +64 -0
  79. package/lib/commands/audit/diff.js +9 -5
  80. package/lib/commands/audit/events/pull.d.ts +17 -0
  81. package/lib/commands/audit/events/pull.js +88 -0
  82. package/lib/commands/audit/security.d.ts +5 -0
  83. package/lib/commands/audit/security.js +47 -17
  84. package/lib/compliance/catalogs/index.js +2 -0
  85. package/lib/compliance/catalogs/owaspLlm.d.ts +3 -0
  86. package/lib/compliance/catalogs/owaspLlm.js +34 -0
  87. package/lib/compliance/mapping.js +46 -7
  88. package/lib/compliance/resolve.js +4 -3
  89. package/lib/compliance/types.d.ts +1 -1
  90. package/lib/context/AuditCache.d.ts +31 -0
  91. package/lib/context/AuditContext.d.ts +6 -0
  92. package/lib/events/EventBaselineStore.d.ts +16 -0
  93. package/lib/events/EventBaselineStore.js +55 -0
  94. package/lib/events/eventLogQuery.d.ts +21 -0
  95. package/lib/events/eventLogQuery.js +34 -0
  96. package/lib/events/pullEventLogs.d.ts +51 -0
  97. package/lib/events/pullEventLogs.js +79 -0
  98. package/lib/findings/CheckMeta.js +22 -0
  99. package/lib/lib/wire.d.ts +4 -2
  100. package/lib/lib/wire.js +5 -1
  101. package/lib/renderers/ClientReportRenderer.js +1 -1
  102. package/package.json +16 -2
@@ -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
@@ -0,0 +1,79 @@
1
+ import { classifyEventLogAccessError } from '../checks/eventLogAccess.js';
2
+ import { buildEventLogQuery, toLogDate } from './eventLogQuery.js';
3
+ export async function pullEventLogs(deps, opts) {
4
+ const { soql, rest, store, orgId } = deps;
5
+ const since = opts.since;
6
+ const storagePath = store.orgDir(orgId);
7
+ const base = {
8
+ orgId,
9
+ since,
10
+ storagePath,
11
+ found: 0,
12
+ downloaded: 0,
13
+ skipped: 0,
14
+ failed: 0,
15
+ totalBytes: 0,
16
+ logs: [],
17
+ };
18
+ let rows;
19
+ try {
20
+ rows = await soql.queryAll(buildEventLogQuery({ since, types: opts.types }));
21
+ }
22
+ catch (err) {
23
+ // Inaccessible EventLogFile (unlicensed / no permission) must not crash the command.
24
+ return { ...base, accessError: classifyEventLogAccessError(err) };
25
+ }
26
+ base.found = rows.length;
27
+ for (const row of rows) {
28
+ const logDate = toLogDate(row.LogDate);
29
+ if (store.has(orgId, row.EventType, logDate, row.Id)) {
30
+ base.skipped += 1;
31
+ base.logs.push({
32
+ id: row.Id,
33
+ eventType: row.EventType,
34
+ logDate,
35
+ bytes: 0,
36
+ savedPath: store.pathFor(orgId, row.EventType, logDate, row.Id),
37
+ status: 'skipped',
38
+ });
39
+ continue;
40
+ }
41
+ try {
42
+ // Stream straight to disk — never buffer the body — so large daily logs don't blow the heap.
43
+ const savedPath = store.pathFor(orgId, row.EventType, logDate, row.Id);
44
+ const bytes = await rest.getRawToFile(`/sobjects/EventLogFile/${row.Id}/LogFile`, savedPath);
45
+ base.downloaded += 1;
46
+ base.totalBytes += bytes;
47
+ base.logs.push({ id: row.Id, eventType: row.EventType, logDate, bytes, savedPath, status: 'downloaded' });
48
+ }
49
+ catch (err) {
50
+ base.failed += 1;
51
+ base.logs.push({
52
+ id: row.Id,
53
+ eventType: row.EventType,
54
+ logDate,
55
+ bytes: 0,
56
+ savedPath: store.pathFor(orgId, row.EventType, logDate, row.Id),
57
+ status: 'failed',
58
+ });
59
+ opts.warn?.(`Failed to download EventLogFile ${row.Id} (${row.EventType} ${logDate}): ${String(err)}`);
60
+ }
61
+ }
62
+ // Only write a manifest when something was actually captured — a pure all-skipped or
63
+ // empty run leaves no new record to make.
64
+ if (base.downloaded > 0) {
65
+ base.manifestPath = store.writeManifest(orgId, {
66
+ orgId,
67
+ since,
68
+ pulledAt: new Date().toISOString(),
69
+ found: base.found,
70
+ downloaded: base.downloaded,
71
+ skipped: base.skipped,
72
+ failed: base.failed,
73
+ totalBytes: base.totalBytes,
74
+ logs: base.logs,
75
+ });
76
+ }
77
+ return base;
78
+ }
79
+ //# sourceMappingURL=pullEventLogs.js.map
@@ -65,6 +65,28 @@ export const CHECK_META = {
65
65
  'public-content-exposure': { effort: 'quick', impact: 'Documents marked externally available and public static resources are retrievable without authentication by anyone with the URL.' },
66
66
  'privileged-access': { effort: 'moderate', impact: 'Shadow admins hold full org control outside the admin profile, so a single takeover bypasses admin-focused monitoring and owns everything.' },
67
67
  'separation-of-duties': { effort: 'moderate', impact: 'A single user holding a toxic permission combination can self-escalate, commit fraud, or tamper undetected with no second party to stop them.' },
68
+ 'guest-object-exposure': { effort: 'moderate', impact: 'Grades guest-readable objects by ACTUAL UI-API reachability: objects the UI API models are bulk-readable unauthenticated via GraphQL (CRITICAL, incl. guest-owned records under a Private OWD, enabling mass PII exfiltration without login); objects readable only in the sharing model but not UI-API-modelled (Calendar, AuthSession, etc.) are separated as MEDIUM defense-in-depth, with UserRecordAccess as ground-truth read confirmation.' },
69
+ 'guest-site-options': { effort: 'quick', impact: 'Guest file access and member visibility let unauthenticated visitors download public files and enumerate site members.' },
70
+ 'threat-detection': { effort: 'moderate', impact: 'Without Guest User Anomaly storage, malicious guest bulk-reads are never flagged and cannot be reconstructed after the fact.' },
71
+ 'guest-record-access-policy': { effort: 'quick', impact: 'Without "Secure guest user record access" enforced, guests own the records they submit and can read them under a Private OWD, turning a public form into an unauthenticated bulk-read surface.' },
72
+ 'guest-traffic-anomaly': { effort: 'moderate', impact: 'Guest requests from anonymizer/hosting IPs, single-IP bursts, and GraphQL totalCount sweeps are the live signatures of scraping and pre-exfiltration recon — unmonitored, they only surface after data is gone.' },
73
+ 'login-access-policy': { effort: 'moderate', impact: 'Delegated admins and "log in as any user" let accounts impersonate others and self-escalate, bypassing normal credentials and admin-focused monitoring.' },
74
+ 'data-export-access': { effort: 'quick', impact: 'Weekly Data Export or API access with View/Modify All is a one-step, org-wide exfiltration capability in the wrong hands.' },
75
+ 'classic-sites': { effort: 'moderate', impact: 'Active classic Visualforce sites expose a second unauthenticated guest surface that the Experience Cloud checks never inspect.' },
76
+ 'auth-providers': { effort: 'moderate', impact: 'Unvetted social/SAML identity providers with just-in-time provisioning can let attackers federate in or auto-create over-privileged users.' },
77
+ 'guest-api-access': { effort: 'quick', impact: 'A guest user with API access can drive the raw REST/Bulk API, turning readable objects into scriptable mass extraction (and Hard Delete into irreversible destruction) without login.' },
78
+ 'external-credentials': { effort: 'moderate', impact: 'Callouts with no or custom authentication can be spoofed or leak a static secret, exposing the integrated system and the data crossing it.' },
79
+ 'login-anomaly': { effort: 'quick', impact: 'An account logging in from many distinct IPs signals credential sharing or compromise; caught late, it means an attacker already has a working session.' },
80
+ 'session-hardening': { effort: 'quick', impact: 'Weak clickjack/CSRF/session-lock/XSS settings let attackers hijack authenticated sessions via framing, forged requests, or injected script.' },
81
+ 'encryption-coverage': { effort: 'moderate', impact: 'Fields labelled PII/PHI but stored in plaintext are unprotected at rest and on export — the sensitivity is known, the protection is missing.' },
82
+ 'experience-csp': { effort: 'moderate', impact: 'Relaxed CSP or disabled Lightning Web Security on a public site lets injected/third-party scripts run against unauthenticated visitors.' },
83
+ 'sandbox-data-masking': { effort: 'moderate', impact: 'Unmasked production PII/PHI copied into a sandbox spreads sensitive data into a lower-trust environment with broader access and weaker monitoring.' },
84
+ 'agent-inventory': { effort: 'quick', impact: 'Untracked Agentforce agents each run as a user with real data access; an active agent whose run-as identity is disabled is a latent misconfiguration and a way to smuggle access back in on reactivation.' },
85
+ 'agent-user-privilege': { effort: 'moderate', impact: 'An Agentforce agent runs as its user, so a prompt injection inherits that user\'s access; Modify/View All Data or broad object write turns one injected prompt into org-wide read, edit, or exfiltration of classified data.' },
86
+ 'agent-action-surface': { effort: 'moderate', impact: 'Write-capable agent actions (Apex/Flow that create, update, or delete) let an injected prompt take state-changing operations, not just read data — the difference between a leak and active tampering on an exposed agent.' },
87
+ 'agent-channel-exposure': { effort: 'moderate', impact: 'An agent bound to a guest-reachable channel lets any unauthenticated visitor send prompt-injection input to an agent that executes with its run-as user\'s data access: the public-input half of the ForcedLeak pattern.' },
88
+ 'agent-monitoring-coverage': { effort: 'moderate', impact: 'Active agents with no Event Monitoring capture and no Transaction Security policy leave prompt injection, mass reads, and exfiltration with no auditable trail and no automated response.' },
89
+ 'trusted-url-hygiene': { effort: 'quick', impact: 'A non-Salesforce CSP-trusted domain that has lapsed or been parked is an allowlisted exfiltration channel: whoever re-registers it can receive prompt-injected data from Lightning and Agentforce output — the exact ForcedLeak exfil vector.' },
68
90
  };
69
91
  export function getCheckMeta(id) {
70
92
  return CHECK_META[id];
package/lib/lib/wire.d.ts CHANGED
@@ -2,13 +2,15 @@ import type { Connection } from '@salesforce/core';
2
2
  import { SoqlClientImpl } from '../api/SoqlClientImpl.js';
3
3
  import { ToolingClientImpl } from '../api/ToolingClientImpl.js';
4
4
  import { RestClientImpl } from '../api/RestClientImpl.js';
5
- import type { AuditContext } from '../context/AuditContext.js';
5
+ import { MetadataClientImpl } from '../api/MetadataClientImpl.js';
6
+ import type { AuditContext, AuditOptions } from '../context/AuditContext.js';
6
7
  import type { OrgInfo } from '../context/OrgInfo.js';
7
8
  export declare function buildApiClients(conn: Connection): {
8
9
  soql: SoqlClientImpl;
9
10
  tooling: ToolingClientImpl;
10
11
  rest: RestClientImpl;
12
+ metadata: MetadataClientImpl;
11
13
  };
12
14
  export declare function resolveOrgInfo(conn: Connection): Promise<OrgInfo>;
13
- export declare function buildAuditContext(conn: Connection, orgInfo: OrgInfo): AuditContext;
15
+ export declare function buildAuditContext(conn: Connection, orgInfo: OrgInfo, options?: AuditOptions): AuditContext;
14
16
  //# sourceMappingURL=wire.d.ts.map
package/lib/lib/wire.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { SoqlClientImpl } from '../api/SoqlClientImpl.js';
2
2
  import { ToolingClientImpl } from '../api/ToolingClientImpl.js';
3
3
  import { RestClientImpl } from '../api/RestClientImpl.js';
4
+ import { MetadataClientImpl } from '../api/MetadataClientImpl.js';
4
5
  export function buildApiClients(conn) {
5
6
  return {
6
7
  soql: new SoqlClientImpl(conn),
7
8
  tooling: new ToolingClientImpl(conn),
8
9
  rest: new RestClientImpl(conn),
10
+ metadata: new MetadataClientImpl(conn),
9
11
  };
10
12
  }
11
13
  export async function resolveOrgInfo(conn) {
@@ -22,13 +24,15 @@ export async function resolveOrgInfo(conn) {
22
24
  instanceUrl: conn.instanceUrl,
23
25
  };
24
26
  }
25
- export function buildAuditContext(conn, orgInfo) {
27
+ export function buildAuditContext(conn, orgInfo, options) {
26
28
  const clients = buildApiClients(conn);
27
29
  return {
28
30
  soql: clients.soql,
29
31
  tooling: clients.tooling,
30
32
  rest: clients.rest,
33
+ metadata: clients.metadata,
31
34
  orgInfo,
35
+ options,
32
36
  cache: {},
33
37
  };
34
38
  }
@@ -13,7 +13,7 @@ const GRADE_COLOR = {
13
13
  };
14
14
  const SEV_ORDER = ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'];
15
15
  const FRAMEWORK_LABEL = {
16
- OWASP: 'OWASP Top 10', SOC2: 'SOC 2', ISO27001: 'ISO/IEC 27001',
16
+ OWASP: 'OWASP Top 10', OWASP_LLM: 'OWASP LLM Top 10', SOC2: 'SOC 2', ISO27001: 'ISO/IEC 27001',
17
17
  SBS: 'Security Benchmark for Salesforce', PRIVACY_ACT: 'NZ Privacy Act',
18
18
  HISO10029: 'HISO 10029', NZISM: 'NZISM', HIPAA: 'HIPAA', GDPR: 'GDPR',
19
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cclabsnz/sf-audit",
3
- "version": "1.3.0",
3
+ "version": "1.6.0",
4
4
  "description": "Salesforce Security Audit — native sf plugin",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -42,10 +42,24 @@
42
42
  "devPlugins": [],
43
43
  "topics": {
44
44
  "audit": {
45
- "description": "Salesforce security audit commands"
45
+ "description": "Salesforce security audit commands",
46
+ "subtopics": {
47
+ "events": {
48
+ "description": "Capture free EventLogFile logs to local disk"
49
+ },
50
+ "apps": {
51
+ "description": "Analyze connected-app least-privilege from EventLogFile usage"
52
+ }
53
+ }
46
54
  }
47
55
  }
48
56
  },
57
+ "pnpm": {
58
+ "overrides": {
59
+ "form-data": "^4.0.6",
60
+ "js-yaml@3": "^3.15.0"
61
+ }
62
+ },
49
63
  "overrides": {
50
64
  "handlebars": "^4.7.9",
51
65
  "minimatch@5": {