@cclabsnz/sf-audit 1.26.0 → 1.27.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 +35 -0
- package/README.md +14 -2
- package/lib/checks/selection.d.ts +13 -0
- package/lib/checks/selection.js +24 -0
- package/lib/commands/audit/explain.d.ts +16 -0
- package/lib/commands/audit/explain.js +79 -0
- package/lib/commands/audit/security.d.ts +4 -2
- package/lib/commands/audit/security.js +22 -2
- package/lib/findings/status.d.ts +8 -0
- package/lib/findings/status.js +20 -0
- package/lib/findings/summary.d.ts +59 -0
- package/lib/findings/summary.js +48 -0
- package/lib/renderers/HtmlRenderer.js +3 -20
- package/lib/report/ActionPlan.d.ts +2 -0
- package/lib/report/ActionPlan.js +5 -0
- package/lib/report/explain.d.ts +63 -0
- package/lib/report/explain.js +102 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,41 @@ published note and carries the signed provenance attestation and CycloneDX SBOM
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [v1.27.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.27.0) — 2026-11-11
|
|
13
|
+
|
|
14
|
+
sf-audit is now easier for an AI agent to drive. `--summary` returns page one of the report as
|
|
15
|
+
compact JSON, `sf audit explain` explains a check or a finding, and a Claude Code plugin in this repo
|
|
16
|
+
runs the audit and triages it. `--checks` now works for any selection. No check or score changes.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **A Claude Code plugin** in `claude-plugin/`, installable with
|
|
21
|
+
`/plugin install sf-audit --marketplace cclabsnz/sf-audit-plugin`. It runs the audit and
|
|
22
|
+
reports page one: the grade and why, coverage, what to fix first and the attack paths. It then
|
|
23
|
+
explains any finding and compares runs (`/sf-audit:audit`, `/sf-audit:fix-first`,
|
|
24
|
+
`/sf-audit:explain`, `/sf-audit:diff`). It needs this CLI at 1.27.0 or later. It is not part of
|
|
25
|
+
the npm package.
|
|
26
|
+
- **`--summary`**, with `--json`: page one of the report as data. It gives the grade and its reason,
|
|
27
|
+
evidence coverage, counts, the fix-first plan and the attack paths, labelled C1 and P1 as in the
|
|
28
|
+
reports. Each action lists the ids of the findings it closes. It carries no detail prose or
|
|
29
|
+
affected lists, so it is a fraction of `--digest`'s size, and it is meant for an agent to triage
|
|
30
|
+
before reading further.
|
|
31
|
+
- **`sf audit explain <id>`**. With a check id it gives what the check looks for, its domain,
|
|
32
|
+
typical effort, why it matters and its compliance mapping. With `--file` and a finding id from a
|
|
33
|
+
run it gives what the finding affects, the attack chains it is part of (and whether fixing it
|
|
34
|
+
breaks them) and the fix-first action that closes it. With `--file` and a check id it lists that
|
|
35
|
+
check's findings in the run. Works offline.
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **`--checks` runs any selection.** A check that reads data another check collects (Apex bodies,
|
|
40
|
+
connected app names, named credential endpoints and others) failed with "depends on cache key ...
|
|
41
|
+
but no preceding check declares it" unless that check was selected too, so `--checks apex-sharing`
|
|
42
|
+
and the documented example `--checks hardcoded-credentials,apex-sharing` both stopped before
|
|
43
|
+
running. The command now adds the checks that collect that data, runs them first, and names them
|
|
44
|
+
in a warning (shown with `--json` too); their findings count toward the grade and `--fail-on`.
|
|
45
|
+
A test runs every check alone. docs/COMMANDS.md no longer says there are 88 checks.
|
|
46
|
+
|
|
12
47
|
## [v1.26.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.26.0) — 2026-11-11
|
|
13
48
|
|
|
14
49
|
Four checks read fields or values Salesforce does not have, or matched by wording, so they could
|
package/README.md
CHANGED
|
@@ -89,7 +89,8 @@ check id.
|
|
|
89
89
|
| `--fail-on` | (none) | Exit 1 if any finding is at or above `CRITICAL`/`HIGH`/`MEDIUM`/`LOW`. For CI |
|
|
90
90
|
| `--fail-on-inconclusive` | `false` | Exit 3 if any check could not gather evidence. For CI |
|
|
91
91
|
| `--waivers` | `.sfaudit-waivers.json` if present | Accepted-risk waivers. See [Accepting a risk](#accepting-a-risk) |
|
|
92
|
-
| `--digest` | `false` |
|
|
92
|
+
| `--digest` | `false` | With `--json`: compact result for programmatic callers — no passing checks, no prose, capped lists |
|
|
93
|
+
| `--summary` | `false` | With `--json`: page one as data — grade and why, coverage, the fix-first plan with the finding ids each action closes, attack paths. Smaller than `--digest` |
|
|
93
94
|
| `--checks` | *(all)* | Run only these check ids |
|
|
94
95
|
| `--frameworks` | `universal` | Compliance matrix scope for the executive report |
|
|
95
96
|
| `--no-history` / `--keep-history` | `false` | Skip, or force, the archive to `~/.sf/audit-history`. Skipped in CI (`CI` set, `GITHUB_ACTIONS`, `TF_BUILD`, `JENKINS_URL`) unless `--keep-history` |
|
|
@@ -139,6 +140,16 @@ inconclusive count is still in the report body. `3` exists so a pipeline can tel
|
|
|
139
140
|
Every flag, more examples, and what the executive report contains:
|
|
140
141
|
**[docs/COMMANDS.md](docs/COMMANDS.md)**.
|
|
141
142
|
|
|
143
|
+
## Using it from Claude Code
|
|
144
|
+
|
|
145
|
+
A Claude Code plugin in this repo runs the audit and triages it for you: the grade and why, what to fix first, the attack paths, and any finding explained. It drives this CLI, so install the CLI first (1.27.0 or later), then in Claude Code:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
/plugin install sf-audit --marketplace cclabsnz/sf-audit-plugin
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Then `/sf-audit:audit myOrg`, `/sf-audit:fix-first`, `/sf-audit:explain <id>` and `/sf-audit:diff`. Any agent can do the same without the plugin: `sf audit security --json --summary` returns page one as compact JSON, and `sf audit explain` explains a check or finding.
|
|
152
|
+
|
|
142
153
|
## What It Checks
|
|
143
154
|
|
|
144
155
|
**109 read-only checks** across ten domains. Every finding is risk-rated CRITICAL → INFO, mapped to
|
|
@@ -294,7 +305,7 @@ A finding you have reviewed and accepted can be waived, which takes it out of th
|
|
|
294
305
|
|
|
295
306
|
## Other commands
|
|
296
307
|
|
|
297
|
-
Beyond the audit itself, the plugin ships
|
|
308
|
+
Beyond the audit itself, the plugin ships these commands. Each is documented in
|
|
298
309
|
**[docs/COMMANDS.md](docs/COMMANDS.md)**.
|
|
299
310
|
|
|
300
311
|
| Command | What it does |
|
|
@@ -302,6 +313,7 @@ Beyond the audit itself, the plugin ships five commands. Each is documented in
|
|
|
302
313
|
| `sf audit history` / `sf audit diff` | Every run auto-archives to `~/.sf/audit-history/{orgId}`. Show posture drift across runs as a table plus an HTML timeline, or diff any two report JSONs |
|
|
303
314
|
| `sf audit events pull` | Capture the org's **free** daily `EventLogFile` logs to local disk before the ~1-day retention window drops them — no Event Monitoring / Shield add-on needed. Idempotent, safe to cron |
|
|
304
315
|
| `sf audit timeline` | Reconstruct one actor's activity across every captured event type, entirely offline. Refuses to expand a shared identity or join on a blank field, and always reports capture coverage first |
|
|
316
|
+
| `sf audit explain` | Explain a check, or one finding from a run: what it affects, the attack chains it is part of, and the fix-first action that closes it. Offline |
|
|
305
317
|
| `sf audit preflight` | Read the running user's effective permissions in one query and report which checks will produce a verdict and which will return inconclusive — **before** an audit is run |
|
|
306
318
|
| `sf audit apps` | Read the `RestApi`, `BulkApi2`, `GraphQlQueryExecution` and `AuraRequest` event logs to compare what each connected app actually *uses* against what its run-as user is *granted*, per object and read/write, and suggest a least-privilege permission set. `--emit-permset <dir>` writes it as local `.permissionset-meta.xml` files for review; nothing is deployed |
|
|
307
319
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SecurityCheck } from './SecurityCheck.js';
|
|
2
|
+
/**
|
|
3
|
+
* A --checks selection plus the checks that fill the cache it reads. CheckEngine refuses a check
|
|
4
|
+
* whose cache keys no earlier check populates, so `--checks apex-sharing` alone could not run.
|
|
5
|
+
* Each needed key is filled by the earliest registry check that populates it, transitively, and the
|
|
6
|
+
* result keeps registry order so providers run before their readers. `added` lists the providers
|
|
7
|
+
* the user did not ask for, so the command can say why they ran.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withCacheProviders(selected: readonly SecurityCheck[], registry: readonly SecurityCheck[]): {
|
|
10
|
+
checks: SecurityCheck[];
|
|
11
|
+
added: SecurityCheck[];
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=selection.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A --checks selection plus the checks that fill the cache it reads. CheckEngine refuses a check
|
|
3
|
+
* whose cache keys no earlier check populates, so `--checks apex-sharing` alone could not run.
|
|
4
|
+
* Each needed key is filled by the earliest registry check that populates it, transitively, and the
|
|
5
|
+
* result keeps registry order so providers run before their readers. `added` lists the providers
|
|
6
|
+
* the user did not ask for, so the command can say why they ran.
|
|
7
|
+
*/
|
|
8
|
+
export function withCacheProviders(selected, registry) {
|
|
9
|
+
const chosen = new Set(selected);
|
|
10
|
+
const pending = [...selected];
|
|
11
|
+
while (pending.length > 0) {
|
|
12
|
+
const check = pending.pop();
|
|
13
|
+
for (const key of check.dependsOnCache ?? []) {
|
|
14
|
+
const provider = registry.find((c) => (c.populatesCache ?? []).includes(key));
|
|
15
|
+
if (provider && !chosen.has(provider)) {
|
|
16
|
+
chosen.add(provider);
|
|
17
|
+
pending.push(provider);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const checks = registry.filter((c) => chosen.has(c));
|
|
22
|
+
return { checks, added: checks.filter((c) => !selected.includes(c)) };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type Explanation } from '../../report/explain.js';
|
|
3
|
+
export default class AuditExplainCommand extends SfCommand<Explanation> {
|
|
4
|
+
static summary: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
static examples: string[];
|
|
7
|
+
static args: {
|
|
8
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
9
|
+
};
|
|
10
|
+
static flags: {
|
|
11
|
+
file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<Explanation>;
|
|
14
|
+
private print;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=explain.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { Args } from '@oclif/core';
|
|
3
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
4
|
+
import { explain, ExplainError, parseResult } from '../../report/explain.js';
|
|
5
|
+
export default class AuditExplainCommand extends SfCommand {
|
|
6
|
+
static summary = 'Explain a check, or one finding from an audit run';
|
|
7
|
+
static description = 'With a check id: what the check looks for, its domain, effort, impact and compliance mapping. With --file and a finding id: the finding from that run, what it affects, the attack chains it is part of and the fix-first action that closes it.';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> <%= command.id %> apex-sharing',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> guest-user-sharing-exposure --file ./audit.json',
|
|
11
|
+
];
|
|
12
|
+
static args = {
|
|
13
|
+
id: Args.string({ description: 'A check id (sf audit list) or a finding id from a report.', required: true }),
|
|
14
|
+
};
|
|
15
|
+
static flags = {
|
|
16
|
+
file: Flags.file({
|
|
17
|
+
summary: 'A report from sf audit security --json (full result, not --digest or --summary).',
|
|
18
|
+
exists: true,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
const { args, flags } = await this.parse(AuditExplainCommand);
|
|
23
|
+
let result;
|
|
24
|
+
if (flags.file) {
|
|
25
|
+
try {
|
|
26
|
+
result = parseResult(readFileSync(flags.file, 'utf8'));
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
this.error(`Could not read an audit result from ${flags.file}: ${err instanceof Error ? err.message : String(err)}`, {
|
|
30
|
+
suggestions: ['Pass the output of sf audit security --json, without --digest or --summary.'],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let out;
|
|
35
|
+
try {
|
|
36
|
+
out = explain(args.id, result);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
if (err instanceof ExplainError)
|
|
40
|
+
this.error(err.message, { suggestions: [err.suggestion] });
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
this.print(out);
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
print(out) {
|
|
47
|
+
const c = out.check;
|
|
48
|
+
this.log(`${c.name} (${c.id})`);
|
|
49
|
+
if (c.domain)
|
|
50
|
+
this.log(`Domain: ${c.domain}`);
|
|
51
|
+
this.log(c.description);
|
|
52
|
+
if (c.impact)
|
|
53
|
+
this.log(`\nWhy it matters: ${c.impact}`);
|
|
54
|
+
if (c.effort)
|
|
55
|
+
this.log(`Typical effort: ${c.effort}`);
|
|
56
|
+
if (c.complianceTags.length > 0)
|
|
57
|
+
this.log(`Maps to: ${c.complianceTags.join(', ')}`);
|
|
58
|
+
const f = out.finding;
|
|
59
|
+
if (f) {
|
|
60
|
+
this.log(`\n${f.severity} ${f.status}: ${f.title}`);
|
|
61
|
+
this.log(f.detail);
|
|
62
|
+
this.log(`\nFix: ${f.remediation}`);
|
|
63
|
+
if (f.affectedCount > 0) {
|
|
64
|
+
const more = f.affectedCount > f.affectedSample.length ? ` and ${f.affectedCount - f.affectedSample.length} more` : '';
|
|
65
|
+
this.log(`Affects: ${f.affectedSample.join(', ')}${more}`);
|
|
66
|
+
}
|
|
67
|
+
for (const ch of f.chains)
|
|
68
|
+
this.log(`Part of ${ch.label} ${ch.title} (${ch.severity})${ch.breaksChain ? ': fixing this breaks it' : ''}`);
|
|
69
|
+
if (f.action)
|
|
70
|
+
this.log(`Fix-first plan: action ${f.action.rank} (${f.action.wave}): ${f.action.title}`);
|
|
71
|
+
}
|
|
72
|
+
if (out.findings) {
|
|
73
|
+
this.log(`\nIn this run:`);
|
|
74
|
+
for (const x of out.findings)
|
|
75
|
+
this.log(` ${x.id} ${x.status === 'open' ? x.severity : x.status} ${x.title}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=explain.js.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
import type { AuditResult } from '../../findings/AuditResult.js';
|
|
3
3
|
import { type AuditDigest } from '../../findings/digest.js';
|
|
4
|
-
|
|
4
|
+
import { type AuditSummary } from '../../findings/summary.js';
|
|
5
|
+
export default class SecurityAuditCommand extends SfCommand<AuditResult | AuditDigest | AuditSummary> {
|
|
5
6
|
static summary: string;
|
|
6
7
|
static description: string;
|
|
7
8
|
static examples: string[];
|
|
@@ -12,6 +13,7 @@ export default class SecurityAuditCommand extends SfCommand<AuditResult | AuditD
|
|
|
12
13
|
waivers: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
'fail-on': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
digest: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
summary: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
17
|
'fail-on-inconclusive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
18
|
checks: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
19
|
'scoring-config': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -23,7 +25,7 @@ export default class SecurityAuditCommand extends SfCommand<AuditResult | AuditD
|
|
|
23
25
|
'no-history': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
24
26
|
'keep-history': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
25
27
|
};
|
|
26
|
-
run(): Promise<AuditResult | AuditDigest>;
|
|
28
|
+
run(): Promise<AuditResult | AuditDigest | AuditSummary>;
|
|
27
29
|
/** Resolve --checks to the checks to run, erroring on any unknown ID. */
|
|
28
30
|
private resolveChecks;
|
|
29
31
|
/** Resolve --format to a validated list, erroring on any unknown format. */
|
|
@@ -3,6 +3,7 @@ import * as path from 'node:path';
|
|
|
3
3
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
4
4
|
import { CheckEngine } from '../../checks/CheckEngine.js';
|
|
5
5
|
import { CHECKS } from '../../checks/registry.js';
|
|
6
|
+
import { withCacheProviders } from '../../checks/selection.js';
|
|
6
7
|
import { JsonRenderer } from '../../renderers/JsonRenderer.js';
|
|
7
8
|
import { HtmlRenderer } from '../../renderers/HtmlRenderer.js';
|
|
8
9
|
import { MarkdownRenderer } from '../../renderers/MarkdownRenderer.js';
|
|
@@ -16,6 +17,7 @@ import { HistoryStore } from '../../history/HistoryStore.js';
|
|
|
16
17
|
import { isCiEnvironment, shouldArchiveHistory } from '../../history/archivePolicy.js';
|
|
17
18
|
import { EXIT_FINDINGS, EXIT_INCONCLUSIVE, resolveExitCode, violationsFor } from '../../findings/exitCode.js';
|
|
18
19
|
import { buildDigest } from '../../findings/digest.js';
|
|
20
|
+
import { buildSummary } from '../../findings/summary.js';
|
|
19
21
|
import { WaiverLoader, DEFAULT_WAIVER_FILE } from '../../waivers/WaiverLoader.js';
|
|
20
22
|
import { coverageSummary, coverageAdvice } from '../../findings/coverage.js';
|
|
21
23
|
const RENDERERS = {
|
|
@@ -54,8 +56,15 @@ export default class SecurityAuditCommand extends SfCommand {
|
|
|
54
56
|
options: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'],
|
|
55
57
|
}),
|
|
56
58
|
digest: Flags.boolean({
|
|
57
|
-
summary: '
|
|
59
|
+
summary: 'With --json, return a compact, token-cheap result: no passing checks, no detail prose, capped affected lists.',
|
|
58
60
|
default: false,
|
|
61
|
+
exclusive: ['summary'],
|
|
62
|
+
}),
|
|
63
|
+
summary: Flags.boolean({
|
|
64
|
+
summary: 'With --json, return page one of the report: grade and reason, coverage, the fix-first plan and attack paths. Smaller than --digest.',
|
|
65
|
+
description: 'Each action lists the ids of the findings it closes; run sf audit explain <id> --file <report.json> for one of them.',
|
|
66
|
+
default: false,
|
|
67
|
+
exclusive: ['digest'],
|
|
59
68
|
}),
|
|
60
69
|
'fail-on-inconclusive': Flags.boolean({
|
|
61
70
|
summary: 'Exit with code 3 if any check could not gather evidence. Off by default.',
|
|
@@ -102,6 +111,9 @@ export default class SecurityAuditCommand extends SfCommand {
|
|
|
102
111
|
};
|
|
103
112
|
async run() {
|
|
104
113
|
const { flags } = await this.parse(SecurityAuditCommand);
|
|
114
|
+
if ((flags.summary || flags.digest) && !this.jsonEnabled()) {
|
|
115
|
+
this.warn(`--${flags.summary ? 'summary' : 'digest'} shapes the --json output only; add --json to see it.`);
|
|
116
|
+
}
|
|
105
117
|
// Validate the selection and output formats up front, so a typo fails fast with
|
|
106
118
|
// a clear message instead of silently running a partial/empty audit or writing
|
|
107
119
|
// no report after the (potentially long) run completes.
|
|
@@ -162,6 +174,8 @@ export default class SecurityAuditCommand extends SfCommand {
|
|
|
162
174
|
// Exit code is resolved from the full result: the digest drops passing checks,
|
|
163
175
|
// which the threshold logic must still be able to see and discount.
|
|
164
176
|
this.applyExitCode(result, flags['fail-on'], flags['fail-on-inconclusive']);
|
|
177
|
+
if (flags.summary)
|
|
178
|
+
return buildSummary(result);
|
|
165
179
|
return flags.digest ? buildDigest(result) : result;
|
|
166
180
|
}
|
|
167
181
|
/** Resolve --checks to the checks to run, erroring on any unknown ID. */
|
|
@@ -182,7 +196,13 @@ export default class SecurityAuditCommand extends SfCommand {
|
|
|
182
196
|
suggestions: ["Run 'sf audit list' to see valid check IDs, or omit --checks to run all."],
|
|
183
197
|
});
|
|
184
198
|
}
|
|
185
|
-
|
|
199
|
+
// Checks that read data another check collects need that check to run first.
|
|
200
|
+
const { checks, added } = withCacheProviders(selected, CHECKS);
|
|
201
|
+
if (added.length > 0) {
|
|
202
|
+
// A warning, not a log line, so --json callers see it too (on stderr): these checks' findings count.
|
|
203
|
+
this.warn(`Also running ${added.map((c) => c.id).join(', ')}: ${added.length === 1 ? 'it collects' : 'they collect'} data the selected checks read, and ${added.length === 1 ? 'its' : 'their'} findings count toward the grade and --fail-on.`);
|
|
204
|
+
}
|
|
205
|
+
return checks;
|
|
186
206
|
}
|
|
187
207
|
/** Resolve --format to a validated list, erroring on any unknown format. */
|
|
188
208
|
resolveFormats(raw) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AuditResult } from './AuditResult.js';
|
|
2
|
+
import type { Finding } from './Finding.js';
|
|
3
|
+
/** What a finding counts as on the report's page one; the HTML report, --summary and explain share it. */
|
|
4
|
+
export type FindingStatus = 'open' | 'info' | 'waived' | 'inconclusive' | 'passed';
|
|
5
|
+
export declare function findingStatus(f: Finding): FindingStatus;
|
|
6
|
+
/** Open findings per severity: what the score and the executive report count (RULE-079). */
|
|
7
|
+
export declare function openCounts(result: AuditResult): Record<'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW', number>;
|
|
8
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function findingStatus(f) {
|
|
2
|
+
if (f.passed)
|
|
3
|
+
return 'passed';
|
|
4
|
+
if (f.inconclusive || f.notAssessed)
|
|
5
|
+
return 'inconclusive';
|
|
6
|
+
if (f.waived)
|
|
7
|
+
return 'waived';
|
|
8
|
+
return f.riskLevel === 'INFO' ? 'info' : 'open';
|
|
9
|
+
}
|
|
10
|
+
/** Open findings per severity: what the score and the executive report count (RULE-079). */
|
|
11
|
+
export function openCounts(result) {
|
|
12
|
+
const open = result.findings.filter((f) => findingStatus(f) === 'open');
|
|
13
|
+
return {
|
|
14
|
+
CRITICAL: open.filter((f) => f.riskLevel === 'CRITICAL').length,
|
|
15
|
+
HIGH: open.filter((f) => f.riskLevel === 'HIGH').length,
|
|
16
|
+
MEDIUM: open.filter((f) => f.riskLevel === 'MEDIUM').length,
|
|
17
|
+
LOW: open.filter((f) => f.riskLevel === 'LOW').length,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AuditResult } from './AuditResult.js';
|
|
2
|
+
import type { Finding } from './Finding.js';
|
|
3
|
+
import { EFFORT_LABEL, WAVE_LABEL } from '../report/ActionPlan.js';
|
|
4
|
+
export interface SummaryAction {
|
|
5
|
+
rank: number;
|
|
6
|
+
wave: (typeof WAVE_LABEL)[keyof typeof WAVE_LABEL];
|
|
7
|
+
title: string;
|
|
8
|
+
severity: Finding['riskLevel'];
|
|
9
|
+
effort: (typeof EFFORT_LABEL)[keyof typeof EFFORT_LABEL];
|
|
10
|
+
/** Ids of the open findings it closes. */
|
|
11
|
+
closes: string[];
|
|
12
|
+
/** Labels (C1, P1…) of the chains it breaks. */
|
|
13
|
+
breaks: string[];
|
|
14
|
+
/** Labels of chains its findings take part in without breaking them. */
|
|
15
|
+
partOf: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface SummaryChain {
|
|
18
|
+
label: string;
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
severity: Finding['riskLevel'];
|
|
22
|
+
/** The fix that stops the chain; named chains only. */
|
|
23
|
+
breakPoint?: string;
|
|
24
|
+
steps: number;
|
|
25
|
+
}
|
|
26
|
+
export interface AuditSummary {
|
|
27
|
+
orgId: string;
|
|
28
|
+
orgName: string;
|
|
29
|
+
isSandbox: boolean;
|
|
30
|
+
generatedAt: Date;
|
|
31
|
+
grade: AuditResult['grade'];
|
|
32
|
+
healthScore: number;
|
|
33
|
+
gradeReason?: string;
|
|
34
|
+
coverage?: {
|
|
35
|
+
percent: number;
|
|
36
|
+
checksAssessed: number;
|
|
37
|
+
checksRun: number;
|
|
38
|
+
notAssessed: string[];
|
|
39
|
+
};
|
|
40
|
+
/** Open findings by severity, as page one counts them, plus the other statuses. */
|
|
41
|
+
counts: {
|
|
42
|
+
open: Record<'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW', number>;
|
|
43
|
+
info: number;
|
|
44
|
+
waived: number;
|
|
45
|
+
inconclusive: number;
|
|
46
|
+
passed: number;
|
|
47
|
+
};
|
|
48
|
+
/** The plan's conclusion in one sentence, as both reports state it. */
|
|
49
|
+
headline: string;
|
|
50
|
+
actions: SummaryAction[];
|
|
51
|
+
attackChains: SummaryChain[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Page one of the report as data: grade and why, coverage, the fix-first plan and the attack paths.
|
|
55
|
+
* Smaller than the digest because it lists actions, not findings: each action names the finding ids it
|
|
56
|
+
* closes, and `sf audit explain <id>` gives the rest. Built for agents that triage before they read.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildSummary(result: AuditResult): AuditSummary;
|
|
59
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { findingStatus, openCounts } from './status.js';
|
|
2
|
+
import { buildActionPlan, chainLabels, planHeadline, EFFORT_LABEL, WAVE_LABEL } from '../report/ActionPlan.js';
|
|
3
|
+
/**
|
|
4
|
+
* Page one of the report as data: grade and why, coverage, the fix-first plan and the attack paths.
|
|
5
|
+
* Smaller than the digest because it lists actions, not findings: each action names the finding ids it
|
|
6
|
+
* closes, and `sf audit explain <id>` gives the rest. Built for agents that triage before they read.
|
|
7
|
+
*/
|
|
8
|
+
export function buildSummary(result) {
|
|
9
|
+
const chains = result.attackChains ?? [];
|
|
10
|
+
const labels = chainLabels(chains);
|
|
11
|
+
const plan = buildActionPlan(result.findings, chains);
|
|
12
|
+
const open = openCounts(result);
|
|
13
|
+
const tally = (s) => result.findings.filter((f) => findingStatus(f) === s).length;
|
|
14
|
+
const out = {
|
|
15
|
+
orgId: result.orgId,
|
|
16
|
+
orgName: result.orgName,
|
|
17
|
+
isSandbox: result.isSandbox,
|
|
18
|
+
generatedAt: result.generatedAt,
|
|
19
|
+
grade: result.grade,
|
|
20
|
+
healthScore: result.healthScore,
|
|
21
|
+
counts: { open, info: tally('info'), waived: tally('waived'), inconclusive: tally('inconclusive'), passed: tally('passed') },
|
|
22
|
+
headline: planHeadline(plan, chains, open.HIGH),
|
|
23
|
+
actions: plan.map((a, i) => ({
|
|
24
|
+
rank: i + 1,
|
|
25
|
+
wave: WAVE_LABEL[a.wave],
|
|
26
|
+
title: a.title,
|
|
27
|
+
severity: a.severity,
|
|
28
|
+
effort: EFFORT_LABEL[a.effort],
|
|
29
|
+
closes: a.fixes.map((f) => f.id),
|
|
30
|
+
breaks: a.breaks.map((n) => labels[n]),
|
|
31
|
+
partOf: a.inChains.map((n) => labels[n]),
|
|
32
|
+
})),
|
|
33
|
+
attackChains: chains.map((c, i) => {
|
|
34
|
+
const chain = { label: labels[i], id: c.id, title: c.title, severity: c.severity, steps: c.steps.length };
|
|
35
|
+
if (c.abuseCase)
|
|
36
|
+
chain.breakPoint = c.abuseCase.breakPoint;
|
|
37
|
+
return chain;
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
if (result.gradeReason !== undefined)
|
|
41
|
+
out.gradeReason = result.gradeReason;
|
|
42
|
+
if (result.coverage) {
|
|
43
|
+
const { percent, checksAssessed, checksRun, notAssessed } = result.coverage;
|
|
44
|
+
out.coverage = { percent, checksAssessed, checksRun, notAssessed };
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -4,7 +4,8 @@ import { renderAttackChainDagSvg } from './AttackChainDagRenderer.js';
|
|
|
4
4
|
import { coverageSummary, coverageAdvice } from '../findings/coverage.js';
|
|
5
5
|
import { techniqueLabel } from '../threats/attack.js';
|
|
6
6
|
import { unknownMetrics } from '../findings/unknownMetrics.js';
|
|
7
|
-
import { buildActionPlan, planHeadline, EFFORT_LABEL, WAVE_LABEL, WAVE_WHY } from '../report/ActionPlan.js';
|
|
7
|
+
import { buildActionPlan, planHeadline, chainLabels, EFFORT_LABEL, WAVE_LABEL, WAVE_WHY } from '../report/ActionPlan.js';
|
|
8
|
+
import { findingStatus, openCounts } from '../findings/status.js';
|
|
8
9
|
import { DOMAINS, domainOf } from '../checks/domains.js';
|
|
9
10
|
// The report is printed on white, in the executive report's palette. Every severity colour holds
|
|
10
11
|
// at least 4.5:1 on white and under white text, so badges and counts stay legible when printed.
|
|
@@ -49,11 +50,6 @@ function metricRow(label, value, color, bar) {
|
|
|
49
50
|
function inventoryCard(title, rows) {
|
|
50
51
|
return `<div class="inv-card"><div class="inv-card-title">${esc(title)}</div>${rows.join('')}</div>`;
|
|
51
52
|
}
|
|
52
|
-
/** Open findings per severity: what the score and the executive report count (RULE-079). */
|
|
53
|
-
function openCounts(result) {
|
|
54
|
-
const open = result.findings.filter((f) => !f.passed && !f.inconclusive && !f.notAssessed && !f.waived);
|
|
55
|
-
return Object.fromEntries(['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'].map((l) => [l, open.filter((f) => f.riskLevel === l).length]));
|
|
56
|
-
}
|
|
57
53
|
function buildDashboard(result, counts) {
|
|
58
54
|
const m = result.metrics;
|
|
59
55
|
const gradeColor = GRADE_COLOR[result.grade] ?? UNKNOWN_COLOR;
|
|
@@ -149,15 +145,7 @@ function buildDashboard(result, counts) {
|
|
|
149
145
|
// ── Report structure helpers ─────────────────────────────────────────────────
|
|
150
146
|
const SEV_ORDER = { CRITICAL: 0, HIGH: 1, MEDIUM: 2, LOW: 3, INFO: 4 };
|
|
151
147
|
const OTHER_DOMAIN = 'Other checks';
|
|
152
|
-
|
|
153
|
-
if (f.passed)
|
|
154
|
-
return 'passed';
|
|
155
|
-
if (f.inconclusive || f.notAssessed)
|
|
156
|
-
return 'inconclusive';
|
|
157
|
-
if (f.waived)
|
|
158
|
-
return 'waived';
|
|
159
|
-
return f.riskLevel === 'INFO' ? 'info' : 'open';
|
|
160
|
-
}
|
|
148
|
+
const statusOf = findingStatus;
|
|
161
149
|
/** Open findings first, worst first; then informational, waived, inconclusive and passed results. */
|
|
162
150
|
const STATUS_ORDER = { open: 0, info: 1, waived: 2, inconclusive: 3, passed: 4 };
|
|
163
151
|
function byPriority(a, b) {
|
|
@@ -177,11 +165,6 @@ function findingAnchors(findings) {
|
|
|
177
165
|
}
|
|
178
166
|
return out;
|
|
179
167
|
}
|
|
180
|
-
/** Chain labels as the executive report prints them: C1… for named chains, P1… for potential ones. */
|
|
181
|
-
function chainLabels(chains) {
|
|
182
|
-
let c = 0, p = 0;
|
|
183
|
-
return chains.map((ch) => (ch.abuseCase ? `C${++c}` : `P${++p}`));
|
|
184
|
-
}
|
|
185
168
|
const slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
186
169
|
/** The framework a compliance tag belongs to: 'SOC2-CC6.1' is SOC2; OWASP LLM tags ('LLM02') are one framework. */
|
|
187
170
|
const frameworkOf = (tag) => (/^LLM\d/.test(tag) ? 'OWASP-LLM' : tag.split(/[-.]/)[0]);
|
|
@@ -38,6 +38,8 @@ export interface PlannedAction {
|
|
|
38
38
|
* work is wave 3 and the rest wave 2. Within a wave, the most risk removed comes first.
|
|
39
39
|
*/
|
|
40
40
|
export declare function buildActionPlan(findings: Finding[], chains: AttackChain[]): PlannedAction[];
|
|
41
|
+
/** Chain labels as the executive report prints them: C1… for named chains, P1… for potential ones. */
|
|
42
|
+
export declare function chainLabels(chains: AttackChain[]): string[];
|
|
41
43
|
/** How long an action takes, in the words both reports print. */
|
|
42
44
|
export declare const EFFORT_LABEL: {
|
|
43
45
|
readonly quick: 'Under a day';
|
package/lib/report/ActionPlan.js
CHANGED
|
@@ -96,6 +96,11 @@ export function buildActionPlan(findings, chains) {
|
|
|
96
96
|
}
|
|
97
97
|
return actions.sort((a, b) => a.wave - b.wave || b.risk - a.risk || a.title.localeCompare(b.title));
|
|
98
98
|
}
|
|
99
|
+
/** Chain labels as the executive report prints them: C1… for named chains, P1… for potential ones. */
|
|
100
|
+
export function chainLabels(chains) {
|
|
101
|
+
let c = 0, p = 0;
|
|
102
|
+
return chains.map((ch) => (ch.abuseCase ? `C${++c}` : `P${++p}`));
|
|
103
|
+
}
|
|
99
104
|
/** How long an action takes, in the words both reports print. */
|
|
100
105
|
export const EFFORT_LABEL = { quick: 'Under a day', moderate: 'Days', project: 'Weeks' };
|
|
101
106
|
/** When to start each wave. */
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CHECKS } from '../checks/registry.js';
|
|
2
|
+
import type { AuditResult } from '../findings/AuditResult.js';
|
|
3
|
+
import type { Finding } from '../findings/Finding.js';
|
|
4
|
+
import { type FindingStatus } from '../findings/status.js';
|
|
5
|
+
export interface CheckExplanation {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
domain?: string;
|
|
10
|
+
effort?: string;
|
|
11
|
+
impact?: string;
|
|
12
|
+
complianceTags: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface FindingExplanation {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
status: FindingStatus;
|
|
18
|
+
severity: Finding['riskLevel'];
|
|
19
|
+
detail: string;
|
|
20
|
+
remediation: string;
|
|
21
|
+
affectedCount: number;
|
|
22
|
+
affectedSample: string[];
|
|
23
|
+
/** Chains this finding is a step of, with whether fixing it breaks the chain. */
|
|
24
|
+
chains: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
title: string;
|
|
27
|
+
severity: Finding['riskLevel'];
|
|
28
|
+
breaksChain: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
/** The fix-first action that closes it, if it is open. */
|
|
31
|
+
action?: {
|
|
32
|
+
rank: number;
|
|
33
|
+
wave: string;
|
|
34
|
+
title: string;
|
|
35
|
+
};
|
|
36
|
+
/** Other checks that reported a finding with the same id in this run. */
|
|
37
|
+
alsoFrom?: string[];
|
|
38
|
+
}
|
|
39
|
+
export interface Explanation {
|
|
40
|
+
check: CheckExplanation;
|
|
41
|
+
finding?: FindingExplanation;
|
|
42
|
+
/** With --file and a check id: that check's findings in the run. */
|
|
43
|
+
findings?: Array<{
|
|
44
|
+
id: string;
|
|
45
|
+
title: string;
|
|
46
|
+
status: FindingExplanation['status'];
|
|
47
|
+
severity: Finding['riskLevel'];
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
/** The check a finding id belongs to: the longest check id it starts with. */
|
|
51
|
+
export declare function checkForFindingId(id: string): (typeof CHECKS)[number] | undefined;
|
|
52
|
+
export declare function parseResult(json: string): AuditResult;
|
|
53
|
+
/** Why an explanation could not be built; the command turns it into a CLI error with this advice. */
|
|
54
|
+
export declare class ExplainError extends Error {
|
|
55
|
+
readonly suggestion: string;
|
|
56
|
+
constructor(message: string, suggestion: string);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Explain a check id, or a finding id from a run. With a run and the check's own id, list that
|
|
60
|
+
* check's findings in the run. Throws ExplainError for an unknown id or a finding not in the run.
|
|
61
|
+
*/
|
|
62
|
+
export declare function explain(id: string, result?: AuditResult): Explanation;
|
|
63
|
+
//# sourceMappingURL=explain.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { CHECKS } from '../checks/registry.js';
|
|
2
|
+
import { domainOf } from '../checks/domains.js';
|
|
3
|
+
import { getCheckMeta } from '../findings/CheckMeta.js';
|
|
4
|
+
import { getComplianceTags } from '../compliance/resolve.js';
|
|
5
|
+
import { buildActionPlan, chainLabels, EFFORT_LABEL, WAVE_LABEL } from './ActionPlan.js';
|
|
6
|
+
import { findingStatus } from '../findings/status.js';
|
|
7
|
+
/** How many affected items to show; the report has the rest. */
|
|
8
|
+
const SAMPLE = 5;
|
|
9
|
+
const statusOf = findingStatus;
|
|
10
|
+
/** The check a finding id belongs to: the longest check id it starts with. */
|
|
11
|
+
export function checkForFindingId(id) {
|
|
12
|
+
return CHECKS.filter((c) => id === c.id || id.startsWith(`${c.id}-`)).sort((a, b) => b.id.length - a.id.length)[0];
|
|
13
|
+
}
|
|
14
|
+
export function parseResult(json) {
|
|
15
|
+
const raw = JSON.parse(json);
|
|
16
|
+
const result = (raw.result ?? raw);
|
|
17
|
+
// A --digest result also has findings, but without ids or detail; --summary has none.
|
|
18
|
+
const full = Array.isArray(result.findings) && result.metrics !== undefined && result.findings.every((f) => typeof f.id === 'string' && 'detail' in f);
|
|
19
|
+
if (!full)
|
|
20
|
+
throw new Error('not a full audit result');
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/** Why an explanation could not be built; the command turns it into a CLI error with this advice. */
|
|
24
|
+
export class ExplainError extends Error {
|
|
25
|
+
suggestion;
|
|
26
|
+
constructor(message, suggestion) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.suggestion = suggestion;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Explain a check id, or a finding id from a run. With a run and the check's own id, list that
|
|
33
|
+
* check's findings in the run. Throws ExplainError for an unknown id or a finding not in the run.
|
|
34
|
+
*/
|
|
35
|
+
export function explain(id, result) {
|
|
36
|
+
// A finding id does not always start with its check's id (apex-no-sharing-declaration is
|
|
37
|
+
// apex-sharing's), so a run's own checkId wins; the prefix is the fallback without one.
|
|
38
|
+
// Finding ids are not unique across checks; explain the first and name the others.
|
|
39
|
+
const matches = result?.findings.filter((f) => f.id === id) ?? [];
|
|
40
|
+
const inRun = matches[0];
|
|
41
|
+
const check = CHECKS.find((c) => c.id === (inRun?.checkId ?? id)) ??
|
|
42
|
+
checkForFindingId(id) ??
|
|
43
|
+
// A finding from an older report whose check has since been renamed or removed.
|
|
44
|
+
(inRun?.checkId ? { id: inRun.checkId, name: inRun.checkId, description: 'This check is not in the installed version of sf-audit.' } : undefined);
|
|
45
|
+
if (!check) {
|
|
46
|
+
throw new ExplainError(`No check or finding id matches '${id}'.`, result ? "Run 'sf audit list' for check ids." : "Run 'sf audit list' for check ids, or pass the run's report with --file to explain a finding.");
|
|
47
|
+
}
|
|
48
|
+
const meta = getCheckMeta(check.id);
|
|
49
|
+
const out = {
|
|
50
|
+
check: {
|
|
51
|
+
id: check.id,
|
|
52
|
+
name: check.name,
|
|
53
|
+
description: check.description,
|
|
54
|
+
domain: domainOf(check.id),
|
|
55
|
+
effort: meta ? EFFORT_LABEL[meta.effort] : undefined,
|
|
56
|
+
impact: meta?.impact,
|
|
57
|
+
complianceTags: getComplianceTags(check.id),
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
if (!result)
|
|
61
|
+
return out;
|
|
62
|
+
if (inRun) {
|
|
63
|
+
out.finding = explainFinding(inRun, result);
|
|
64
|
+
const others = matches.slice(1).map((f) => f.checkId).filter((c) => Boolean(c));
|
|
65
|
+
if (others.length > 0)
|
|
66
|
+
out.finding.alsoFrom = others;
|
|
67
|
+
}
|
|
68
|
+
else if (id === check.id) {
|
|
69
|
+
out.findings = result.findings
|
|
70
|
+
.filter((f) => f.checkId === check.id)
|
|
71
|
+
.map((f) => ({ id: f.id, title: f.title, status: statusOf(f), severity: f.riskLevel }));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new ExplainError(`Finding '${id}' is not in this run.`, `Explain ${check.id} with the same file to list that check's findings.`);
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
function explainFinding(f, result) {
|
|
79
|
+
const chains = result.attackChains ?? [];
|
|
80
|
+
const labels = chainLabels(chains);
|
|
81
|
+
const plan = buildActionPlan(result.findings, chains);
|
|
82
|
+
const rank = plan.findIndex((a) => a.fixes.some((x) => x.id === f.id && x.checkId === f.checkId));
|
|
83
|
+
const items = f.affectedItems ?? [];
|
|
84
|
+
const out = {
|
|
85
|
+
id: f.id,
|
|
86
|
+
title: f.title,
|
|
87
|
+
status: statusOf(f),
|
|
88
|
+
severity: f.riskLevel,
|
|
89
|
+
detail: f.detail,
|
|
90
|
+
remediation: f.remediation,
|
|
91
|
+
affectedCount: items.length,
|
|
92
|
+
affectedSample: items.slice(0, SAMPLE).map((i) => i.label),
|
|
93
|
+
chains: chains.flatMap((c, i) => {
|
|
94
|
+
const step = c.steps.find((s) => s.findingId === f.id);
|
|
95
|
+
return step ? [{ label: labels[i], title: c.title, severity: c.severity, breaksChain: step.breaksChain === true }] : [];
|
|
96
|
+
}),
|
|
97
|
+
};
|
|
98
|
+
if (rank >= 0)
|
|
99
|
+
out.action = { rank: rank + 1, wave: WAVE_LABEL[plan[rank].wave], title: plan[rank].title };
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=explain.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cclabsnz/sf-audit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.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",
|