@cclabsnz/sf-audit 1.21.1 → 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 CHANGED
@@ -9,6 +9,43 @@ 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
+
31
+ ## [v1.22.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.22.0) — 2026-10-29
32
+
33
+ The executive report is now a consulting-style deck that leads with what to do, with the threat
34
+ model on its own slides.
35
+
36
+ ### Changed
37
+
38
+ - **The executive report is now a consulting-style deck.** Every slide's title states its conclusion, and a note under each exhibit says where its numbers come from. In order:
39
+ - **Cover**: grade and health score, kept small.
40
+ - **Executive summary**: situation, complication and resolution.
41
+ - **Where to act**: the actions placed on risk removed against effort.
42
+ - **Action plan**: ranked actions in three waves (start now, next 30 days, this quarter). For each, what it breaks, the findings it closes, effort, and an owner to agree.
43
+ - **Threat model**: a MITRE ATT&CK slide (findings per tactic, and the tactics each attack chain reaches) and a STRIDE and LINDDUN heatmap.
44
+ - **Attack scenarios**: one slide per named attack chain, and one for the potential chains.
45
+ - **Appendix and sign-off**: roadmap, compliance, findings, and a sign-off page.
46
+ - **Actions are computed, not listed.** Each named chain's break point becomes the action that breaks it (chains sharing a break point share it). Every other open critical or high finding becomes an action per check. Actions are ranked by the risk they remove, with a broken chain counting double.
47
+ - **It prints one slide per landscape A4 page.** Every printed page names its client, date and page. Fonts are Source Serif 4 and Source Sans 3, embedded so the report never fetches anything. A firm's own colours and fonts still apply when it has set them.
48
+
12
49
  ## [v1.21.1](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.21.1) — 2026-10-28
13
50
 
14
51
  ### Fixed
@@ -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 is a supported feature and harmless; it earns a
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
- 'portal-exposed-apex-without-sharing', 'sharing-model-external-read', 'sharing-model-external-write',
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
- severity: 'CRITICAL',
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
- 'Self-registration alone is a supported feature and not a finding; the sharing model alone ' +
639
- 'assumes an account the attacker may never obtain. The pair is the path.',
640
- remediation: 'Decide which half to close, because either breaks the chain. Turning self-registration off, ' +
641
- 'or putting an approval step in front of it, restores the assumption every other control ' +
642
- 'depends on. Leaving it on means treating the self-registration profile as hostile input: ' +
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: 'Refactor to use "with sharing" where possible. Add `Security.stripInaccessible()` before DML and `Schema.SObjectType.[Object].fields.[Field].isAccessible()` before displaying fields. Where "without sharing" is required for a technical reason, document the justification and tighten the scope.',
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
- /(?:password|passwd|secret|apiKey|api_key|clientSecret|client_secret|accessToken|access_token|authToken|auth_token)\s*[=+]\s*['"][^'"]{8,}['"]/gi,
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: true,
49
- title: 'No registered MFA methods to grade',
50
- detail: 'No active internal user has a registered MFA method, so there is no method strength to assess. Missing registration itself is reported by the MFA registration check.',
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',
@@ -77,7 +77,7 @@ export default class SecurityAuditCommand extends SfCommand {
77
77
  helpValue: './report-branding.json',
78
78
  }),
79
79
  top: Flags.integer({
80
- summary: 'Number of executive priorities to highlight (executive format).',
80
+ summary: 'Number of top actions to plot on the deck\'s "Where to act" slide, up to 10 (executive format). The action plan lists every action.',
81
81
  default: 5,
82
82
  }),
83
83
  frameworks: Flags.string({
@@ -12,20 +12,32 @@ export declare class ClientReportRenderer implements AuditRenderer {
12
12
  readonly format = "executive";
13
13
  readonly fileExtension = ".html";
14
14
  readonly filenamePrefix = "SF_Audit_Executive";
15
+ private refs;
16
+ private labels;
15
17
  constructor(opts: ClientReportOptions);
16
18
  render(result: AuditResult): string;
17
- private chip;
18
- private sectionHead;
19
- private cover;
20
- private summary;
21
- private prioritiesSection;
22
- private coverageNote;
23
- private waiversSection;
24
- private scenarios;
25
- private roadmapSection;
19
+ private css;
20
+ private slide;
21
+ private tag;
22
+ private gradeColor;
23
+ private coverSlide;
24
+ private summarySlide;
25
+ private matrixSlide;
26
+ private planSlides;
27
+ private threatSlides;
28
+ private stepMeta;
29
+ private steps;
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;
33
+ private potentialSlide;
34
+ private roadmapPage;
26
35
  private worst;
27
- private matrixSection;
28
- private findingsAppendix;
36
+ private matrixPage;
37
+ private waiversPage;
38
+ private coverageNote;
39
+ private findingsPage;
40
+ private signOffPage;
29
41
  private footer;
30
42
  }
31
43
  //# sourceMappingURL=ClientReportRenderer.d.ts.map