@cclabsnz/sf-audit 1.22.0 → 1.23.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/CHANGELOG.md +19 -0
- package/lib/chains/CapabilityRegistry.js +1 -1
- package/lib/chains/namedChains.js +13 -7
- package/lib/checks/impl/ApexCrudFLSCheck.js +1 -1
- package/lib/checks/impl/HardcodedCredentialsCheck.js +3 -1
- package/lib/checks/impl/MfaMethodStrengthCheck.js +4 -3
- package/lib/checks/impl/MfaRegistrationCheck.js +15 -0
- package/lib/renderers/ClientReportRenderer.d.ts +2 -0
- package/lib/renderers/ClientReportRenderer.js +18 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,25 @@ published note and carries the signed provenance attestation and CycloneDX SBOM
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [v1.23.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.23.0) — 2026-10-29
|
|
13
|
+
|
|
14
|
+
Attack chains and checks now match what the platform does. One chain is re-rated, so some grades may
|
|
15
|
+
rise.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **`cred-theft-pivot` is rated HIGH, not CRITICAL.** Its secret is found by pattern match. Its egress steps are mostly the org's own registered endpoints, which give an attacker who holds the secret nothing new. Orgs where this chain fires no longer count it as a critical chain in the grade.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **The unauthenticated bulk-exfiltration chain no longer counts external sharing defaults as an unauthenticated step.** Guest record access has been secured since Winter '21, so the external OWD reaches logged-in portal users, not guests. Those findings stay in the low-trust chains, such as self-registration.
|
|
24
|
+
- **The hardcoded-credential check no longer flags a value read at run time.** A credential parameter built from a stored value, such as `'client_secret=' + EncodingUtil.urlEncode(cfg.Secret__c, 'UTF-8')`, was matched as a hardcoded secret.
|
|
25
|
+
- **The CRUD/FLS finding gives the CRUD/FLS remedy.** It now leads with `WITH USER_MODE` or `Security.stripInaccessible()`. Before, it led with "with sharing", which enforces record sharing only and duplicated the sharing finding's advice.
|
|
26
|
+
- **The self-registration chain tells one story.** It no longer calls self-registration "not a finding" while making it the break point. Its remediation leads with turning self-registration off, or with a custom registration handler that approves accounts.
|
|
27
|
+
- **Each attack-scenario slide states its chain's rating against its steps.** This covers a chain rated above its steps, and a chain whose critical step is also counted on its own in the grade.
|
|
28
|
+
- **MFA results no longer read as assurance about nobody.** When no active standard user is visible, the registration check is now inconclusive instead of "All 0 users have registered". The audit user is itself one, so a count of 0 means the users could not be seen. When no one has registered a method, the method-strength check reports an informational "not graded" finding instead of a pass, and notes that this is expected with single sign-on.
|
|
29
|
+
- **The executive scope statement matches what the audit reads.** It reads configuration, metadata, selected records and event logs, including pattern-based static checks of Apex and Flow. It is not a penetration test or a code review. Readers are asked to confirm each finding in the org.
|
|
30
|
+
|
|
12
31
|
## [v1.22.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.22.0) — 2026-10-29
|
|
13
32
|
|
|
14
33
|
The executive report is now a consulting-style deck that leads with what to do, with the threat
|
|
@@ -142,7 +142,7 @@ export const CAPABILITY_REGISTRY = {
|
|
|
142
142
|
'content-links-no-expiry': { grants: ['data-read'] },
|
|
143
143
|
'content-links-no-password': { grants: ['data-read'] },
|
|
144
144
|
// Self-registration is how an attacker obtains the account that every external-sharing finding
|
|
145
|
-
// already assumes they have. On its own it
|
|
145
|
+
// already assumes they have. On its own it gives an account only its own records; it earns a
|
|
146
146
|
// capability because 'sharing-model-external-*' grants reach to whoever holds an account, and
|
|
147
147
|
// this is the finding that says anyone may hold one.
|
|
148
148
|
'experience-cloud-site-self-registration': { grants: ['low-trust-authenticated'], techniques: { 'low-trust-authenticated': ['T1136.003', 'T1078.004'] } },
|
|
@@ -52,7 +52,9 @@ export const UNAUTH_EXFIL_STEPS = [
|
|
|
52
52
|
'guest-object-exposure-public-owd', 'guest-object-exposure-guest-owned',
|
|
53
53
|
'guest-api-access-enabled', 'guest-api-hard-delete', 'classic-sites-active',
|
|
54
54
|
'guest-user-visibility-view-all-users', 'guest-user-visibility-owd', 'guest-user-visibility-object-read',
|
|
55
|
-
|
|
55
|
+
// Not 'sharing-model-external-*': since Winter '21 guest record access is always secured, so the
|
|
56
|
+
// external OWD reaches logged-in portal users, not guests. Those findings drive the low-trust chains.
|
|
57
|
+
'portal-exposed-apex-without-sharing',
|
|
56
58
|
'field-level-security-high', 'field-level-security-medium',
|
|
57
59
|
// The guardrail whose absence lets guest-owned records defeat a Private OWD, and the Flow
|
|
58
60
|
// analogue of portal-exposed Apex running without sharing.
|
|
@@ -326,7 +328,9 @@ export const NAMED_CHAINS = [
|
|
|
326
328
|
{
|
|
327
329
|
id: 'cred-theft-pivot',
|
|
328
330
|
title: 'Credential theft to external pivot',
|
|
329
|
-
|
|
331
|
+
// HIGH, not CRITICAL: the secret is found by pattern match, and the egress steps are mostly the
|
|
332
|
+
// org's own registered endpoints, which give an attacker holding the secret nothing they lack.
|
|
333
|
+
severity: 'HIGH',
|
|
330
334
|
narrative: 'Exposed secrets (hardcoded credentials, credentials in custom labels or settings, or enabled device or password OAuth flows) ' +
|
|
331
335
|
'combine with an external egress path (named credential, remote site or Flow callout) to exfiltrate data to attacker infrastructure.',
|
|
332
336
|
remediation: 'Rotate and remove exposed secrets, and review external callout endpoints.',
|
|
@@ -635,11 +639,13 @@ export const NAMED_CHAINS = [
|
|
|
635
639
|
'login IP ranges and SSO all behave exactly as configured and none of them object, because ' +
|
|
636
640
|
'nothing here is a bypass. What the attacker gets is decided entirely by the external OWD, ' +
|
|
637
641
|
'the portal profile and whether the Apex or Flow reachable from the site enforces sharing. ' +
|
|
638
|
-
'
|
|
639
|
-
'assumes an account the attacker may never obtain.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
'
|
|
642
|
+
'Neither half makes the path on its own: a self-registered account with only its own records ' +
|
|
643
|
+
'reaches nothing, and the sharing model assumes an account the attacker may never obtain. ' +
|
|
644
|
+
'The pair is the path.',
|
|
645
|
+
remediation: 'Turn self-registration off, or route it through a custom registration handler that approves ' +
|
|
646
|
+
'each account before it gets access: that restores the ' +
|
|
647
|
+
'assumption every other control depends on. If the site must stay open, close the other half ' +
|
|
648
|
+
'instead and treat the self-registration profile as hostile input: ' +
|
|
643
649
|
'set external OWD to Private and grant through sharing sets rather than org-wide defaults, ' +
|
|
644
650
|
'and make sure Apex and Flows reachable from the site run with sharing. Check what the ' +
|
|
645
651
|
'self-registration handler assigns as the default profile and licence — the exposure is ' +
|
|
@@ -78,7 +78,7 @@ export class ApexCrudFLSCheck {
|
|
|
78
78
|
riskLevel: 'HIGH',
|
|
79
79
|
title: `${withoutSharingNoFls.length} Apex class(es) run "without sharing" and perform DML/SOQL without CRUD/FLS checks`,
|
|
80
80
|
detail: `Apex classes declared "without sharing" bypass record-level visibility AND have no field-level or object-level permission checks, meaning any user who triggers the code can read or write any record and field regardless of their assigned permissions. This is the most exploited Salesforce access control vulnerability. OWASP Salesforce Top 10 ranks CRUD/FLS bypass as the #1 risk.`,
|
|
81
|
-
remediation: '
|
|
81
|
+
remediation: 'Enforce object and field permissions with `WITH USER_MODE`, or `Security.stripInaccessible()` before DML and `Schema.SObjectType.[Object].fields.[Field].isAccessible()` before displaying fields. "with sharing" alone does not do this: it enforces record sharing only. Declare "with sharing" too where possible, and where "without sharing" is required for a technical reason, document the justification and tighten the scope.',
|
|
82
82
|
affectedItems: withoutSharingNoFls.slice(0, 30).map((n) => ({
|
|
83
83
|
label: n,
|
|
84
84
|
url: apexClassesUrl,
|
|
@@ -5,7 +5,9 @@ const HIGH_RISK_PATTERNS = [
|
|
|
5
5
|
/Basic\s+[A-Za-z0-9+/]{20,}=*/gi, // Basic auth (min length)
|
|
6
6
|
/Authorization['":\s]+['"](Bearer|Basic)/gi, // Auth header construction
|
|
7
7
|
// Credential variable assignments with a string literal RHS (single or double quoted)
|
|
8
|
-
|
|
8
|
+
// The literal must end the expression, so "'client_secret=' + EncodingUtil.urlEncode(cfg.Secret__c, 'UTF-8')"
|
|
9
|
+
// (a value read at run time) does not match.
|
|
10
|
+
/(?:password|passwd|secret|apiKey|api_key|clientSecret|client_secret|accessToken|access_token|authToken|auth_token)\s*[=+]\s*['"][^'"]{8,}['"]\s*[;,)]/gi,
|
|
9
11
|
];
|
|
10
12
|
const ENDPOINT_PATTERN = /\.setEndpoint\s*\(\s*'(https?:\/\/[^']+)'/gi;
|
|
11
13
|
const IS_TEST_CLASS = /@IsTest\b/i;
|
|
@@ -45,9 +45,10 @@ export class MfaMethodStrengthCheck {
|
|
|
45
45
|
id: 'mfa-method-strength-none-registered',
|
|
46
46
|
category: this.category,
|
|
47
47
|
riskLevel: 'INFO',
|
|
48
|
-
passed
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// Nothing was graded, so it is no assurance about method strength (not passed); the data was
|
|
49
|
+
// read, so it is not inconclusive either. INFO carries no penalty under the default scoring.
|
|
50
|
+
title: 'MFA method strength not graded: no user has registered a method',
|
|
51
|
+
detail: 'No active internal user has a registered MFA method in Salesforce, so there is no method strength to assess. With single sign-on, MFA happens at the identity provider and this is expected; otherwise missing registration is reported by the MFA registration check.',
|
|
51
52
|
remediation: 'None for method strength. Address MFA registration coverage first.',
|
|
52
53
|
});
|
|
53
54
|
return { findings };
|
|
@@ -62,6 +62,21 @@ export class MfaRegistrationCheck {
|
|
|
62
62
|
}));
|
|
63
63
|
const registeredCount = userMethodMap.size;
|
|
64
64
|
const unregisteredCount = Math.max(0, totalActiveUsers - registeredCount);
|
|
65
|
+
// The audit user is itself an active standard user, so a count of 0 means the count could not
|
|
66
|
+
// see users, not that there are none: inconclusive, never a pass.
|
|
67
|
+
if (totalActiveUsers === 0) {
|
|
68
|
+
findings.push({
|
|
69
|
+
id: 'mfa-registration-no-users-visible',
|
|
70
|
+
category: this.category,
|
|
71
|
+
riskLevel: 'INFO',
|
|
72
|
+
inconclusive: true,
|
|
73
|
+
title: 'No active standard users were visible: MFA registration cannot be checked',
|
|
74
|
+
detail: 'The count of active, unfrozen standard users returned 0, although the audit user is one. The audit user may not be able to read User records.',
|
|
75
|
+
remediation: 'Grant the audit user "View Setup and Configuration" and "Manage Users" read access, then re-run, or review MFA registration manually in Setup → Identity → Identity Verification.',
|
|
76
|
+
affectedItems: [{ label: 'Identity Verification Setup', url: setupUrl }],
|
|
77
|
+
});
|
|
78
|
+
return { findings };
|
|
79
|
+
}
|
|
65
80
|
if (unregisteredCount === 0) {
|
|
66
81
|
findings.push({
|
|
67
82
|
id: 'mfa-registration-ok',
|
|
@@ -28,6 +28,8 @@ export declare class ClientReportRenderer implements AuditRenderer {
|
|
|
28
28
|
private stepMeta;
|
|
29
29
|
private steps;
|
|
30
30
|
private chainSlide;
|
|
31
|
+
/** Why a chain is rated above or below its steps, so the rating never looks like an error. */
|
|
32
|
+
private ratingNote;
|
|
31
33
|
private potentialSlide;
|
|
32
34
|
private roadmapPage;
|
|
33
35
|
private worst;
|
|
@@ -479,7 +479,7 @@ ${head}<div class="content">${s.body}</div>
|
|
|
479
479
|
const cheap = big.filter((x) => x.a.effort !== 'project').map((x) => x.n);
|
|
480
480
|
const costly = big.filter((x) => x.a.effort === 'project').map((x) => x.n);
|
|
481
481
|
const headline = realMax === 0 ? 'None of these actions removes critical or high-severity risk'
|
|
482
|
-
: cheap.length && costly.length ? `Action${cheap.length === 1 ? '' : 's'} ${nums(cheap)} ${verb(cheap.length, 'is', 'are')} the cheapest large risk reduction${cheap.length === 1 ? '' : 's'}; ${nums(costly)} ${verb(costly.length, 'removes', 'remove')}
|
|
482
|
+
: cheap.length && costly.length ? `Action${cheap.length === 1 ? '' : 's'} ${nums(cheap)} ${verb(cheap.length, 'is', 'are')} the cheapest large risk reduction${cheap.length === 1 ? '' : 's'}; ${nums(costly)} also ${verb(costly.length, 'removes', 'remove')} large risk but ${verb(costly.length, 'needs', 'need')} project funding`
|
|
483
483
|
: cheap.length ? `Action${cheap.length === 1 ? '' : 's'} ${nums(cheap)} remove${cheap.length === 1 ? 's' : ''} the most risk for days of work or less`
|
|
484
484
|
: `The largest risk reductions (${nums(costly)}) need project funding`;
|
|
485
485
|
const key = shown.map((a, i) => `<li><span class="num w${a.wave}">${i + 1}</span><span>${esc(a.title)}</span><span class="e">${EFFORT_LABEL[a.effort]}</span></li>`).join('');
|
|
@@ -644,9 +644,24 @@ ${pts}<div class="yl"><span>Risk removed →</span></div><div class="xl"><span>U
|
|
|
644
644
|
<div class="narr"><p>${esc(c.narrative)}</p></div>
|
|
645
645
|
<div class="breaks"><p><strong>Breaks the chain:</strong> ${esc(c.abuseCase.breakPoint)}</p></div>
|
|
646
646
|
<div class="full"><p><strong>Full remediation:</strong> ${esc(c.remediation)}</p></div></div></div>`,
|
|
647
|
-
source:
|
|
647
|
+
source: `${this.ratingNote(c)}Steps run in attack order. Steps marked ✂ are the break point: fixing all of them stops the chain. References point to the findings appendix.`,
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
+
/** Why a chain is rated above or below its steps, so the rating never looks like an error. */
|
|
651
|
+
ratingNote(c) {
|
|
652
|
+
const steps = c.steps.map((s) => s.severity).filter((x) => !!x);
|
|
653
|
+
if (!steps.length)
|
|
654
|
+
return '';
|
|
655
|
+
const worst = steps.reduce((a, b) => (SEV_RANK[b] < SEV_RANK[a] ? b : a));
|
|
656
|
+
const chain = cap(c.severity.toLowerCase());
|
|
657
|
+
if (SEV_RANK[c.severity] < SEV_RANK[worst]) {
|
|
658
|
+
return `Rated ${chain} as a path; its steps are rated up to ${worst.toLowerCase()}. `;
|
|
659
|
+
}
|
|
660
|
+
if (SEV_RANK[c.severity] > SEV_RANK[worst]) {
|
|
661
|
+
return `Rated ${chain} as a path; its ${worst.toLowerCase()} step is also counted on its own in the findings and the grade. `;
|
|
662
|
+
}
|
|
663
|
+
return '';
|
|
664
|
+
}
|
|
650
665
|
potentialSlide(list) {
|
|
651
666
|
const rows = list.map(({ c, i }) => `<tr><td style="width:56px;color:var(--accent);font-weight:700">${this.labels[i]}</td><td><strong>${esc(c.title)}</strong><div style="font-size:13.5px;margin-top:4px;color:#3a434d">${esc(c.narrative)}</div><div class="muted" style="font-size:13px;margin-top:4px">${c.steps.map((s) => title(s.title || s.findingId)).join(' → ')}</div></td><td style="width:42%"><div class="breaks potential" style="margin-top:0"><p><strong>Recommended fixes:</strong> ${esc(c.remediation)}</p></div></td></tr>`).join('');
|
|
652
667
|
return {
|
|
@@ -753,7 +768,7 @@ ${this.footer(b)}`,
|
|
|
753
768
|
? ` · <a href="https://${esc(b.website.replace(/^https?:\/\//, ''))}">${esc(b.website.replace(/^https?:\/\//, ''))}</a>`
|
|
754
769
|
: '';
|
|
755
770
|
return `<footer><span class="lbl">Scope & Liability</span>
|
|
756
|
-
Read-only, point-in-time configuration
|
|
771
|
+
Read-only, point-in-time review of configuration, metadata, selected records and event logs, including pattern-based static checks of Apex and Flow: not a penetration test and not a code review. The grade is a prioritisation aid, not a certification. Confirm each finding in the org before changing production. © ${new Date().getFullYear()} ${esc(b.firmName)} · ${esc(b.contact)}${site}<br>${toolCreditHtml('executive-report')}</footer>`;
|
|
757
772
|
}
|
|
758
773
|
}
|
|
759
774
|
//# sourceMappingURL=ClientReportRenderer.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Read-only Salesforce security audit for the sf CLI: 109 checks, attack-chain correlation, A-F risk grading, compliance mapping, free EventLogFile capture, and Guest User Anomaly investigation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"salesforce",
|