@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
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { CHECK_NZ_CITATIONS } from './nz/citations.generated.js';
|
|
1
2
|
// Maps each check id to the compliance control ids it relates to.
|
|
2
3
|
// Migrated from the former ComplianceMapping. A08/A10 are mapped precisely:
|
|
3
4
|
// A10 (SSRF) → egress controls (remote-sites, csp-trusted-sites, named-credentials)
|
|
4
5
|
// A08 (Software & Data Integrity) → installed-packages, deployment-identity
|
|
5
|
-
// NZ
|
|
6
|
+
// NZ Privacy Act ids are layered on by domain via NZ_CROSSWALK below; HISO 10029 and NZISM ids come
|
|
7
|
+
// per check from the generated crosswalk, and attach per finding (see complianceTagsForFinding).
|
|
6
8
|
const BASE_CHECK_CONTROL_MAP = {
|
|
7
9
|
'users-and-admins': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-004'],
|
|
8
10
|
'permissions': ['OWASP-A01', 'SOC2-CC6.1', 'ISO-A.5.18', 'SBS-ACS-002', 'SBS-ACS-005'],
|
|
@@ -162,25 +164,44 @@ const DOMAIN = {
|
|
|
162
164
|
configGovernance: ['health-check', 'api-limits', 'release-updates', 'legacy-api-version', 'installed-packages', 'deployment-identity', 'session-hardening',
|
|
163
165
|
'package-post-install-supply-chain'],
|
|
164
166
|
accountLifecycle: ['inactive-users'],
|
|
165
|
-
// Agentforce / GenAI. The
|
|
166
|
-
//
|
|
167
|
-
//
|
|
167
|
+
// Agentforce / GenAI. The Privacy Act domain crosswalk does not cover these; HIPAA and GDPR do, because
|
|
168
|
+
// an over-privileged agent user reading PHI or personal data is squarely an access-control and
|
|
169
|
+
// security-of-processing question. HISO 10029 and NZISM cite them per check from the generated
|
|
170
|
+
// crosswalk, applying the general access, logging and development requirements to the agent user.
|
|
168
171
|
aiAgents: ['agent-inventory', 'agent-user-privilege', 'agent-action-surface', 'agent-channel-exposure',
|
|
169
172
|
'agent-monitoring-coverage', 'trusted-url-hygiene', 'agent-query-reach', 'agent-outbound-actions',
|
|
170
173
|
'genai-prompt-template-grounding'],
|
|
171
174
|
};
|
|
172
|
-
// NZ
|
|
175
|
+
// NZ Privacy Act: IPPs are statute-level, so they are layered on by domain. (SCF's Privacy Act
|
|
176
|
+
// column maps Part 6 breach notification sections, not the IPPs, so it is not used here.)
|
|
173
177
|
const NZ_CROSSWALK = [
|
|
174
|
-
{ controls: ['
|
|
175
|
-
{ controls: ['
|
|
176
|
-
{ controls: ['HISO-CRYPTO', 'NZISM-CRYPTO', 'PRIVACY-IPP5'], checks: DOMAIN.crypto },
|
|
177
|
-
{ controls: ['HISO-LOG', 'NZISM-LOG'], checks: DOMAIN.logging },
|
|
178
|
-
{ controls: ['HISO-DEV', 'NZISM-SW'], checks: DOMAIN.devSecurity },
|
|
179
|
-
{ controls: ['HISO-COMM', 'NZISM-NET', 'PRIVACY-IPP12'], checks: DOMAIN.network },
|
|
180
|
-
{ controls: ['HISO-DATA', 'PRIVACY-IPP5'], checks: DOMAIN.dataGovernance },
|
|
181
|
-
{ controls: ['HISO-GOV', 'NZISM-CONFIG'], checks: DOMAIN.configGovernance },
|
|
178
|
+
{ controls: ['PRIVACY-IPP5'], checks: [...DOMAIN.accessControl, ...DOMAIN.authentication, ...DOMAIN.crypto, ...DOMAIN.dataGovernance] },
|
|
179
|
+
{ controls: ['PRIVACY-IPP12'], checks: DOMAIN.network },
|
|
182
180
|
{ controls: ['PRIVACY-IPP9'], checks: DOMAIN.accountLifecycle },
|
|
183
181
|
];
|
|
182
|
+
const isNzId = (id) => id.startsWith('HISO-') || id.startsWith('NZISM-');
|
|
183
|
+
// A scope entry names one finding id exactly; one ending in '-' names every id it prefixes (for ids
|
|
184
|
+
// built from a template, such as `trusted-url-hygiene-parked-${domain}`). Exact by default, so
|
|
185
|
+
// `permissions-api-enabled` does not also match the passed `permissions-api-enabled-ok`.
|
|
186
|
+
const inScope = (id, p) => (p.endsWith('-') ? id.startsWith(p) : id === p);
|
|
187
|
+
function appliesTo(findings, finding) {
|
|
188
|
+
if (!finding)
|
|
189
|
+
return true;
|
|
190
|
+
if (finding.riskLevel === 'INFO' || finding.passed || finding.inconclusive)
|
|
191
|
+
return false;
|
|
192
|
+
return !findings || findings.some((p) => inScope(finding.id, p));
|
|
193
|
+
}
|
|
194
|
+
function nzCitationIds(check, finding) {
|
|
195
|
+
const c = CHECK_NZ_CITATIONS[check];
|
|
196
|
+
if (!c)
|
|
197
|
+
return [];
|
|
198
|
+
const hsup = c.hsup.map((h, i) => ({ h, hml: c.hml[i] })).filter(({ h }) => appliesTo(h.findings, finding));
|
|
199
|
+
return [
|
|
200
|
+
...hsup.map(({ h }) => `HISO-${h.id}`),
|
|
201
|
+
...hsup.map(({ hml }) => `HISO-${hml}`),
|
|
202
|
+
...c.nzism.filter((n) => appliesTo(n.findings, finding)).map((n) => `NZISM-${n.section}`),
|
|
203
|
+
];
|
|
204
|
+
}
|
|
184
205
|
// HIPAA / GDPR crosswalk — the domain-wide obligations. Anything narrower than a whole domain is
|
|
185
206
|
// mapped per check in REGULATORY_PRECISE below rather than swept across the domain, because these
|
|
186
207
|
// ids name a specific implementation specification or article paragraph: claiming "automatic
|
|
@@ -253,6 +274,8 @@ function buildCheckControlMap() {
|
|
|
253
274
|
for (const [check, ids] of Object.entries(REGULATORY_PRECISE)) {
|
|
254
275
|
(map[check] ??= []).push(...ids);
|
|
255
276
|
}
|
|
277
|
+
for (const check of Object.keys(map))
|
|
278
|
+
map[check].push(...nzCitationIds(check));
|
|
256
279
|
// A control can arrive from both a crosswalk and a precise entry; a compliance matrix must not
|
|
257
280
|
// render the same control twice for one check.
|
|
258
281
|
for (const check of Object.keys(map))
|
|
@@ -260,4 +283,13 @@ function buildCheckControlMap() {
|
|
|
260
283
|
return map;
|
|
261
284
|
}
|
|
262
285
|
export const CHECK_CONTROL_MAP = buildCheckControlMap();
|
|
286
|
+
/**
|
|
287
|
+
* The control ids one finding carries. Every framework but HISO 10029 and NZISM maps at check level,
|
|
288
|
+
* so those ids are the check's. HISO and NZISM citations attach only to active findings (not INFO, passed
|
|
289
|
+
* or inconclusive), and only to the findings a scoped citation names (spec/nz-compliance-crosswalk.md, RULE-127).
|
|
290
|
+
*/
|
|
291
|
+
export function complianceTagsForFinding(checkId, finding) {
|
|
292
|
+
const base = (CHECK_CONTROL_MAP[checkId] ?? []).filter((id) => !isNzId(id));
|
|
293
|
+
return [...new Set([...base, ...nzCitationIds(checkId, finding)])];
|
|
294
|
+
}
|
|
263
295
|
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CheckNzCitations } from './types.js';
|
|
2
|
+
export declare const SCF_SOURCE: {
|
|
3
|
+
readonly name: "Secure Controls Framework";
|
|
4
|
+
readonly version: "2026.3";
|
|
5
|
+
readonly url: "https://securecontrolsframework.com";
|
|
6
|
+
readonly commit: "d08211314fc7ccfca8e6c84d2b27a2030339ef9c";
|
|
7
|
+
readonly sha256: "5a89bf2d3c106a9a87d4b6e3d62dd3e147d0e960d4c07473045a10aa8a7df697";
|
|
8
|
+
readonly licence: "CC BY-ND 4.0, SCF Council";
|
|
9
|
+
};
|
|
10
|
+
export declare const HISO_SOURCES: {
|
|
11
|
+
readonly hiso3: {
|
|
12
|
+
readonly title: "HISO 10029.3:2023 Guidance for Medium to Large Organisations";
|
|
13
|
+
readonly url: "https://static.info.content.health.nz/docs/HISO/HISO-10029-3-2023-Health-Information-Security-Framework-Guidance-for-Medium-to-Large-Organisations.pdf";
|
|
14
|
+
readonly sha256: "4352c6cba0593182ce7e69838b236789e990985b6bfbc15f10de80377092f577";
|
|
15
|
+
readonly licence: "CC BY 4.0, Health New Zealand | Te Whatu Ora";
|
|
16
|
+
};
|
|
17
|
+
readonly hiso4: {
|
|
18
|
+
readonly title: "HISO 10029.4:2025 Guidance for Suppliers";
|
|
19
|
+
readonly url: "https://static.info.content.health.nz/docs/HISO/HISO-10029-4-Health-Information-Security-Framework-Guidance-for-Suppliers.pdf";
|
|
20
|
+
readonly sha256: "464e78f2a345986a2110436b1f86bbe2431946e3c89a4acb579ab5618eddb45a";
|
|
21
|
+
readonly licence: "CC BY 4.0, Health New Zealand | Te Whatu Ora";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const NZISM_SOURCE: {
|
|
25
|
+
readonly version: "3.9";
|
|
26
|
+
readonly url: "https://nzism.gcsb.govt.nz/ism-document";
|
|
27
|
+
};
|
|
28
|
+
export declare const HML_REQUIREMENTS: Record<string, {
|
|
29
|
+
area: string;
|
|
30
|
+
statement: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const HSUP_REQUIREMENTS: Record<string, {
|
|
33
|
+
area: string;
|
|
34
|
+
statement: string;
|
|
35
|
+
}>;
|
|
36
|
+
export declare const HSUP_TO_HML: Record<string, string>;
|
|
37
|
+
export declare const NZISM_SECTIONS: Record<string, {
|
|
38
|
+
title: string;
|
|
39
|
+
controls: {
|
|
40
|
+
id: string;
|
|
41
|
+
level: string;
|
|
42
|
+
}[];
|
|
43
|
+
}>;
|
|
44
|
+
export declare const CHECK_NZ_CITATIONS: Record<string, CheckNzCitations>;
|
|
45
|
+
//# sourceMappingURL=citations.generated.d.ts.map
|