@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.
- package/README.md +193 -12
- package/lib/api/MetadataClient.d.ts +4 -0
- package/lib/api/MetadataClient.js +2 -0
- package/lib/api/MetadataClientImpl.d.ts +8 -0
- package/lib/api/MetadataClientImpl.js +22 -0
- package/lib/api/RestClient.d.ts +2 -0
- package/lib/api/RestClientImpl.d.ts +2 -0
- package/lib/api/RestClientImpl.js +33 -0
- package/lib/apps/analyzeApps.d.ts +8 -0
- package/lib/apps/analyzeApps.js +19 -0
- package/lib/apps/appResolver.d.ts +4 -0
- package/lib/apps/appResolver.js +50 -0
- package/lib/apps/grantedAccess.d.ts +4 -0
- package/lib/apps/grantedAccess.js +36 -0
- package/lib/apps/leastPrivilege.d.ts +6 -0
- package/lib/apps/leastPrivilege.js +47 -0
- package/lib/apps/renderApps.d.ts +5 -0
- package/lib/apps/renderApps.js +23 -0
- package/lib/apps/standardAppCatalog.d.ts +11 -0
- package/lib/apps/standardAppCatalog.js +14 -0
- package/lib/apps/types.d.ts +64 -0
- package/lib/apps/types.js +2 -0
- package/lib/apps/usageCollector.d.ts +9 -0
- package/lib/apps/usageCollector.js +104 -0
- package/lib/chains/CapabilityRegistry.js +19 -0
- package/lib/chains/namedChains.js +67 -0
- package/lib/checks/eventLogAccess.d.ts +14 -0
- package/lib/checks/eventLogAccess.js +33 -0
- package/lib/checks/impl/AgentActionSurfaceCheck.d.ts +13 -0
- package/lib/checks/impl/AgentActionSurfaceCheck.js +125 -0
- package/lib/checks/impl/AgentChannelExposureCheck.d.ts +15 -0
- package/lib/checks/impl/AgentChannelExposureCheck.js +223 -0
- package/lib/checks/impl/AgentInventoryCheck.d.ts +15 -0
- package/lib/checks/impl/AgentInventoryCheck.js +228 -0
- package/lib/checks/impl/AgentMonitoringCoverageCheck.d.ts +12 -0
- package/lib/checks/impl/AgentMonitoringCoverageCheck.js +97 -0
- package/lib/checks/impl/AgentUserPrivilegeCheck.d.ts +13 -0
- package/lib/checks/impl/AgentUserPrivilegeCheck.js +204 -0
- package/lib/checks/impl/AuthProvidersCheck.d.ts +17 -0
- package/lib/checks/impl/AuthProvidersCheck.js +88 -0
- package/lib/checks/impl/ClassicSitesCheck.d.ts +17 -0
- package/lib/checks/impl/ClassicSitesCheck.js +65 -0
- package/lib/checks/impl/CspTrustedSitesCheck.d.ts +1 -0
- package/lib/checks/impl/CspTrustedSitesCheck.js +10 -1
- package/lib/checks/impl/DataExportAccessCheck.d.ts +19 -0
- package/lib/checks/impl/DataExportAccessCheck.js +79 -0
- package/lib/checks/impl/EncryptionCoverageCheck.d.ts +19 -0
- package/lib/checks/impl/EncryptionCoverageCheck.js +108 -0
- package/lib/checks/impl/EventMonitoringCheck.js +8 -5
- package/lib/checks/impl/ExperienceCspCheck.d.ts +18 -0
- package/lib/checks/impl/ExperienceCspCheck.js +57 -0
- package/lib/checks/impl/ExternalCredentialsCheck.d.ts +17 -0
- package/lib/checks/impl/ExternalCredentialsCheck.js +74 -0
- package/lib/checks/impl/GuestApiAccessCheck.d.ts +19 -0
- package/lib/checks/impl/GuestApiAccessCheck.js +113 -0
- package/lib/checks/impl/GuestObjectExposureCheck.d.ts +44 -0
- package/lib/checks/impl/GuestObjectExposureCheck.js +241 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.d.ts +34 -0
- package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +120 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.d.ts +18 -0
- package/lib/checks/impl/GuestSiteOptionsCheck.js +92 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.d.ts +23 -0
- package/lib/checks/impl/GuestTrafficAnomalyCheck.js +343 -0
- package/lib/checks/impl/LoginAccessPolicyCheck.d.ts +26 -0
- package/lib/checks/impl/LoginAccessPolicyCheck.js +117 -0
- package/lib/checks/impl/LoginAnomalyCheck.d.ts +17 -0
- package/lib/checks/impl/LoginAnomalyCheck.js +98 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.d.ts +17 -0
- package/lib/checks/impl/SandboxDataMaskingCheck.js +85 -0
- package/lib/checks/impl/SessionHardeningCheck.d.ts +21 -0
- package/lib/checks/impl/SessionHardeningCheck.js +134 -0
- package/lib/checks/impl/ThreatDetectionCheck.d.ts +17 -0
- package/lib/checks/impl/ThreatDetectionCheck.js +91 -0
- package/lib/checks/impl/TrustedUrlHygieneCheck.d.ts +16 -0
- package/lib/checks/impl/TrustedUrlHygieneCheck.js +198 -0
- package/lib/checks/registry.js +52 -0
- package/lib/commands/audit/apps.d.ts +16 -0
- package/lib/commands/audit/apps.js +64 -0
- package/lib/commands/audit/diff.js +9 -5
- package/lib/commands/audit/events/pull.d.ts +17 -0
- package/lib/commands/audit/events/pull.js +88 -0
- package/lib/commands/audit/security.d.ts +5 -0
- package/lib/commands/audit/security.js +47 -17
- package/lib/compliance/catalogs/index.js +2 -0
- package/lib/compliance/catalogs/owaspLlm.d.ts +3 -0
- package/lib/compliance/catalogs/owaspLlm.js +34 -0
- package/lib/compliance/mapping.js +46 -7
- package/lib/compliance/resolve.js +4 -3
- package/lib/compliance/types.d.ts +1 -1
- package/lib/context/AuditCache.d.ts +31 -0
- package/lib/context/AuditContext.d.ts +6 -0
- package/lib/events/EventBaselineStore.d.ts +16 -0
- package/lib/events/EventBaselineStore.js +55 -0
- package/lib/events/eventLogQuery.d.ts +21 -0
- package/lib/events/eventLogQuery.js +34 -0
- package/lib/events/pullEventLogs.d.ts +51 -0
- package/lib/events/pullEventLogs.js +79 -0
- package/lib/findings/CheckMeta.js +22 -0
- package/lib/lib/wire.d.ts +4 -2
- package/lib/lib/wire.js +5 -1
- package/lib/renderers/ClientReportRenderer.js +1 -1
- package/package.json +16 -2
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { classifyEventLogAccessError } from '../eventLogAccess.js';
|
|
2
|
+
// EventLogFile types that carry unauthenticated guest request traffic. Sites is
|
|
3
|
+
// the primary guest-page channel; AuraRequest and GraphQlQueryExecution are the
|
|
4
|
+
// data-access vectors abused for recon and bulk read.
|
|
5
|
+
const GUEST_EVENT_TYPES = ['Sites', 'AuraRequest', 'GraphQlQueryExecution'];
|
|
6
|
+
// Illustrative seed of publicly-documented datacenter/hosting network prefixes.
|
|
7
|
+
// NON-EXHAUSTIVE and heuristic — this is a starting example, NOT a curated threat
|
|
8
|
+
// feed. Replace/extend it from your own IP-reputation source. The rationale:
|
|
9
|
+
// legitimate portal visitors browse from consumer ISPs, so guest *data* access
|
|
10
|
+
// from datacenter/VPN egress is a useful abuse signal. Matched by string prefix
|
|
11
|
+
// on CLIENT_IP. (Ranges below are well-known cloud provider blocks.)
|
|
12
|
+
const HOSTING_ANONYMIZER_PREFIXES = [
|
|
13
|
+
'2604:a880:', // DigitalOcean (IPv6)
|
|
14
|
+
'137.184.', // DigitalOcean
|
|
15
|
+
'146.190.', // DigitalOcean
|
|
16
|
+
'159.223.', // DigitalOcean
|
|
17
|
+
'165.227.', // DigitalOcean
|
|
18
|
+
];
|
|
19
|
+
const MAX_FILES = 20; // cap blobs downloaded per run
|
|
20
|
+
const MAX_FILE_BYTES = 60 * 1024 * 1024; // skip individual blobs larger than this
|
|
21
|
+
const BURST_THRESHOLD = 100; // guest requests from a single IP in the window
|
|
22
|
+
const RECON_DISTINCT_ENTITIES = 5; // distinct objects totalCount-probed from one IP
|
|
23
|
+
export class GuestTrafficAnomalyCheck {
|
|
24
|
+
id = 'guest-traffic-anomaly';
|
|
25
|
+
name = 'Guest Traffic Anomaly';
|
|
26
|
+
category = 'Threat Detection';
|
|
27
|
+
description = 'Scans recent EventLogFile guest requests for anonymizer/hosting source IPs, single-IP bursts, and GraphQL totalCount reconnaissance sweeps';
|
|
28
|
+
// Reuse EventMonitoringCheck's EventLogFile probe (enabled? readable?) instead of re-querying.
|
|
29
|
+
dependsOnCache = ['eventLogSummary'];
|
|
30
|
+
async run(ctx) {
|
|
31
|
+
const findings = [];
|
|
32
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/EventLogFile/home`;
|
|
33
|
+
// Guest user ids — needed to attribute EventLogFile rows to guests.
|
|
34
|
+
let guests;
|
|
35
|
+
try {
|
|
36
|
+
guests = await ctx.soql.queryAll("SELECT Id FROM User WHERE UserType = 'Guest' AND IsActive = true");
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
findings.push(this.inconclusive('guest-traffic-anomaly-users-inaccessible', 'Guest users could not be queried'));
|
|
40
|
+
return { findings };
|
|
41
|
+
}
|
|
42
|
+
if (guests.length === 0) {
|
|
43
|
+
findings.push({
|
|
44
|
+
id: 'guest-traffic-anomaly-none',
|
|
45
|
+
category: this.category,
|
|
46
|
+
riskLevel: 'LOW',
|
|
47
|
+
passed: true,
|
|
48
|
+
title: 'No active guest users',
|
|
49
|
+
detail: 'There are no active guest users, so there is no guest request traffic to analyze.',
|
|
50
|
+
remediation: 'If a public site is added later, re-run to baseline guest traffic.',
|
|
51
|
+
});
|
|
52
|
+
return { findings };
|
|
53
|
+
}
|
|
54
|
+
// EventLogFile stores the 15- or 18-char id; compare on the 15-char prefix.
|
|
55
|
+
const guestIds = new Set(guests.map((g) => g.Id.slice(0, 15)));
|
|
56
|
+
// Reuse EventMonitoringCheck's cached EventLogFile probe (no extra API call):
|
|
57
|
+
// decide whether it is even worth downloading blobs, and phrase the blind spot
|
|
58
|
+
// precisely when Event Monitoring is off or the audit user can't read the logs.
|
|
59
|
+
const summary = ctx.cache.eventLogSummary;
|
|
60
|
+
if (summary && summary.accessible === false) {
|
|
61
|
+
findings.push(this.accessBlind(summary.accessError ?? 'unknown', setupUrl));
|
|
62
|
+
return { findings };
|
|
63
|
+
}
|
|
64
|
+
if (summary && summary.accessible === true) {
|
|
65
|
+
if (summary.totalFiles === 0) {
|
|
66
|
+
findings.push(this.noLogs('Event Monitoring is enabled but produced no EventLogFile blobs in the retention window.', setupUrl));
|
|
67
|
+
return { findings };
|
|
68
|
+
}
|
|
69
|
+
if (!summary.eventTypes.some((t) => GUEST_EVENT_TYPES.includes(t))) {
|
|
70
|
+
findings.push({
|
|
71
|
+
id: 'guest-traffic-anomaly-clean',
|
|
72
|
+
category: this.category,
|
|
73
|
+
riskLevel: 'LOW',
|
|
74
|
+
passed: true,
|
|
75
|
+
title: 'No guest request event types captured by Event Monitoring',
|
|
76
|
+
detail: `Event Monitoring is active but captured none of ${GUEST_EVENT_TYPES.join('/')} recently, so there is no guest request traffic to analyze.`,
|
|
77
|
+
remediation: 'Confirm the guest-facing site is live and that Sites/AuraRequest/GraphQlQueryExecution event types are captured.',
|
|
78
|
+
});
|
|
79
|
+
return { findings };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
// Which guest event-log blobs exist in the retention window.
|
|
83
|
+
let files;
|
|
84
|
+
try {
|
|
85
|
+
const inList = GUEST_EVENT_TYPES.map((t) => `'${t}'`).join(', ');
|
|
86
|
+
files = await ctx.soql.queryAll(`SELECT Id, EventType, LogDate, LogFileLength FROM EventLogFile
|
|
87
|
+
WHERE EventType IN (${inList}) AND LogDate = LAST_N_DAYS:2 AND Interval = 'Daily'
|
|
88
|
+
ORDER BY LogDate DESC`);
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
// Standalone path (EventMonitoringCheck not in this run): classify the failure
|
|
92
|
+
// so "is Event Monitoring enabled / does the user have permission?" is still answered.
|
|
93
|
+
findings.push(this.accessBlind(classifyEventLogAccessError(e), setupUrl));
|
|
94
|
+
return { findings };
|
|
95
|
+
}
|
|
96
|
+
if (files.length === 0) {
|
|
97
|
+
findings.push(this.noLogs('No Sites/AuraRequest/GraphQlQueryExecution EventLogFile blobs were found in the last 2 days. Without Event Monitoring, retention is ~1 day, so absence here is BLIND, not proof of no abuse.', setupUrl));
|
|
98
|
+
return { findings };
|
|
99
|
+
}
|
|
100
|
+
// Download + parse blobs (bounded), keeping only guest rows.
|
|
101
|
+
const reqs = [];
|
|
102
|
+
let parsedFiles = 0;
|
|
103
|
+
for (const f of files.slice(0, MAX_FILES)) {
|
|
104
|
+
if (f.LogFileLength > MAX_FILE_BYTES)
|
|
105
|
+
continue;
|
|
106
|
+
let csv;
|
|
107
|
+
try {
|
|
108
|
+
csv = await ctx.rest.get(`/sobjects/EventLogFile/${f.Id}/LogFile`);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (typeof csv !== 'string' || csv.length === 0)
|
|
114
|
+
continue;
|
|
115
|
+
parsedFiles++;
|
|
116
|
+
this.parseGuestRows(csv, f.EventType, guestIds, reqs);
|
|
117
|
+
}
|
|
118
|
+
if (parsedFiles === 0) {
|
|
119
|
+
findings.push(this.inconclusive('guest-traffic-anomaly-blobs-unreadable', 'Guest event-log blobs could not be downloaded'));
|
|
120
|
+
return { findings };
|
|
121
|
+
}
|
|
122
|
+
if (reqs.length === 0) {
|
|
123
|
+
findings.push({
|
|
124
|
+
id: 'guest-traffic-anomaly-clean',
|
|
125
|
+
category: this.category,
|
|
126
|
+
riskLevel: 'LOW',
|
|
127
|
+
passed: true,
|
|
128
|
+
title: `No guest requests in ${parsedFiles} event-log file(s)`,
|
|
129
|
+
detail: 'The available guest event logs contained no rows attributable to an active guest user in the window.',
|
|
130
|
+
remediation: 'Continue forwarding guest event logs to a SIEM for anomaly alerting.',
|
|
131
|
+
});
|
|
132
|
+
return { findings };
|
|
133
|
+
}
|
|
134
|
+
// --- Aggregate per source IP ------------------------------------------------
|
|
135
|
+
const byIp = new Map();
|
|
136
|
+
for (const r of reqs) {
|
|
137
|
+
if (!r.ip)
|
|
138
|
+
continue;
|
|
139
|
+
const agg = byIp.get(r.ip) ?? { total: 0, reconEntities: new Set(), anonymizer: this.isHostingOrAnonymizer(r.ip) };
|
|
140
|
+
agg.total++;
|
|
141
|
+
if (r.eventType === 'GraphQlQueryExecution' && /totalcount/i.test(r.query)) {
|
|
142
|
+
const entity = this.extractEntity(r.query);
|
|
143
|
+
if (entity)
|
|
144
|
+
agg.reconEntities.add(entity);
|
|
145
|
+
}
|
|
146
|
+
byIp.set(r.ip, agg);
|
|
147
|
+
}
|
|
148
|
+
const reconIps = [...byIp.entries()].filter(([, a]) => a.reconEntities.size >= RECON_DISTINCT_ENTITIES);
|
|
149
|
+
const anonymizerIps = [...byIp.entries()].filter(([, a]) => a.anonymizer);
|
|
150
|
+
const burstIps = [...byIp.entries()].filter(([, a]) => a.total >= BURST_THRESHOLD);
|
|
151
|
+
if (reconIps.length > 0) {
|
|
152
|
+
findings.push({
|
|
153
|
+
id: 'guest-traffic-anomaly-recon',
|
|
154
|
+
category: this.category,
|
|
155
|
+
riskLevel: 'HIGH',
|
|
156
|
+
title: `${reconIps.length} source IP(s) ran a GraphQL object-enumeration (totalCount) sweep as a guest`,
|
|
157
|
+
detail: 'These unauthenticated source IPs issued GraphQL queries that request only totalCount across many distinct objects — the signature of reconnaissance that maps the guest-readable data surface before bulk extraction. This is exactly the pre-attack recon pattern seen through aura://RecordUiController/ACTION$executeGraphQL on Experience Cloud sites.',
|
|
158
|
+
remediation: 'Treat these IPs as hostile and block them at the WAF/CDN. Then close the surface they were mapping: set external OWD to Private, strip guest object read permissions, and enforce "Secure guest user record access". Enable Threat Detection storage and a Transaction Security Policy to catch this in real time.',
|
|
159
|
+
affectedItems: reconIps
|
|
160
|
+
.sort((a, b) => b[1].reconEntities.size - a[1].reconEntities.size)
|
|
161
|
+
.slice(0, 20)
|
|
162
|
+
.map(([ip, a]) => ({
|
|
163
|
+
label: `${ip} — probed ${a.reconEntities.size} objects (${a.total} requests)`,
|
|
164
|
+
note: [...a.reconEntities].slice(0, 12).join(', ') + (a.anonymizer ? ' [hosting/anonymizer IP]' : ''),
|
|
165
|
+
})),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (anonymizerIps.length > 0) {
|
|
169
|
+
findings.push({
|
|
170
|
+
id: 'guest-traffic-anomaly-anonymizer',
|
|
171
|
+
category: this.category,
|
|
172
|
+
riskLevel: 'HIGH',
|
|
173
|
+
title: `${anonymizerIps.length} guest source IP(s) originate from hosting/anonymizer ranges`,
|
|
174
|
+
detail: 'Guest (unauthenticated) requests arrived from datacenter/VPN/anonymizer egress ranges. Legitimate portal visitors browse from consumer ISPs; automated scraping and exfiltration typically egress from hosting or VPN infrastructure. (The prefix list is a heuristic seed — corroborate against a full IP-reputation feed.)',
|
|
175
|
+
remediation: 'Correlate these IPs with what they accessed, block hostile ranges at the WAF/CDN, and consider geo/ASN restrictions for a geographically-bounded audience. Feed a maintained IP-reputation list into your SIEM alerting.',
|
|
176
|
+
affectedItems: anonymizerIps
|
|
177
|
+
.sort((a, b) => b[1].total - a[1].total)
|
|
178
|
+
.slice(0, 20)
|
|
179
|
+
.map(([ip, a]) => ({ label: `${ip} — ${a.total} guest request(s)`, note: a.reconEntities.size ? `also probed ${a.reconEntities.size} objects` : undefined })),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (burstIps.length > 0) {
|
|
183
|
+
findings.push({
|
|
184
|
+
id: 'guest-traffic-anomaly-burst',
|
|
185
|
+
category: this.category,
|
|
186
|
+
riskLevel: 'MEDIUM',
|
|
187
|
+
title: `${burstIps.length} source IP(s) generated high-volume guest request bursts`,
|
|
188
|
+
detail: `A single source IP issued ${BURST_THRESHOLD}+ guest requests in the window, consistent with automated hammering (page/Aura endpoint flooding) rather than human browsing.`,
|
|
189
|
+
remediation: 'Rate-limit the Sites/Aura endpoints at the WAF/CDN and review whether these bursts correspond to scraping or a denial-of-service attempt.',
|
|
190
|
+
affectedItems: burstIps
|
|
191
|
+
.sort((a, b) => b[1].total - a[1].total)
|
|
192
|
+
.slice(0, 20)
|
|
193
|
+
.map(([ip, a]) => ({ label: `${ip} — ${a.total} guest request(s)`, note: a.anonymizer ? 'hosting/anonymizer IP' : undefined })),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (findings.length === 0) {
|
|
197
|
+
findings.push({
|
|
198
|
+
id: 'guest-traffic-anomaly-clean',
|
|
199
|
+
category: this.category,
|
|
200
|
+
riskLevel: 'LOW',
|
|
201
|
+
passed: true,
|
|
202
|
+
title: `No anomalous guest traffic in ${reqs.length} request(s)`,
|
|
203
|
+
detail: `Analyzed ${reqs.length} guest request(s) across ${parsedFiles} event-log file(s): no hosting/anonymizer IPs, no totalCount recon sweeps, and no single-IP bursts above ${BURST_THRESHOLD}.`,
|
|
204
|
+
remediation: 'Continue forwarding guest event logs to a SIEM; EventLogFile retention is short (~1–30 days), so durable alerting must live outside the org.',
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
return { findings };
|
|
208
|
+
}
|
|
209
|
+
/** Parse an EventLogFile CSV, pushing guest-attributed rows into `out`. */
|
|
210
|
+
parseGuestRows(csv, eventType, guestIds, out) {
|
|
211
|
+
const rows = this.parseCsv(csv);
|
|
212
|
+
if (rows.length < 2)
|
|
213
|
+
return;
|
|
214
|
+
const header = rows[0];
|
|
215
|
+
const idx = (names) => names.map((n) => header.indexOf(n)).find((i) => i >= 0) ?? -1;
|
|
216
|
+
const iUser = idx(['USER_ID_DERIVED', 'USER_ID']);
|
|
217
|
+
const iIp = idx(['CLIENT_IP', 'SOURCE_IP']);
|
|
218
|
+
const iQuery = idx(['QUERY', 'SOQL_QUERY']);
|
|
219
|
+
if (iUser < 0)
|
|
220
|
+
return; // cannot attribute to a guest
|
|
221
|
+
for (let r = 1; r < rows.length; r++) {
|
|
222
|
+
const row = rows[r];
|
|
223
|
+
const uid = (row[iUser] ?? '').slice(0, 15);
|
|
224
|
+
if (!guestIds.has(uid))
|
|
225
|
+
continue;
|
|
226
|
+
out.push({
|
|
227
|
+
ip: iIp >= 0 ? row[iIp] ?? '' : '',
|
|
228
|
+
eventType,
|
|
229
|
+
query: iQuery >= 0 ? row[iQuery] ?? '' : '',
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/** Minimal RFC-4180-ish CSV parser (handles quoted fields and embedded commas/quotes). */
|
|
234
|
+
parseCsv(text) {
|
|
235
|
+
const rows = [];
|
|
236
|
+
let field = '';
|
|
237
|
+
let row = [];
|
|
238
|
+
let inQuotes = false;
|
|
239
|
+
for (let i = 0; i < text.length; i++) {
|
|
240
|
+
const c = text[i];
|
|
241
|
+
if (inQuotes) {
|
|
242
|
+
if (c === '"') {
|
|
243
|
+
if (text[i + 1] === '"') {
|
|
244
|
+
field += '"';
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
else
|
|
248
|
+
inQuotes = false;
|
|
249
|
+
}
|
|
250
|
+
else
|
|
251
|
+
field += c;
|
|
252
|
+
}
|
|
253
|
+
else if (c === '"') {
|
|
254
|
+
inQuotes = true;
|
|
255
|
+
}
|
|
256
|
+
else if (c === ',') {
|
|
257
|
+
row.push(field);
|
|
258
|
+
field = '';
|
|
259
|
+
}
|
|
260
|
+
else if (c === '\n' || c === '\r') {
|
|
261
|
+
if (c === '\r' && text[i + 1] === '\n')
|
|
262
|
+
i++;
|
|
263
|
+
row.push(field);
|
|
264
|
+
field = '';
|
|
265
|
+
if (row.length > 1 || row[0] !== '')
|
|
266
|
+
rows.push(row);
|
|
267
|
+
row = [];
|
|
268
|
+
}
|
|
269
|
+
else
|
|
270
|
+
field += c;
|
|
271
|
+
}
|
|
272
|
+
if (field !== '' || row.length > 0) {
|
|
273
|
+
row.push(field);
|
|
274
|
+
rows.push(row);
|
|
275
|
+
}
|
|
276
|
+
return rows;
|
|
277
|
+
}
|
|
278
|
+
isHostingOrAnonymizer(ip) {
|
|
279
|
+
return HOSTING_ANONYMIZER_PREFIXES.some((p) => ip.startsWith(p));
|
|
280
|
+
}
|
|
281
|
+
/** Object name from a UI-API GraphQL body: `uiapi { query { <Entity> ... } }`. */
|
|
282
|
+
extractEntity(query) {
|
|
283
|
+
const m = query.match(/uiapi\s*\{\s*query\s*\{\s*(\w+)/i);
|
|
284
|
+
return m ? m[1] : null;
|
|
285
|
+
}
|
|
286
|
+
inconclusive(id, what) {
|
|
287
|
+
return {
|
|
288
|
+
id,
|
|
289
|
+
category: this.category,
|
|
290
|
+
riskLevel: 'INFO',
|
|
291
|
+
inconclusive: true,
|
|
292
|
+
title: `${what} (insufficient access)`,
|
|
293
|
+
detail: 'The audit user could not gather guest request logs. This may indicate Event Monitoring is not licensed or the audit user lacks "View Event Log Files".',
|
|
294
|
+
remediation: 'Grant "View Event Log Files" and ensure Event Monitoring is enabled, then re-run.',
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/** Blind spot: EventLogFile unreadable — distinguishes "not enabled" from "no permission". */
|
|
298
|
+
accessBlind(reason, setupUrl) {
|
|
299
|
+
const base = {
|
|
300
|
+
id: 'guest-traffic-anomaly-inaccessible',
|
|
301
|
+
category: this.category,
|
|
302
|
+
riskLevel: 'INFO',
|
|
303
|
+
inconclusive: true,
|
|
304
|
+
affectedItems: [{ label: 'Event Monitoring', url: setupUrl }],
|
|
305
|
+
};
|
|
306
|
+
if (reason === 'not-enabled') {
|
|
307
|
+
return {
|
|
308
|
+
...base,
|
|
309
|
+
title: 'Event Monitoring not enabled — guest traffic cannot be analyzed (BLIND)',
|
|
310
|
+
detail: 'EventLogFile is not accessible because Event Monitoring is not licensed/enabled in this org, so no guest request logs are captured. Anonymizer-IP, burst, and recon analysis cannot run — this is a blind spot, not an all-clear.',
|
|
311
|
+
remediation: 'License and enable Event Monitoring (Setup → Event Monitoring Settings), then forward guest event logs to a SIEM for durable retention and alerting.',
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (reason === 'no-permission') {
|
|
315
|
+
return {
|
|
316
|
+
...base,
|
|
317
|
+
title: 'Audit user lacks "View Event Log Files" — guest traffic cannot be analyzed (BLIND)',
|
|
318
|
+
detail: 'Event Monitoring appears enabled, but the running audit user cannot read EventLogFile (missing the "View Event Log Files" permission). Guest request logs exist but are unreadable to this user, so the result is blind, not clean.',
|
|
319
|
+
remediation: 'Grant the audit user the "View Event Log Files" permission (plus "API Enabled"), then re-run.',
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
...base,
|
|
324
|
+
title: 'Guest request logs could not be read — analysis skipped (BLIND)',
|
|
325
|
+
detail: 'EventLogFile could not be queried, and the cause could not be attributed to a missing licence or a missing permission. The result is blind, not clean.',
|
|
326
|
+
remediation: 'Verify Event Monitoring is enabled and the audit user holds "View Event Log Files", then re-run.',
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
/** Event Monitoring readable, but no guest blobs in the (short) retention window. */
|
|
330
|
+
noLogs(detail, setupUrl) {
|
|
331
|
+
return {
|
|
332
|
+
id: 'guest-traffic-anomaly-no-logs',
|
|
333
|
+
category: this.category,
|
|
334
|
+
riskLevel: 'LOW',
|
|
335
|
+
passed: true,
|
|
336
|
+
title: 'No guest event logs in the retention window',
|
|
337
|
+
detail: `${detail} Stream logs to a SIEM for durable coverage.`,
|
|
338
|
+
remediation: 'Enable Event Monitoring and forward guest event logs to a SIEM so this analysis has a durable window.',
|
|
339
|
+
affectedItems: [{ label: 'Event Monitoring', url: setupUrl }],
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=GuestTrafficAnomalyCheck.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Surfaces impersonation / delegated-administration paths that bypass a user's
|
|
5
|
+
* own credentials:
|
|
6
|
+
* - Delegated Administration groups (`DelegateGroup`): members can manage users
|
|
7
|
+
* and assign permissions within a scope — a lateral-movement / priv-esc path
|
|
8
|
+
* that admin-focused monitoring often misses.
|
|
9
|
+
* - "Administrators Can Log In as Any User" (org Login Access Policy): when on,
|
|
10
|
+
* any admin can impersonate any user and read all their data with no consent.
|
|
11
|
+
* This toggle is not cleanly API-exposed, so it is raised as an advisory.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LoginAccessPolicyCheck implements SecurityCheck {
|
|
14
|
+
readonly id = "login-access-policy";
|
|
15
|
+
readonly name = "Login-As & Delegated Administration";
|
|
16
|
+
readonly category = "Access Control";
|
|
17
|
+
readonly description = "Flags delegated-administration groups and the org login-as policy, which allow user impersonation and scoped admin escalation that bypass normal credentials";
|
|
18
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
19
|
+
/**
|
|
20
|
+
* "Administrators Can Log In as Any User". Read authoritatively from
|
|
21
|
+
* SecuritySettings metadata when a Metadata client is available; otherwise fall
|
|
22
|
+
* back to a manual-verification advisory.
|
|
23
|
+
*/
|
|
24
|
+
private addLoginAsPolicyFinding;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=LoginAccessPolicyCheck.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Surfaces impersonation / delegated-administration paths that bypass a user's
|
|
3
|
+
* own credentials:
|
|
4
|
+
* - Delegated Administration groups (`DelegateGroup`): members can manage users
|
|
5
|
+
* and assign permissions within a scope — a lateral-movement / priv-esc path
|
|
6
|
+
* that admin-focused monitoring often misses.
|
|
7
|
+
* - "Administrators Can Log In as Any User" (org Login Access Policy): when on,
|
|
8
|
+
* any admin can impersonate any user and read all their data with no consent.
|
|
9
|
+
* This toggle is not cleanly API-exposed, so it is raised as an advisory.
|
|
10
|
+
*/
|
|
11
|
+
export class LoginAccessPolicyCheck {
|
|
12
|
+
id = 'login-access-policy';
|
|
13
|
+
name = 'Login-As & Delegated Administration';
|
|
14
|
+
category = 'Access Control';
|
|
15
|
+
description = 'Flags delegated-administration groups and the org login-as policy, which allow user impersonation and scoped admin escalation that bypass normal credentials';
|
|
16
|
+
async run(ctx) {
|
|
17
|
+
const findings = [];
|
|
18
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
19
|
+
let groups;
|
|
20
|
+
try {
|
|
21
|
+
groups = await ctx.soql.queryAll('SELECT Id, DeveloperName FROM DelegateGroup');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
findings.push({
|
|
25
|
+
id: 'login-access-policy-inconclusive',
|
|
26
|
+
category: this.category,
|
|
27
|
+
riskLevel: 'INFO',
|
|
28
|
+
inconclusive: true,
|
|
29
|
+
title: 'Delegated administration could not be queried (insufficient access)',
|
|
30
|
+
detail: 'DelegateGroup was not accessible, so delegated-admin escalation paths could not be evaluated.',
|
|
31
|
+
remediation: 'Grant the audit user View Setup and Configuration, then re-run. Also manually verify Setup → Login Access Policies.',
|
|
32
|
+
});
|
|
33
|
+
return { findings };
|
|
34
|
+
}
|
|
35
|
+
if (groups.length > 0) {
|
|
36
|
+
findings.push({
|
|
37
|
+
id: 'login-access-policy-delegated-admins',
|
|
38
|
+
category: this.category,
|
|
39
|
+
riskLevel: 'MEDIUM',
|
|
40
|
+
title: `${groups.length} delegated administration group(s) configured`,
|
|
41
|
+
detail: 'Delegated administration groups let non-system-administrators manage users, reset passwords, and assign permission sets within a scope. Membership and the assignable permission sets are a privilege-escalation and lateral-movement path that is easy to overlook because these users are not full admins.',
|
|
42
|
+
remediation: 'Review each delegated group in Setup → Delegated Administration: confirm the delegated users are trusted, the manageable roles/objects are minimal, and the assignable permission sets do not include privileged permissions. Remove unused groups.',
|
|
43
|
+
affectedItems: groups.slice(0, 30).map((g) => ({
|
|
44
|
+
label: g.DeveloperName,
|
|
45
|
+
url: `${baseUrl}/lightning/setup/DelegateGroups/home`,
|
|
46
|
+
})),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
findings.push({
|
|
51
|
+
id: 'login-access-policy-ok',
|
|
52
|
+
category: this.category,
|
|
53
|
+
riskLevel: 'LOW',
|
|
54
|
+
passed: true,
|
|
55
|
+
title: 'No delegated administration groups configured',
|
|
56
|
+
detail: 'No DelegateGroup records exist, so there is no delegated-admin escalation surface.',
|
|
57
|
+
remediation: 'If delegated administration is introduced, scope each group minimally and review assignable permission sets.',
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
await this.addLoginAsPolicyFinding(ctx, findings);
|
|
61
|
+
return { findings };
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* "Administrators Can Log In as Any User". Read authoritatively from
|
|
65
|
+
* SecuritySettings metadata when a Metadata client is available; otherwise fall
|
|
66
|
+
* back to a manual-verification advisory.
|
|
67
|
+
*/
|
|
68
|
+
async addLoginAsPolicyFinding(ctx, findings) {
|
|
69
|
+
const baseUrl = ctx.orgInfo.instanceUrl;
|
|
70
|
+
const setupUrl = `${baseUrl}/lightning/setup/LoginAccessPolicies/home`;
|
|
71
|
+
if (ctx.metadata) {
|
|
72
|
+
let ss = null;
|
|
73
|
+
try {
|
|
74
|
+
ss = await ctx.metadata.read('SecuritySettings', 'Security');
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
ss = null;
|
|
78
|
+
}
|
|
79
|
+
if (ss && typeof ss.enableAdminLoginAsAnyUser === 'boolean') {
|
|
80
|
+
if (ss.enableAdminLoginAsAnyUser) {
|
|
81
|
+
findings.push({
|
|
82
|
+
id: 'login-access-policy-login-as-enabled',
|
|
83
|
+
category: this.category,
|
|
84
|
+
riskLevel: 'HIGH',
|
|
85
|
+
title: '"Administrators Can Log In as Any User" is ENABLED',
|
|
86
|
+
detail: 'The org policy "Administrators Can Log In as Any User" is enabled (confirmed from SecuritySettings). Any administrator can impersonate any user — including reading all of their records — with no per-session consent from that user, and the impersonation is easy to miss in monitoring.',
|
|
87
|
+
remediation: 'Disable "Administrators Can Log In as Any User" in Setup → Login Access Policies unless there is a documented support requirement. Require users to grant time-boxed login access instead, and alert on LoginAs events via Event Monitoring.',
|
|
88
|
+
affectedItems: [{ label: 'Login Access Policies', url: setupUrl }],
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
findings.push({
|
|
93
|
+
id: 'login-access-policy-login-as-disabled',
|
|
94
|
+
category: this.category,
|
|
95
|
+
riskLevel: 'LOW',
|
|
96
|
+
passed: true,
|
|
97
|
+
title: '"Administrators Can Log In as Any User" is disabled',
|
|
98
|
+
detail: 'SecuritySettings confirms administrators cannot log in as arbitrary users without their consent.',
|
|
99
|
+
remediation: 'Keep this disabled; grant login access per-user and time-boxed when support needs it.',
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// No Metadata client, or the field was not present — advisory fallback.
|
|
106
|
+
findings.push({
|
|
107
|
+
id: 'login-access-policy-login-as-advisory',
|
|
108
|
+
category: this.category,
|
|
109
|
+
riskLevel: 'INFO',
|
|
110
|
+
title: 'Verify the "Administrators Can Log In as Any User" policy manually',
|
|
111
|
+
detail: 'When "Administrators Can Log In as Any User" is enabled (Setup → Login Access Policies), any administrator can impersonate any user and access all of their data with no per-session consent. This run could not read SecuritySettings, so the policy must be confirmed manually.',
|
|
112
|
+
remediation: 'In Setup → Login Access Policies, disable "Administrators Can Log In as Any User" unless there is a documented support need, and require users to grant time-boxed login access instead.',
|
|
113
|
+
affectedItems: [{ label: 'Login Access Policies', url: setupUrl }],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=LoginAccessPolicyCheck.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Complements `failed-login-detection` (which only sees failures) by looking at
|
|
5
|
+
* SUCCESSFUL logins for a compromise signature: one user authenticating from an
|
|
6
|
+
* unusually large number of distinct source IPs in a short window — the footprint
|
|
7
|
+
* of credential sharing, a leaked token replayed from many egress nodes, or an
|
|
8
|
+
* account being driven from attacker infrastructure.
|
|
9
|
+
*/
|
|
10
|
+
export declare class LoginAnomalyCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "login-anomaly";
|
|
12
|
+
readonly name = "Anomalous Successful Logins";
|
|
13
|
+
readonly category = "Threat Detection";
|
|
14
|
+
readonly description = "Flags user accounts with successful logins from an unusually high number of distinct source IPs (credential-sharing / account-compromise signature)";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=LoginAnomalyCheck.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// A single account authenticating successfully from this many distinct source IPs
|
|
2
|
+
// in the window is a proxy for credential sharing or account compromise (a real
|
|
3
|
+
// person logs in from a small, stable set of networks).
|
|
4
|
+
const DISTINCT_IP_THRESHOLD = 8;
|
|
5
|
+
const MAX_ROWS = 20000;
|
|
6
|
+
/**
|
|
7
|
+
* Complements `failed-login-detection` (which only sees failures) by looking at
|
|
8
|
+
* SUCCESSFUL logins for a compromise signature: one user authenticating from an
|
|
9
|
+
* unusually large number of distinct source IPs in a short window — the footprint
|
|
10
|
+
* of credential sharing, a leaked token replayed from many egress nodes, or an
|
|
11
|
+
* account being driven from attacker infrastructure.
|
|
12
|
+
*/
|
|
13
|
+
export class LoginAnomalyCheck {
|
|
14
|
+
id = 'login-anomaly';
|
|
15
|
+
name = 'Anomalous Successful Logins';
|
|
16
|
+
category = 'Threat Detection';
|
|
17
|
+
description = 'Flags user accounts with successful logins from an unusually high number of distinct source IPs (credential-sharing / account-compromise signature)';
|
|
18
|
+
async run(ctx) {
|
|
19
|
+
const findings = [];
|
|
20
|
+
const setupUrl = `${ctx.orgInfo.instanceUrl}/lightning/setup/OrgLoginHistory/home`;
|
|
21
|
+
let rows;
|
|
22
|
+
try {
|
|
23
|
+
rows = await ctx.soql.queryAll(`SELECT UserId, SourceIp, LoginTime FROM LoginHistory
|
|
24
|
+
WHERE Status = 'Success' AND LoginTime = LAST_N_DAYS:7
|
|
25
|
+
ORDER BY LoginTime DESC LIMIT ${MAX_ROWS}`);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
findings.push({
|
|
29
|
+
id: 'login-anomaly-inconclusive',
|
|
30
|
+
category: this.category,
|
|
31
|
+
riskLevel: 'INFO',
|
|
32
|
+
inconclusive: true,
|
|
33
|
+
title: 'LoginHistory could not be queried — anomalous-login analysis skipped',
|
|
34
|
+
detail: 'LoginHistory was not accessible. This may indicate the audit user lacks "View All Users"/"Manage Users" or the org restricts login history.',
|
|
35
|
+
remediation: 'Grant the audit user access to LoginHistory and re-run.',
|
|
36
|
+
});
|
|
37
|
+
return { findings };
|
|
38
|
+
}
|
|
39
|
+
if (rows.length === 0) {
|
|
40
|
+
findings.push({
|
|
41
|
+
id: 'login-anomaly-none',
|
|
42
|
+
category: this.category,
|
|
43
|
+
riskLevel: 'LOW',
|
|
44
|
+
passed: true,
|
|
45
|
+
title: 'No successful logins in the last 7 days',
|
|
46
|
+
detail: 'LoginHistory returned no successful logins in the window, so no login-distribution anomaly could be computed.',
|
|
47
|
+
remediation: 'Re-run after normal activity; forward LoginHistory to a SIEM for continuous anomaly detection.',
|
|
48
|
+
});
|
|
49
|
+
return { findings };
|
|
50
|
+
}
|
|
51
|
+
const ipsByUser = new Map();
|
|
52
|
+
for (const r of rows) {
|
|
53
|
+
if (!r.SourceIp)
|
|
54
|
+
continue;
|
|
55
|
+
const set = ipsByUser.get(r.UserId) ?? new Set();
|
|
56
|
+
set.add(r.SourceIp);
|
|
57
|
+
ipsByUser.set(r.UserId, set);
|
|
58
|
+
}
|
|
59
|
+
const anomalous = [...ipsByUser.entries()].filter(([, ips]) => ips.size >= DISTINCT_IP_THRESHOLD);
|
|
60
|
+
if (rows.length >= MAX_ROWS) {
|
|
61
|
+
findings.push({
|
|
62
|
+
id: 'login-anomaly-truncated',
|
|
63
|
+
category: this.category,
|
|
64
|
+
riskLevel: 'INFO',
|
|
65
|
+
title: `Login history truncated at ${MAX_ROWS} rows — analysis is partial`,
|
|
66
|
+
detail: `The last-7-day successful-login volume exceeded ${MAX_ROWS} rows, so this analysis covers only the most recent window. Some per-user IP spread may be undercounted.`,
|
|
67
|
+
remediation: 'Forward LoginHistory to a SIEM for complete, continuous analysis rather than point-in-time sampling.',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (anomalous.length > 0) {
|
|
71
|
+
findings.push({
|
|
72
|
+
id: 'login-anomaly-multi-ip',
|
|
73
|
+
category: this.category,
|
|
74
|
+
riskLevel: 'MEDIUM',
|
|
75
|
+
title: `${anomalous.length} account(s) logged in from ${DISTINCT_IP_THRESHOLD}+ distinct source IPs in 7 days`,
|
|
76
|
+
detail: 'These accounts authenticated successfully from an unusually large number of distinct source IPs in a week. That pattern is consistent with credential sharing, a leaked session/token being replayed from many egress nodes, or an account driven from distributed attacker infrastructure.',
|
|
77
|
+
remediation: 'Investigate these accounts: confirm the logins are legitimate, reset credentials and revoke sessions if not, and enforce MFA + login IP ranges. Consider a Transaction Security Policy that alerts on logins from new geographies/IPs.',
|
|
78
|
+
affectedItems: anomalous
|
|
79
|
+
.sort((a, b) => b[1].size - a[1].size)
|
|
80
|
+
.slice(0, 30)
|
|
81
|
+
.map(([userId, ips]) => ({ label: `${userId} — ${ips.size} distinct IPs`, url: setupUrl })),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
findings.push({
|
|
86
|
+
id: 'login-anomaly-ok',
|
|
87
|
+
category: this.category,
|
|
88
|
+
riskLevel: 'LOW',
|
|
89
|
+
passed: true,
|
|
90
|
+
title: 'No accounts with an anomalous login-IP spread',
|
|
91
|
+
detail: `Across ${rows.length} successful login(s) in 7 days, no account authenticated from ${DISTINCT_IP_THRESHOLD}+ distinct source IPs.`,
|
|
92
|
+
remediation: 'Continue forwarding LoginHistory to a SIEM for continuous anomaly detection.',
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { findings };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=LoginAnomalyCheck.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AuditContext } from '../../context/AuditContext.js';
|
|
2
|
+
import type { SecurityCheck, CheckResult } from '../SecurityCheck.js';
|
|
3
|
+
/**
|
|
4
|
+
* Advisory for sandboxes: production data copied into a sandbox and left unmasked
|
|
5
|
+
* spreads real PII/PHI into a lower-trust environment with weaker controls and
|
|
6
|
+
* broader developer access. This check runs only in sandboxes and looks for
|
|
7
|
+
* populated PII fields as a proxy for "prod data present" — it cannot prove
|
|
8
|
+
* whether Data Mask has run, so it raises an advisory to confirm masking.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SandboxDataMaskingCheck implements SecurityCheck {
|
|
11
|
+
readonly id = "sandbox-data-masking";
|
|
12
|
+
readonly name = "Sandbox Data Masking";
|
|
13
|
+
readonly category = "Data Security";
|
|
14
|
+
readonly description = "In sandboxes, flags the presence of populated PII fields (likely unmasked production data) and advises running Salesforce Data Mask";
|
|
15
|
+
run(ctx: AuditContext): Promise<CheckResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=SandboxDataMaskingCheck.d.ts.map
|