@cclabsnz/sf-audit 1.26.0 → 1.28.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 +74 -0
- package/README.md +15 -3
- package/lib/checks/CheckEngine.js +2 -3
- 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/compliance/catalogs/hiso10029.d.ts +2 -1
- package/lib/compliance/catalogs/hiso10029.js +23 -34
- package/lib/compliance/catalogs/index.js +3 -2
- package/lib/compliance/catalogs/nzism.js +19 -30
- package/lib/compliance/mapping.d.ts +13 -0
- package/lib/compliance/mapping.js +45 -13
- package/lib/compliance/nz/citations.generated.d.ts +45 -0
- package/lib/compliance/nz/citations.generated.js +4752 -0
- package/lib/compliance/nz/types.d.ts +21 -0
- package/lib/compliance/nz/types.js +2 -0
- package/lib/compliance/resolve.js +11 -6
- package/lib/compliance/types.d.ts +1 -1
- 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/ClientReportRenderer.js +1 -1
- 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/ComplianceMatrix.js +2 -1
- 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,80 @@ published note and carries the signed provenance attestation and CycloneDX SBOM
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [v1.28.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.28.0) — 2026-11-17
|
|
13
|
+
|
|
14
|
+
HISO 10029 and NZISM citations are now per check, at requirement and section level, and each one
|
|
15
|
+
says where it came from. No check, finding, severity or score changes. Compliance control ids for
|
|
16
|
+
HISO and NZISM change, so anything that reads them from JSON or SARIF output needs updating.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **HISO 10029 cites published requirements.** The eight HISO "domains" (`HISO-AC`, `HISO-AUTH`
|
|
21
|
+
and so on), which sf-audit made up and applied to every check in a domain, are replaced by the
|
|
22
|
+
requirements themselves: HISO 10029.4:2025 supplier requirements (`HISO-HSUP34`) and their
|
|
23
|
+
HISO 10029.3:2023 equivalents for medium to large health organisations (`HISO-HML39`), each with
|
|
24
|
+
its statement quoted from the published PDF. The old catalogue also called HISO 10029 ISO
|
|
25
|
+
27002-based; it is built on the NIST Cybersecurity Framework.
|
|
26
|
+
- **Two HISO frameworks.** `HISO10029` is split into `HISO10029_3` (providers) and `HISO10029_4`
|
|
27
|
+
(suppliers), because which part applies depends on who owns the org. `--frameworks hiso` and the
|
|
28
|
+
`nz` pack select both; `hiso-provider` and `hiso-supplier` select one.
|
|
29
|
+
- **NZISM cites sections, with their controls.** The seven chapter-level NZISM controls are
|
|
30
|
+
replaced by NZISM v3.9 sections (`NZISM-16.7`), each listing the controls it covers and their
|
|
31
|
+
MUST or SHOULD level.
|
|
32
|
+
- **Every citation records its basis.** A citation tagged `scf` comes from the Secure Controls
|
|
33
|
+
Framework 2026.3 crosswalk: each check is mapped to the SCF controls a failing finding evidences,
|
|
34
|
+
and SCF's HISO and NZISM columns give the requirements. A citation tagged `direct` is sf-audit's
|
|
35
|
+
own judgement and carries its reason. Where SCF derives a requirement that does not fit a check,
|
|
36
|
+
the exclusion and its reason are recorded. Every decision is listed in
|
|
37
|
+
`docs/compliance/nz-crosswalk.md`, the rules are in `spec/nz-compliance-crosswalk.md`, and a test
|
|
38
|
+
checks every cited id against the pinned sources.
|
|
39
|
+
- **HISO and NZISM citations attach per finding.** They attach only to active findings (never to an
|
|
40
|
+
INFO, passed or inconclusive one), and a
|
|
41
|
+
citation that only one of a check's findings supports is scoped to that finding. The compliance
|
|
42
|
+
matrix now counts each finding against its own tags; for every other framework those are the
|
|
43
|
+
check's tags, so OWASP, SOC 2, ISO 27001, SBS, Privacy Act, HIPAA and GDPR rows are unchanged.
|
|
44
|
+
- **Most Agentforce and GenAI checks now carry HISO and NZISM citations**, applying the general
|
|
45
|
+
access, privileged-access and development requirements to the agent user. They had none.
|
|
46
|
+
`agent-action-surface` and `agent-monitoring-coverage` still carry none, because what they
|
|
47
|
+
measure is not evidence that a requirement is unmet.
|
|
48
|
+
- **HISO citation links** point to the two published PDFs; the old link redirected to the Health NZ
|
|
49
|
+
homepage.
|
|
50
|
+
|
|
51
|
+
## [v1.27.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.27.0) — 2026-11-11
|
|
52
|
+
|
|
53
|
+
sf-audit is now easier for an AI agent to drive. `--summary` returns page one of the report as
|
|
54
|
+
compact JSON, `sf audit explain` explains a check or a finding, and a Claude Code plugin in this repo
|
|
55
|
+
runs the audit and triages it. `--checks` now works for any selection. No check or score changes.
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- **A Claude Code plugin** in `claude-plugin/`, installable with
|
|
60
|
+
`/plugin install sf-audit --marketplace cclabsnz/sf-audit-plugin`. It runs the audit and
|
|
61
|
+
reports page one: the grade and why, coverage, what to fix first and the attack paths. It then
|
|
62
|
+
explains any finding and compares runs (`/sf-audit:audit`, `/sf-audit:fix-first`,
|
|
63
|
+
`/sf-audit:explain`, `/sf-audit:diff`). It needs this CLI at 1.27.0 or later. It is not part of
|
|
64
|
+
the npm package.
|
|
65
|
+
- **`--summary`**, with `--json`: page one of the report as data. It gives the grade and its reason,
|
|
66
|
+
evidence coverage, counts, the fix-first plan and the attack paths, labelled C1 and P1 as in the
|
|
67
|
+
reports. Each action lists the ids of the findings it closes. It carries no detail prose or
|
|
68
|
+
affected lists, so it is a fraction of `--digest`'s size, and it is meant for an agent to triage
|
|
69
|
+
before reading further.
|
|
70
|
+
- **`sf audit explain <id>`**. With a check id it gives what the check looks for, its domain,
|
|
71
|
+
typical effort, why it matters and its compliance mapping. With `--file` and a finding id from a
|
|
72
|
+
run it gives what the finding affects, the attack chains it is part of (and whether fixing it
|
|
73
|
+
breaks them) and the fix-first action that closes it. With `--file` and a check id it lists that
|
|
74
|
+
check's findings in the run. Works offline.
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- **`--checks` runs any selection.** A check that reads data another check collects (Apex bodies,
|
|
79
|
+
connected app names, named credential endpoints and others) failed with "depends on cache key ...
|
|
80
|
+
but no preceding check declares it" unless that check was selected too, so `--checks apex-sharing`
|
|
81
|
+
and the documented example `--checks hardcoded-credentials,apex-sharing` both stopped before
|
|
82
|
+
running. The command now adds the checks that collect that data, runs them first, and names them
|
|
83
|
+
in a warning (shown with `--json` too); their findings count toward the grade and `--fail-on`.
|
|
84
|
+
A test runs every check alone. docs/COMMANDS.md no longer says there are 88 checks.
|
|
85
|
+
|
|
12
86
|
## [v1.26.0](https://github.com/cclabsnz/sf-audit-plugin/releases/tag/v1.26.0) — 2026-11-11
|
|
13
87
|
|
|
14
88
|
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
|
|
@@ -168,7 +179,7 @@ advisories are INFO and never inflate the health score.
|
|
|
168
179
|
## Compliance frameworks
|
|
169
180
|
|
|
170
181
|
Findings map to controls across 10 frameworks organized into 8 source-verified general baselines and 2 specialized jurisdictional packs:
|
|
171
|
-
- **8 General Baselines:** OWASP Top 10 (2021), OWASP LLM Top 10 (2025), SOC 2 (2017 TSC), ISO/IEC 27001:2022, Security Benchmark for Salesforce (SBS), New Zealand Privacy Act 2020, HISO 10029:
|
|
182
|
+
- **8 General Baselines:** OWASP Top 10 (2021), OWASP LLM Top 10 (2025), SOC 2 (2017 TSC), ISO/IEC 27001:2022, Security Benchmark for Salesforce (SBS), New Zealand Privacy Act 2020, HISO 10029 (10029.3:2023 for health organisations and 10029.4:2025 for suppliers, cited per requirement), and NZISM (v3.9, cited per section).
|
|
172
183
|
- **2 Jurisdictional Packs:** HIPAA Security Rule (45 CFR Part 164 Subpart C) and GDPR (Regulation (EU) 2016/679).
|
|
173
184
|
|
|
174
185
|
The mapping is built on a **sourced catalog** — each control carries its framework, pinned version,
|
|
@@ -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
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildAuditResult } from '../findings/scoring.js';
|
|
2
|
-
import {
|
|
2
|
+
import { complianceTagsForFinding } from '../compliance/mapping.js';
|
|
3
3
|
import { threatsFor, withAttack } from '../threats/resolve.js';
|
|
4
4
|
import { ChainEngine } from '../chains/ChainEngine.js';
|
|
5
5
|
import { applyWaivers } from '../waivers/applyWaivers.js';
|
|
@@ -93,9 +93,8 @@ export class CheckEngine {
|
|
|
93
93
|
onProgress?.(i + 1, total, check.name);
|
|
94
94
|
try {
|
|
95
95
|
const result = await check.run(this.ctx);
|
|
96
|
-
const tags = getComplianceTags(check.id);
|
|
97
96
|
findings.push(...result.findings.map((f) => ({
|
|
98
|
-
...f, checkId: check.id, complianceTags:
|
|
97
|
+
...f, checkId: check.id, complianceTags: complianceTagsForFinding(check.id, f), threats: withAttack(f, threatsFor(check.id, f.threats)),
|
|
99
98
|
})));
|
|
100
99
|
if (result.metrics) {
|
|
101
100
|
metrics = { ...metrics, ...result.metrics };
|
|
@@ -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) {
|
|
@@ -1,35 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
requirement:
|
|
18
|
-
sourceRef:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
sourceRef: ref('Information Classification'), url: URL, verified: true },
|
|
25
|
-
{ id: 'HISO-DEV', framework: 'HISO10029', version: V, title: 'Secure development and change',
|
|
26
|
-
requirement: 'Application code and changes follow secure development practices that prevent introduction of vulnerabilities affecting health information.',
|
|
27
|
-
sourceRef: ref('Secure Development'), url: URL, verified: true },
|
|
28
|
-
{ id: 'HISO-COMM', framework: 'HISO10029', version: V, title: 'Communications and integration security',
|
|
29
|
-
requirement: 'Integrations and external communications carrying health information use secure, controlled, and authorised channels.',
|
|
30
|
-
sourceRef: ref('Communications Security'), url: URL, verified: true },
|
|
31
|
-
{ id: 'HISO-GOV', framework: 'HISO10029', version: V, title: 'Security configuration and governance',
|
|
32
|
-
requirement: 'Systems holding health information are securely configured, kept current, and governed against a defined security baseline.',
|
|
33
|
-
sourceRef: ref('Security Governance'), url: URL, verified: true },
|
|
34
|
-
];
|
|
1
|
+
import { CHECK_NZ_CITATIONS, HISO_SOURCES, HML_REQUIREMENTS, HSUP_REQUIREMENTS, } from '../nz/citations.generated.js';
|
|
2
|
+
// HISO 10029 Health Information Security Framework (HISF), Health NZ | Te Whatu Ora. HISF is built
|
|
3
|
+
// on the NIST Cybersecurity Framework (core document s3); ISO/IEC 27002 is one of the catalogues it
|
|
4
|
+
// maps to. Two parts are cited, because which applies depends on who owns the org:
|
|
5
|
+
// HISO 10029.3:2023, medium to large health organisations (HML requirements)
|
|
6
|
+
// HISO 10029.4:2025, suppliers to the health sector (HSUP requirements)
|
|
7
|
+
// Each control is one published requirement, with its statement taken verbatim from the PDF
|
|
8
|
+
// (CC BY 4.0). Which checks cite it comes from scripts/compliance/derive_nz_citations.py.
|
|
9
|
+
// `verified` = the requirement id and statement exist in the pinned PDF, which
|
|
10
|
+
// test/unit/compliance/nzCrosswalk.test.ts checks against data/compliance/nz-sources.json.
|
|
11
|
+
const cited = (key) => new Set(Object.values(CHECK_NZ_CITATIONS).flatMap((c) => c[key].map((x) => (typeof x === 'string' ? x : x.id))));
|
|
12
|
+
function build(framework, part, version, reqs, ids) {
|
|
13
|
+
return Object.entries(reqs)
|
|
14
|
+
.filter(([id]) => ids.has(id))
|
|
15
|
+
.map(([id, r]) => ({
|
|
16
|
+
id: `HISO-${id}`, framework, version, title: `${id} ${r.area}`,
|
|
17
|
+
requirement: r.statement,
|
|
18
|
+
sourceRef: `${version}, ${id} (${r.area})`,
|
|
19
|
+
url: HISO_SOURCES[part].url, verified: true,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
export const HISO10029_3_CONTROLS = build('HISO10029_3', 'hiso3', 'HISO 10029.3:2023', HML_REQUIREMENTS, cited('hml'));
|
|
23
|
+
export const HISO10029_4_CONTROLS = build('HISO10029_4', 'hiso4', 'HISO 10029.4:2025', HSUP_REQUIREMENTS, cited('hsup'));
|
|
35
24
|
//# sourceMappingURL=hiso10029.js.map
|
|
@@ -4,7 +4,7 @@ import { SOC2_CONTROLS } from './soc2.js';
|
|
|
4
4
|
import { ISO27001_CONTROLS } from './iso27001.js';
|
|
5
5
|
import { SBS_CONTROLS } from './sbs.js';
|
|
6
6
|
import { PRIVACY_ACT_CONTROLS } from './privacyAct.js';
|
|
7
|
-
import {
|
|
7
|
+
import { HISO10029_3_CONTROLS, HISO10029_4_CONTROLS } from './hiso10029.js';
|
|
8
8
|
import { NZISM_CONTROLS } from './nzism.js';
|
|
9
9
|
import { HIPAA_CONTROLS } from './hipaa.js';
|
|
10
10
|
import { GDPR_CONTROLS } from './gdpr.js';
|
|
@@ -15,7 +15,8 @@ export const ALL_CONTROLS = [
|
|
|
15
15
|
...ISO27001_CONTROLS,
|
|
16
16
|
...SBS_CONTROLS,
|
|
17
17
|
...PRIVACY_ACT_CONTROLS,
|
|
18
|
-
...
|
|
18
|
+
...HISO10029_3_CONTROLS,
|
|
19
|
+
...HISO10029_4_CONTROLS,
|
|
19
20
|
...NZISM_CONTROLS,
|
|
20
21
|
...HIPAA_CONTROLS,
|
|
21
22
|
...GDPR_CONTROLS,
|
|
@@ -1,31 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
sourceRef: 'NZISM v3.8, Ch.17 Cryptography', url: URL, verified: true },
|
|
21
|
-
{ id: 'NZISM-SW', framework: 'NZISM', version: V, title: 'Software and application security',
|
|
22
|
-
requirement: 'Applications are developed and configured securely, mitigating common code-level vulnerabilities and unsafe execution.',
|
|
23
|
-
sourceRef: 'NZISM v3.8, Ch.14 Software Security', url: URL, verified: true },
|
|
24
|
-
{ id: 'NZISM-NET', framework: 'NZISM', version: V, title: 'Network security and gateways',
|
|
25
|
-
requirement: 'Network connections, gateways, and external integrations are restricted to authorised, secured endpoints.',
|
|
26
|
-
sourceRef: 'NZISM v3.8, Ch.18 Network Security / Ch.19 Gateway Security', url: URL, verified: true },
|
|
27
|
-
{ id: 'NZISM-CONFIG', framework: 'NZISM', version: V, title: 'System hardening and configuration',
|
|
28
|
-
requirement: 'Systems are hardened to a secure baseline, kept current with security updates, and unnecessary functionality is disabled.',
|
|
29
|
-
sourceRef: 'NZISM v3.8, Ch.12 Product Security (configuration and patching)', url: URL, verified: true },
|
|
30
|
-
];
|
|
1
|
+
import { NZISM_SECTIONS, NZISM_SOURCE } from '../nz/citations.generated.js';
|
|
2
|
+
// New Zealand Information Security Manual (NZISM), GCSB/NCSC. Section-level controls: each one is
|
|
3
|
+
// an NZISM section (e.g. 16.7 Multi-Factor Authentication) that at least one check cites, and its
|
|
4
|
+
// citation lists the individual controls cited there (from the Secure Controls Framework 2026.3
|
|
5
|
+
// crosswalk, or added directly by sf-audit with a reason),
|
|
6
|
+
// with each control's compliance level from the manual. Which checks cite a section comes from
|
|
7
|
+
// scripts/compliance/derive_nz_citations.py. `verified` = the section and every listed control
|
|
8
|
+
// exist in the pinned manual version, which test/unit/compliance/nzCrosswalk.test.ts checks.
|
|
9
|
+
const V = `NZISM v${NZISM_SOURCE.version}`;
|
|
10
|
+
const level = (l) => l.toUpperCase();
|
|
11
|
+
export const NZISM_CONTROLS = Object.entries(NZISM_SECTIONS).map(([section, s]) => ({
|
|
12
|
+
id: `NZISM-${section}`, framework: 'NZISM', version: V, title: `${section} ${s.title}`,
|
|
13
|
+
requirement: s.controls.length
|
|
14
|
+
? `Controls in section ${section} cited by the checks that cite it (from the SCF crosswalk, or added directly by sf-audit): `
|
|
15
|
+
+ s.controls.map((c) => `${c.id} (${level(c.level)})`).join(', ')
|
|
16
|
+
: `Section ${section} as a whole (cited directly by sf-audit; no SCF crosswalk entry).`,
|
|
17
|
+
sourceRef: `${V}, ${section} ${s.title}`,
|
|
18
|
+
url: NZISM_SOURCE.url, verified: true,
|
|
19
|
+
}));
|
|
31
20
|
//# sourceMappingURL=nzism.js.map
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
interface FindingRef {
|
|
2
|
+
id: string;
|
|
3
|
+
riskLevel: string;
|
|
4
|
+
passed?: boolean;
|
|
5
|
+
inconclusive?: boolean;
|
|
6
|
+
}
|
|
1
7
|
export declare const CHECK_CONTROL_MAP: Record<string, string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* The control ids one finding carries. Every framework but HISO 10029 and NZISM maps at check level,
|
|
10
|
+
* so those ids are the check's. HISO and NZISM citations attach only to active findings (not INFO, passed
|
|
11
|
+
* or inconclusive), and only to the findings a scoped citation names (spec/nz-compliance-crosswalk.md, RULE-127).
|
|
12
|
+
*/
|
|
13
|
+
export declare function complianceTagsForFinding(checkId: string, finding: FindingRef): string[];
|
|
14
|
+
export {};
|
|
2
15
|
//# sourceMappingURL=mapping.d.ts.map
|