@cclabsnz/sf-audit 1.16.0 → 1.18.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.
Files changed (170) hide show
  1. package/CHANGELOG.md +172 -1
  2. package/PERMISSIONS.md +139 -0
  3. package/README.md +98 -26
  4. package/config/scoring.sample.json +104 -5
  5. package/docs/permissionset/SF_Audit_ReadOnly.permissionset-meta.xml +54 -0
  6. package/lib/apps/analyzeApps.d.ts +8 -2
  7. package/lib/apps/analyzeApps.js +7 -2
  8. package/lib/apps/apiLogSource.d.ts +39 -0
  9. package/lib/apps/apiLogSource.js +75 -0
  10. package/lib/apps/appResolver.js +30 -4
  11. package/lib/apps/grantedAccess.js +16 -3
  12. package/lib/apps/leastPrivilege.d.ts +3 -1
  13. package/lib/apps/leastPrivilege.js +7 -3
  14. package/lib/apps/permissionSetGenerator.d.ts +22 -0
  15. package/lib/apps/permissionSetGenerator.js +100 -0
  16. package/lib/apps/types.d.ts +6 -0
  17. package/lib/apps/usageCollector.d.ts +7 -1
  18. package/lib/apps/usageCollector.js +57 -26
  19. package/lib/chains/CapabilityRegistry.js +26 -0
  20. package/lib/chains/ChainEngine.js +11 -1
  21. package/lib/chains/namedChains.js +130 -24
  22. package/lib/checks/CheckEngine.d.ts +3 -1
  23. package/lib/checks/CheckEngine.js +65 -26
  24. package/lib/checks/impl/AgentUserPrivilegeCheck.js +5 -4
  25. package/lib/checks/impl/AnonymousApexAuditCheck.js +41 -8
  26. package/lib/checks/impl/ApexCrudFLSCheck.js +45 -10
  27. package/lib/checks/impl/ApexSharingCheck.js +19 -26
  28. package/lib/checks/impl/ApiClientPermissionCheck.js +21 -5
  29. package/lib/checks/impl/AuditTrailCheck.js +23 -8
  30. package/lib/checks/impl/AuthProviderRegistrationHandlerCheck.d.ts +10 -0
  31. package/lib/checks/impl/AuthProviderRegistrationHandlerCheck.js +131 -0
  32. package/lib/checks/impl/CertificateExpiryCheck.js +2 -1
  33. package/lib/checks/impl/ConnectedAppScopeCheck.js +61 -5
  34. package/lib/checks/impl/ConnectedAppsCheck.js +60 -5
  35. package/lib/checks/impl/ContentLinksCheck.js +33 -9
  36. package/lib/checks/impl/CorsAllowlistCheck.js +3 -2
  37. package/lib/checks/impl/DataClassificationCheck.js +15 -13
  38. package/lib/checks/impl/DataCloudDataSpaceIsolationCheck.d.ts +10 -0
  39. package/lib/checks/impl/DataCloudDataSpaceIsolationCheck.js +116 -0
  40. package/lib/checks/impl/DebugLogAccessCheck.js +4 -4
  41. package/lib/checks/impl/DelegatedAdministrationGroupsCheck.d.ts +10 -0
  42. package/lib/checks/impl/DelegatedAdministrationGroupsCheck.js +76 -0
  43. package/lib/checks/impl/DelegatedAuthenticationExposureCheck.d.ts +10 -0
  44. package/lib/checks/impl/DelegatedAuthenticationExposureCheck.js +105 -0
  45. package/lib/checks/impl/DeploymentIdentityCheck.js +32 -5
  46. package/lib/checks/impl/EmailSecurityCheck.d.ts +1 -1
  47. package/lib/checks/impl/EmailSecurityCheck.js +14 -34
  48. package/lib/checks/impl/EncryptionCoverageCheck.js +21 -15
  49. package/lib/checks/impl/EnhancedDomainsCheck.js +17 -2
  50. package/lib/checks/impl/EscalationPermsCheck.d.ts +2 -0
  51. package/lib/checks/impl/EscalationPermsCheck.js +88 -21
  52. package/lib/checks/impl/ExperienceCloudSiteCheck.js +56 -5
  53. package/lib/checks/impl/ExternalAccountHierarchyExposureCheck.d.ts +10 -0
  54. package/lib/checks/impl/ExternalAccountHierarchyExposureCheck.js +65 -0
  55. package/lib/checks/impl/ExternalCredentialsCheck.js +6 -3
  56. package/lib/checks/impl/FailedLoginCheck.js +36 -9
  57. package/lib/checks/impl/FieldHistoryTrackingCheck.js +14 -11
  58. package/lib/checks/impl/FlowHttpCalloutCredentialBypassCheck.d.ts +10 -0
  59. package/lib/checks/impl/FlowHttpCalloutCredentialBypassCheck.js +115 -0
  60. package/lib/checks/impl/GenAiPromptTemplateGroundingCheck.d.ts +10 -0
  61. package/lib/checks/impl/GenAiPromptTemplateGroundingCheck.js +227 -0
  62. package/lib/checks/impl/GuestExecutableApexCheck.d.ts +1 -1
  63. package/lib/checks/impl/GuestExecutableApexCheck.js +105 -14
  64. package/lib/checks/impl/GuestRecordAccessPolicyCheck.js +52 -11
  65. package/lib/checks/impl/HardcodedCredentialsCheck.js +7 -2
  66. package/lib/checks/impl/HealthCheckCheck.js +1 -0
  67. package/lib/checks/impl/HighAssuranceSessionCheck.js +16 -11
  68. package/lib/checks/impl/InactiveUsersCheck.js +1 -1
  69. package/lib/checks/impl/InboundEmailHandlerExposureCheck.d.ts +10 -0
  70. package/lib/checks/impl/InboundEmailHandlerExposureCheck.js +136 -0
  71. package/lib/checks/impl/IntegrationLeastPrivilegeCheck.js +7 -6
  72. package/lib/checks/impl/InternalUserMfaCheck.js +26 -8
  73. package/lib/checks/impl/IpRestrictionsCheck.js +35 -16
  74. package/lib/checks/impl/LoginAccessPolicyCheck.js +5 -4
  75. package/lib/checks/impl/LoginAnomalyCheck.js +10 -7
  76. package/lib/checks/impl/LoginSessionCheck.js +2 -0
  77. package/lib/checks/impl/MfaEnforcementCheck.js +23 -6
  78. package/lib/checks/impl/MfaMethodStrengthCheck.js +18 -3
  79. package/lib/checks/impl/MfaRegistrationCheck.js +4 -3
  80. package/lib/checks/impl/MyDomainLoginPolicyCheck.js +23 -10
  81. package/lib/checks/impl/OauthDeviceAndAssetTokenFlowsCheck.d.ts +10 -0
  82. package/lib/checks/impl/OauthDeviceAndAssetTokenFlowsCheck.js +84 -0
  83. package/lib/checks/impl/OrgWideEmailSpoofingCheck.d.ts +10 -0
  84. package/lib/checks/impl/OrgWideEmailSpoofingCheck.js +106 -0
  85. package/lib/checks/impl/OutboundMessagesCheck.js +48 -6
  86. package/lib/checks/impl/PackagePostInstallSupplyChainCheck.d.ts +10 -0
  87. package/lib/checks/impl/PackagePostInstallSupplyChainCheck.js +89 -0
  88. package/lib/checks/impl/PlatformEventSubscriberContextCheck.d.ts +10 -0
  89. package/lib/checks/impl/PlatformEventSubscriberContextCheck.js +88 -0
  90. package/lib/checks/impl/PrivilegedAccessCheck.js +12 -5
  91. package/lib/checks/impl/ReleaseUpdatesCheck.js +18 -3
  92. package/lib/checks/impl/RemoteSitesCheck.js +4 -4
  93. package/lib/checks/impl/RestrictionRulesIntegrityCheck.d.ts +10 -0
  94. package/lib/checks/impl/RestrictionRulesIntegrityCheck.js +105 -0
  95. package/lib/checks/impl/SeparationOfDutiesCheck.js +14 -3
  96. package/lib/checks/impl/ShieldTenantSecretLifecycleCheck.d.ts +10 -0
  97. package/lib/checks/impl/ShieldTenantSecretLifecycleCheck.js +90 -0
  98. package/lib/checks/impl/SoapLoginApiAuthCheck.js +20 -8
  99. package/lib/checks/impl/SsoEnforcementCheck.js +16 -5
  100. package/lib/checks/impl/TransactionSecurityPolicyCheck.js +5 -5
  101. package/lib/checks/impl/TrustedIPRangesCheck.js +18 -9
  102. package/lib/checks/impl/UsersAndAdminsCheck.js +24 -4
  103. package/lib/checks/permCatalog.js +1 -1
  104. package/lib/checks/registry.js +30 -0
  105. package/lib/checks/support/apexAccess.d.ts +56 -0
  106. package/lib/checks/support/apexAccess.js +127 -0
  107. package/lib/checks/support/missingObject.d.ts +13 -0
  108. package/lib/checks/support/missingObject.js +37 -0
  109. package/lib/checks/support/schema.d.ts +17 -0
  110. package/lib/checks/support/schema.js +41 -0
  111. package/lib/commands/audit/apps.d.ts +1 -0
  112. package/lib/commands/audit/apps.js +86 -30
  113. package/lib/commands/audit/diff.js +2 -2
  114. package/lib/commands/audit/events/pull.js +3 -1
  115. package/lib/commands/audit/history.js +2 -2
  116. package/lib/commands/audit/incident/collect.js +3 -1
  117. package/lib/commands/audit/incident/report.js +2 -2
  118. package/lib/commands/audit/security.d.ts +3 -0
  119. package/lib/commands/audit/security.js +65 -10
  120. package/lib/commands/audit/timeline.js +2 -2
  121. package/lib/compliance/mapping.js +28 -7
  122. package/lib/findings/AuditResult.d.ts +10 -0
  123. package/lib/findings/CheckMeta.js +15 -0
  124. package/lib/findings/Finding.d.ts +4 -0
  125. package/lib/findings/ScoringConfig.d.ts +10 -8
  126. package/lib/findings/ScoringConfig.js +12 -5
  127. package/lib/findings/coverage.d.ts +34 -0
  128. package/lib/findings/coverage.js +42 -0
  129. package/lib/findings/exitCode.js +1 -1
  130. package/lib/findings/loadScoringConfig.js +51 -8
  131. package/lib/findings/scoring.js +61 -10
  132. package/lib/history/HistoryStore.js +9 -3
  133. package/lib/history/archivePolicy.d.ts +19 -0
  134. package/lib/history/archivePolicy.js +34 -0
  135. package/lib/incident/bundleIo.js +4 -3
  136. package/lib/incident/collect/collectBundle.d.ts +1 -1
  137. package/lib/incident/collect/collectBundle.js +4 -3
  138. package/lib/incident/collect/streamGuestLogs.d.ts +1 -1
  139. package/lib/incident/collect/streamGuestLogs.js +3 -2
  140. package/lib/incident/csv.js +4 -4
  141. package/lib/incident/render/evidence.js +3 -3
  142. package/lib/incident/render/html.js +2 -3
  143. package/lib/index.d.ts +2 -0
  144. package/lib/index.js +2 -0
  145. package/lib/lib/packageInfo.d.ts +6 -0
  146. package/lib/lib/packageInfo.js +19 -0
  147. package/lib/preflight/permissionMap.d.ts +2 -20
  148. package/lib/preflight/permissionMap.js +2 -43
  149. package/lib/preflight/permissions.d.ts +25 -0
  150. package/lib/preflight/permissions.js +50 -0
  151. package/lib/renderers/AttackChainDagRenderer.d.ts +7 -0
  152. package/lib/renderers/AttackChainDagRenderer.js +139 -0
  153. package/lib/renderers/ClientReportRenderer.d.ts +2 -0
  154. package/lib/renderers/ClientReportRenderer.js +34 -6
  155. package/lib/renderers/DiffHtmlRenderer.js +2 -7
  156. package/lib/renderers/HistoryRenderer.js +19 -11
  157. package/lib/renderers/HtmlRenderer.js +23 -6
  158. package/lib/renderers/MarkdownRenderer.js +11 -1
  159. package/lib/renderers/SarifRenderer.d.ts +43 -0
  160. package/lib/renderers/SarifRenderer.js +250 -0
  161. package/lib/report/ExecutivePriorities.js +1 -1
  162. package/lib/report/RemediationRoadmap.d.ts +5 -1
  163. package/lib/report/RemediationRoadmap.js +6 -2
  164. package/lib/waivers/WaiverLoader.d.ts +28 -0
  165. package/lib/waivers/WaiverLoader.js +103 -0
  166. package/lib/waivers/WaiverModel.d.ts +32 -0
  167. package/lib/waivers/WaiverModel.js +28 -0
  168. package/lib/waivers/applyWaivers.d.ts +22 -0
  169. package/lib/waivers/applyWaivers.js +85 -0
  170. package/package.json +6 -4
@@ -1,13 +1,15 @@
1
1
  import { z } from 'zod';
2
2
  import type { RiskLevel } from '@cclabsnz/sf-core';
3
3
  export declare const scoringConfigSchema: z.ZodObject<{
4
+ $schema: z.ZodOptional<z.ZodString>;
5
+ _comment: z.ZodOptional<z.ZodString>;
4
6
  riskScores: z.ZodOptional<z.ZodObject<{
5
7
  CRITICAL: z.ZodNumber;
6
8
  HIGH: z.ZodNumber;
7
9
  MEDIUM: z.ZodNumber;
8
10
  LOW: z.ZodNumber;
9
11
  INFO: z.ZodNumber;
10
- }, z.core.$strip>>;
12
+ }, z.core.$strict>>;
11
13
  checkWeights: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
12
14
  gradeThresholds: z.ZodOptional<z.ZodObject<{
13
15
  A: z.ZodOptional<z.ZodObject<{
@@ -15,33 +17,33 @@ export declare const scoringConfigSchema: z.ZodObject<{
15
17
  maxCritical: z.ZodOptional<z.ZodNumber>;
16
18
  maxHigh: z.ZodOptional<z.ZodNumber>;
17
19
  maxMedium: z.ZodOptional<z.ZodNumber>;
18
- }, z.core.$strip>>;
20
+ }, z.core.$strict>>;
19
21
  B: z.ZodOptional<z.ZodObject<{
20
22
  minScore: z.ZodOptional<z.ZodNumber>;
21
23
  maxCritical: z.ZodOptional<z.ZodNumber>;
22
24
  maxHigh: z.ZodOptional<z.ZodNumber>;
23
25
  maxMedium: z.ZodOptional<z.ZodNumber>;
24
- }, z.core.$strip>>;
26
+ }, z.core.$strict>>;
25
27
  C: z.ZodOptional<z.ZodObject<{
26
28
  minScore: z.ZodOptional<z.ZodNumber>;
27
29
  maxCritical: z.ZodOptional<z.ZodNumber>;
28
30
  maxHigh: z.ZodOptional<z.ZodNumber>;
29
31
  maxMedium: z.ZodOptional<z.ZodNumber>;
30
- }, z.core.$strip>>;
32
+ }, z.core.$strict>>;
31
33
  D: z.ZodOptional<z.ZodObject<{
32
34
  minScore: z.ZodOptional<z.ZodNumber>;
33
35
  maxCritical: z.ZodOptional<z.ZodNumber>;
34
36
  maxHigh: z.ZodOptional<z.ZodNumber>;
35
37
  maxMedium: z.ZodOptional<z.ZodNumber>;
36
- }, z.core.$strip>>;
38
+ }, z.core.$strict>>;
37
39
  F: z.ZodOptional<z.ZodObject<{
38
40
  minScore: z.ZodOptional<z.ZodNumber>;
39
41
  maxCritical: z.ZodOptional<z.ZodNumber>;
40
42
  maxHigh: z.ZodOptional<z.ZodNumber>;
41
43
  maxMedium: z.ZodOptional<z.ZodNumber>;
42
- }, z.core.$strip>>;
43
- }, z.core.$strip>>;
44
- }, z.core.$strip>;
44
+ }, z.core.$strict>>;
45
+ }, z.core.$strict>>;
46
+ }, z.core.$strict>;
45
47
  export type ScoringConfigInput = z.infer<typeof scoringConfigSchema>;
46
48
  export interface GradeConditions {
47
49
  minScore?: number;
@@ -1,16 +1,23 @@
1
1
  import { z } from 'zod';
2
2
  const nonNegativeInt = z.number().int().nonnegative();
3
- const gradeConditionsSchema = z.object({
4
- minScore: nonNegativeInt.optional(),
3
+ // Every object is strict: an unknown or misspelled key ("gradeTresholds", "minscore") is an error,
4
+ // not a silently ignored override. Keep this in step with schemas/scoring-config.schema.json —
5
+ // test/unit/findings/ScoringConfig.test.ts checks the two agree.
6
+ const gradeConditionsSchema = z.strictObject({
7
+ minScore: nonNegativeInt.max(100).optional(),
5
8
  maxCritical: nonNegativeInt.optional(),
6
9
  maxHigh: nonNegativeInt.optional(),
7
10
  maxMedium: nonNegativeInt.optional(),
8
11
  });
9
- export const scoringConfigSchema = z.object({
12
+ export const scoringConfigSchema = z.strictObject({
13
+ /** Editor hint pointing at schemas/scoring-config.schema.json; ignored. */
14
+ $schema: z.string().optional(),
15
+ /** Free-text note, as in config/scoring.sample.json; ignored. */
16
+ _comment: z.string().optional(),
10
17
  /** When provided, ALL five risk levels (CRITICAL, HIGH, MEDIUM, LOW, INFO) must be present.
11
18
  * The entire object is replaced atomically during merge, not key-by-key. */
12
19
  riskScores: z
13
- .object({
20
+ .strictObject({
14
21
  CRITICAL: nonNegativeInt,
15
22
  HIGH: nonNegativeInt,
16
23
  MEDIUM: nonNegativeInt,
@@ -20,7 +27,7 @@ export const scoringConfigSchema = z.object({
20
27
  .optional(),
21
28
  checkWeights: z.record(z.string(), nonNegativeInt).optional(),
22
29
  gradeThresholds: z
23
- .object({
30
+ .strictObject({
24
31
  A: gradeConditionsSchema.optional(),
25
32
  B: gradeConditionsSchema.optional(),
26
33
  C: gradeConditionsSchema.optional(),
@@ -0,0 +1,34 @@
1
+ import type { Finding } from './Finding.js';
2
+ /**
3
+ * Below this share of checks gathering evidence, a run cannot be graded A: too much of the org
4
+ * went unseen for a clean result to mean the org is clean.
5
+ */
6
+ export declare const MIN_COVERAGE_FOR_A = 90;
7
+ export interface EvidenceCoverage {
8
+ /** Checks that ran (produced at least one finding). */
9
+ checksRun: number;
10
+ /** Checks that gathered evidence for at least one of their findings. */
11
+ checksAssessed: number;
12
+ /** checksAssessed / checksRun, as a whole percentage. 100 when nothing ran. */
13
+ percent: number;
14
+ /** Ids of the checks that gathered no evidence at all, sorted. */
15
+ notAssessed: string[];
16
+ }
17
+ /**
18
+ * How much of the audit actually saw the org. A check counts as not assessed when every finding
19
+ * it produced is inconclusive or marks the check as not run (a crash, or a permission error
20
+ * CheckEngine caught). A check with some evidence and some gaps is assessed: its gaps are already
21
+ * visible as its own inconclusive findings.
22
+ */
23
+ export declare function evidenceCoverage(findings: readonly Finding[]): EvidenceCoverage;
24
+ /** One line for every output: "Evidence coverage 82% (14 of 17 checks); grade capped at B". */
25
+ export declare function coverageSummary(coverage: EvidenceCoverage & {
26
+ gradeCapped?: boolean;
27
+ }): string;
28
+ /**
29
+ * What a reader should do about unassessed checks, or '' when every check gathered evidence.
30
+ * Inconclusive is not one cause: each finding quotes what the org said, and only an access
31
+ * error is fixed by granting permissions.
32
+ */
33
+ export declare function coverageAdvice(coverage: EvidenceCoverage): string;
34
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Below this share of checks gathering evidence, a run cannot be graded A: too much of the org
3
+ * went unseen for a clean result to mean the org is clean.
4
+ */
5
+ export const MIN_COVERAGE_FOR_A = 90;
6
+ /**
7
+ * How much of the audit actually saw the org. A check counts as not assessed when every finding
8
+ * it produced is inconclusive or marks the check as not run (a crash, or a permission error
9
+ * CheckEngine caught). A check with some evidence and some gaps is assessed: its gaps are already
10
+ * visible as its own inconclusive findings.
11
+ */
12
+ export function evidenceCoverage(findings) {
13
+ const byCheck = new Map();
14
+ for (const f of findings) {
15
+ const id = f.checkId ?? f.id;
16
+ const sawEvidence = !(f.inconclusive || f.notAssessed);
17
+ byCheck.set(id, (byCheck.get(id) ?? false) || sawEvidence);
18
+ }
19
+ const notAssessed = [...byCheck].filter(([, assessed]) => !assessed).map(([id]) => id).sort();
20
+ const checksRun = byCheck.size;
21
+ const checksAssessed = checksRun - notAssessed.length;
22
+ const percent = checksRun === 0 ? 100 : Math.floor((checksAssessed / checksRun) * 100);
23
+ return { checksRun, checksAssessed, percent, notAssessed };
24
+ }
25
+ /** One line for every output: "Evidence coverage 82% (14 of 17 checks); grade capped at B". */
26
+ export function coverageSummary(coverage) {
27
+ const base = `Evidence coverage ${coverage.percent}% (${coverage.checksAssessed} of ${coverage.checksRun} checks)`;
28
+ return coverage.gradeCapped ? `${base}; grade capped at B, below the ${MIN_COVERAGE_FOR_A}% needed for an A` : base;
29
+ }
30
+ /**
31
+ * What a reader should do about unassessed checks, or '' when every check gathered evidence.
32
+ * Inconclusive is not one cause: each finding quotes what the org said, and only an access
33
+ * error is fixed by granting permissions.
34
+ */
35
+ export function coverageAdvice(coverage) {
36
+ if (coverage.notAssessed.length === 0)
37
+ return '';
38
+ return ('Each unassessed check has an inconclusive finding quoting what the org returned. Where the cause is access, ' +
39
+ '`sf audit preflight` lists the permissions the audit user is missing, and PERMISSIONS.md ' +
40
+ '(https://github.com/cclabsnz/sf-audit-plugin/blob/main/PERMISSIONS.md) has the read-only permission set to assign.');
41
+ }
42
+ //# sourceMappingURL=coverage.js.map
@@ -22,7 +22,7 @@ export function violationsFor(findings, failOn) {
22
22
  if (threshold < 0)
23
23
  return [];
24
24
  return findings.filter((f) => {
25
- if (f.passed === true || f.inconclusive === true)
25
+ if (f.passed === true || f.inconclusive === true || f.waived === true)
26
26
  return false;
27
27
  const rank = ORDER.indexOf(f.riskLevel);
28
28
  return rank >= 0 && rank <= threshold;
@@ -1,4 +1,5 @@
1
1
  import * as fs from 'node:fs';
2
+ import { z } from 'zod';
2
3
  import { scoringConfigSchema, DEFAULT_SCORING_CONFIG } from './ScoringConfig.js';
3
4
  export function loadScoringConfig(filePath, knownCheckIds, warn) {
4
5
  if (!filePath)
@@ -17,7 +18,17 @@ export function loadScoringConfig(filePath, knownCheckIds, warn) {
17
18
  catch (err) {
18
19
  throw new Error(`Invalid JSON in scoring config '${filePath}': ${err instanceof Error ? err.message : String(err)}`);
19
20
  }
20
- const validated = scoringConfigSchema.parse(parsed); // throws ZodError on failure
21
+ let validated;
22
+ try {
23
+ validated = scoringConfigSchema.parse(parsed);
24
+ }
25
+ catch (err) {
26
+ if (err instanceof z.ZodError) {
27
+ const details = err.issues.map((i) => ` - ${i.path.join('.') || 'root'}: ${i.message}`).join('\n');
28
+ throw new Error(`Invalid scoring config in '${filePath}':\n${details}`);
29
+ }
30
+ throw err;
31
+ }
21
32
  // Warn on unknown check IDs and drop them
22
33
  const safeCheckWeights = {};
23
34
  const rawWeights = validated.checkWeights ?? {};
@@ -29,16 +40,48 @@ export function loadScoringConfig(filePath, knownCheckIds, warn) {
29
40
  safeCheckWeights[id] = weight;
30
41
  }
31
42
  }
43
+ const gradeThresholds = {
44
+ A: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.A, ...validated.gradeThresholds?.A },
45
+ B: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.B, ...validated.gradeThresholds?.B },
46
+ C: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.C, ...validated.gradeThresholds?.C },
47
+ D: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.D, ...validated.gradeThresholds?.D },
48
+ F: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.F, ...validated.gradeThresholds?.F },
49
+ };
50
+ const orderErrors = thresholdOrderErrors(gradeThresholds);
51
+ if (orderErrors.length > 0) {
52
+ throw new Error(`Invalid scoring config in '${filePath}' (grade thresholds after merging with defaults):\n${orderErrors.map((e) => ` - ${e}`).join('\n')}`);
53
+ }
32
54
  return {
33
55
  riskScores: validated.riskScores ?? DEFAULT_SCORING_CONFIG.riskScores,
34
56
  checkWeights: safeCheckWeights,
35
- gradeThresholds: {
36
- A: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.A, ...validated.gradeThresholds?.A },
37
- B: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.B, ...validated.gradeThresholds?.B },
38
- C: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.C, ...validated.gradeThresholds?.C },
39
- D: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.D, ...validated.gradeThresholds?.D },
40
- F: { ...DEFAULT_SCORING_CONFIG.gradeThresholds.F, ...validated.gradeThresholds?.F },
41
- },
57
+ gradeThresholds,
42
58
  };
43
59
  }
60
+ const GRADE_ORDER = ['A', 'B', 'C', 'D'];
61
+ /**
62
+ * Grades are tried A first, then B, C, D, so each grade must be at least as strict as the next.
63
+ * A lower bar on A than on B would make B unreachable, which is never what the author meant.
64
+ * The JSON Schema cannot express this cross-field rule, so it lives here, applied to the merged
65
+ * result (a one-grade override can contradict a default on its neighbour).
66
+ */
67
+ function thresholdOrderErrors(t) {
68
+ const errors = [];
69
+ for (let i = 0; i < GRADE_ORDER.length - 1; i++) {
70
+ const hi = GRADE_ORDER[i];
71
+ const lo = GRADE_ORDER[i + 1];
72
+ const a = t[hi];
73
+ const b = t[lo];
74
+ if (a.minScore !== undefined && b.minScore !== undefined && a.minScore < b.minScore) {
75
+ errors.push(`gradeThresholds.${hi}.minScore (${a.minScore}) is below gradeThresholds.${lo}.minScore (${b.minScore})`);
76
+ }
77
+ for (const key of ['maxCritical', 'maxHigh', 'maxMedium']) {
78
+ const av = a[key];
79
+ const bv = b[key];
80
+ if (av !== undefined && bv !== undefined && av > bv) {
81
+ errors.push(`gradeThresholds.${hi}.${key} (${av}) is above gradeThresholds.${lo}.${key} (${bv})`);
82
+ }
83
+ }
84
+ }
85
+ return errors;
86
+ }
44
87
  //# sourceMappingURL=loadScoringConfig.js.map
@@ -1,5 +1,6 @@
1
1
  import { EMPTY_METRICS } from '@cclabsnz/sf-core';
2
2
  import { DEFAULT_SCORING_CONFIG } from './ScoringConfig.js';
3
+ import { evidenceCoverage, MIN_COVERAGE_FOR_A } from './coverage.js';
3
4
  function meetsConditions(conditions, healthScore, criticalCount, highCount, mediumCount) {
4
5
  if (conditions.minScore !== undefined && healthScore < conditions.minScore)
5
6
  return false;
@@ -11,24 +12,63 @@ function meetsConditions(conditions, healthScore, criticalCount, highCount, medi
11
12
  return false;
12
13
  return true;
13
14
  }
15
+ const plural = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;
16
+ /**
17
+ * Why the audit got this grade: the first condition of the next better grade it failed, or, for
18
+ * an A, that it met every condition. Thresholds come from the scoring config, so custom ones are
19
+ * explained in their own terms.
20
+ */
21
+ function explainGrade(grade, config, healthScore, counts, gradeCapped, coveragePercent) {
22
+ if (gradeCapped) {
23
+ return `B: evidence coverage ${coveragePercent}% is below the ${MIN_COVERAGE_FOR_A}% needed for an A`;
24
+ }
25
+ const order = ['A', 'B', 'C', 'D', 'F'];
26
+ const better = order[order.indexOf(grade) - 1];
27
+ if (!better)
28
+ return `A: health score ${healthScore}/100 with no condition for a higher grade unmet`;
29
+ const t = config.gradeThresholds[better];
30
+ // "3 CRITICAL findings", or "5 CRITICAL (3 findings, 2 attack chains)" when chains count too.
31
+ const what = (n, level) => {
32
+ const c = counts.chains[level];
33
+ return c === 0 ? plural(n, `${level} finding`) : `${n} ${level} (${plural(n - c, 'finding')}, ${plural(c, 'attack chain')})`;
34
+ };
35
+ const allows = (max) => (max === 0 ? 'none' : `at most ${max}`);
36
+ if (t.maxCritical !== undefined && counts.criticalCount > t.maxCritical) {
37
+ return `${grade}: ${what(counts.criticalCount, 'CRITICAL')} (${better} allows ${allows(t.maxCritical)})`;
38
+ }
39
+ if (t.maxHigh !== undefined && counts.highCount > t.maxHigh) {
40
+ return `${grade}: ${what(counts.highCount, 'HIGH')} (${better} allows ${allows(t.maxHigh)})`;
41
+ }
42
+ if (t.maxMedium !== undefined && counts.mediumCount > t.maxMedium) {
43
+ return `${grade}: ${what(counts.mediumCount, 'MEDIUM')} (${better} allows ${allows(t.maxMedium)})`;
44
+ }
45
+ if (t.minScore !== undefined && healthScore < t.minScore) {
46
+ return `${grade}: health score ${healthScore}/100 (${better} needs ${t.minScore})`;
47
+ }
48
+ return `${grade}: did not meet the conditions for ${better}`;
49
+ }
14
50
  export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORING_CONFIG, attackChains = []) {
15
- // Passed and inconclusive findings carry no penalty — exclude from numerator.
16
- // They remain in maxPossible so a broad passing audit still dilutes real failures.
51
+ // Passed, inconclusive and waived findings carry no penalty — exclude from numerator.
52
+ // Passed findings remain in maxPossible so a broad passing audit still dilutes real failures.
53
+ // Unassessed ones do not: a check that gathered no evidence must not improve the score.
54
+ const unassessed = (f) => Boolean(f.inconclusive || f.notAssessed);
17
55
  const totalScore = findings.reduce((sum, f) => {
18
- if (f.passed || f.inconclusive)
56
+ if (f.passed || f.waived || unassessed(f))
19
57
  return sum;
20
58
  return sum + (f.checkId !== undefined ? (config.checkWeights[f.checkId] ?? config.riskScores[f.riskLevel]) : config.riskScores[f.riskLevel]);
21
59
  }, 0);
22
60
  const chainScore = attackChains.reduce((sum, c) => sum + config.riskScores[c.severity], 0);
23
61
  const totalWithChains = totalScore + chainScore;
24
- const maxPossible = (findings.length + attackChains.length) * 10;
62
+ const maxPossible = (findings.filter((f) => !unassessed(f)).length + attackChains.length) * 10;
25
63
  const healthScore = Math.max(0, 100 - Math.round((totalWithChains / Math.max(maxPossible, 1)) * 100));
26
- const chainCrit = attackChains.filter((c) => c.severity === 'CRITICAL').length;
27
- const chainHigh = attackChains.filter((c) => c.severity === 'HIGH').length;
28
- const chainMed = attackChains.filter((c) => c.severity === 'MEDIUM').length;
29
- const criticalCount = findings.filter((f) => f.riskLevel === 'CRITICAL').length + chainCrit;
30
- const highCount = findings.filter((f) => f.riskLevel === 'HIGH').length + chainHigh;
31
- const mediumCount = findings.filter((f) => f.riskLevel === 'MEDIUM').length + chainMed;
64
+ // Only open findings and named chains set the grade. A potential chain is inferred from
65
+ // capability overlap, not matched to a known attack, so it is reported but does not grade.
66
+ const named = attackChains.filter((c) => c.confidence !== 'potential');
67
+ const open = findings.filter((f) => !f.waived && !f.passed && !unassessed(f));
68
+ const count = (level) => open.filter((f) => f.riskLevel === level).length + named.filter((c) => c.severity === level).length;
69
+ const criticalCount = count('CRITICAL');
70
+ const highCount = count('HIGH');
71
+ const mediumCount = count('MEDIUM');
32
72
  const grades = ['A', 'B', 'C', 'D'];
33
73
  let grade = 'F';
34
74
  for (const g of grades) {
@@ -37,6 +77,14 @@ export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORIN
37
77
  break;
38
78
  }
39
79
  }
80
+ const waivedFindings = findings.filter((f) => f.waived);
81
+ // A run that could not see enough of the org is never graded A. Coverage is reported either way.
82
+ const coverage = evidenceCoverage(findings);
83
+ const gradeCapped = grade === 'A' && coverage.percent < MIN_COVERAGE_FOR_A;
84
+ if (gradeCapped)
85
+ grade = 'B';
86
+ const chainCount = (level) => named.filter((c) => c.severity === level).length;
87
+ const gradeReason = explainGrade(grade, config, healthScore, { criticalCount, highCount, mediumCount, chains: { CRITICAL: chainCount('CRITICAL'), HIGH: chainCount('HIGH'), MEDIUM: chainCount('MEDIUM') } }, gradeCapped, coverage.percent);
40
88
  return {
41
89
  generatedAt: new Date(),
42
90
  orgId: ctx.orgInfo.id,
@@ -49,7 +97,10 @@ export function buildAuditResult(ctx, findings, metrics, config = DEFAULT_SCORIN
49
97
  metrics: { ...EMPTY_METRICS, ...metrics },
50
98
  healthScore,
51
99
  grade,
100
+ gradeReason,
52
101
  attackChains,
102
+ waivedFindings: waivedFindings.length > 0 ? waivedFindings : undefined,
103
+ coverage: { ...coverage, gradeCapped },
53
104
  };
54
105
  }
55
106
  //# sourceMappingURL=scoring.js.map
@@ -1,7 +1,7 @@
1
- // src/history/HistoryStore.ts
2
1
  import * as fs from 'node:fs';
3
2
  import * as os from 'node:os';
4
3
  import * as path from 'node:path';
4
+ import { secureFs } from '@cclabsnz/sf-core';
5
5
  function parseResult(raw) {
6
6
  const obj = JSON.parse(raw);
7
7
  obj.generatedAt = new Date(obj.generatedAt);
@@ -11,6 +11,12 @@ export class HistoryStore {
11
11
  root;
12
12
  constructor(root) {
13
13
  this.root = root ?? HistoryStore.defaultRoot();
14
+ try {
15
+ secureFs.ensureSecureDir(this.root);
16
+ }
17
+ catch {
18
+ // Non-fatal if root cannot be secured immediately
19
+ }
14
20
  }
15
21
  static defaultRoot() {
16
22
  return path.join(os.homedir(), '.sf', 'audit-history');
@@ -18,10 +24,10 @@ export class HistoryStore {
18
24
  archive(result) {
19
25
  try {
20
26
  const dir = path.join(this.root, result.orgId);
21
- fs.mkdirSync(dir, { recursive: true });
27
+ secureFs.mkdirSync(dir, { recursive: true });
22
28
  const suffix = Math.random().toString(36).slice(2, 8);
23
29
  const filename = `sf-audit-${result.orgId}-${Date.now()}-${suffix}.json`;
24
- fs.writeFileSync(path.join(dir, filename), JSON.stringify(result, null, 2), 'utf-8');
30
+ secureFs.writeFileSync(path.join(dir, filename), JSON.stringify(result, null, 2), 'utf-8');
25
31
  }
26
32
  catch (err) {
27
33
  process.stderr.write(`[sf-audit] Warning: could not archive audit result: ${String(err)}\n`);
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether `sf audit security` should auto-archive its result to the local history store.
3
+ *
4
+ * A CI runner is usually ephemeral, so archiving there only writes org data to a disk
5
+ * nobody reads again, and on a shared self-hosted runner it leaves that data behind for
6
+ * the next job. Archiving is therefore off in CI unless the caller opts back in.
7
+ */
8
+ export interface ArchiveFlags {
9
+ 'no-history'?: boolean;
10
+ 'keep-history'?: boolean;
11
+ }
12
+ /**
13
+ * Detect a CI environment. `CI` is the de-facto convention (GitHub Actions, GitLab,
14
+ * CircleCI, Buildkite, Travis, Bitbucket all set it); the others cover runners that don't.
15
+ */
16
+ export declare function isCiEnvironment(env?: NodeJS.ProcessEnv): boolean;
17
+ /** `--keep-history` always wins; otherwise `--no-history` or a detected CI run skips the archive. */
18
+ export declare function shouldArchiveHistory(flags: ArchiveFlags, env?: NodeJS.ProcessEnv): boolean;
19
+ //# sourceMappingURL=archivePolicy.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Whether `sf audit security` should auto-archive its result to the local history store.
3
+ *
4
+ * A CI runner is usually ephemeral, so archiving there only writes org data to a disk
5
+ * nobody reads again, and on a shared self-hosted runner it leaves that data behind for
6
+ * the next job. Archiving is therefore off in CI unless the caller opts back in.
7
+ */
8
+ /** Values of `CI` that mean "not CI". Anything else non-empty (`true`, `1`, `yes`...) counts. */
9
+ const FALSY = new Set(['', '0', 'false', 'no', 'off']);
10
+ /**
11
+ * Detect a CI environment. `CI` is the de-facto convention (GitHub Actions, GitLab,
12
+ * CircleCI, Buildkite, Travis, Bitbucket all set it); the others cover runners that don't.
13
+ */
14
+ export function isCiEnvironment(env = process.env) {
15
+ const ci = env.CI;
16
+ if (ci !== undefined && !FALSY.has(ci.trim().toLowerCase()))
17
+ return true;
18
+ if (env.GITHUB_ACTIONS === 'true')
19
+ return true;
20
+ if (env.TF_BUILD !== undefined && env.TF_BUILD !== '')
21
+ return true; // Azure Pipelines
22
+ if (env.JENKINS_URL !== undefined && env.JENKINS_URL !== '')
23
+ return true;
24
+ return false;
25
+ }
26
+ /** `--keep-history` always wins; otherwise `--no-history` or a detected CI run skips the archive. */
27
+ export function shouldArchiveHistory(flags, env = process.env) {
28
+ if (flags['keep-history'])
29
+ return true;
30
+ if (flags['no-history'])
31
+ return false;
32
+ return !isCiEnvironment(env);
33
+ }
34
+ //# sourceMappingURL=archivePolicy.js.map
@@ -1,6 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { createReadStream, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
2
+ import { createReadStream, existsSync, readFileSync, renameSync } from 'node:fs';
3
3
  import { dirname, join } from 'node:path';
4
+ import { secureFs } from '@cclabsnz/sf-core';
4
5
  import { readCsvRecords } from './csv.js';
5
6
  export const BUNDLE_PATHS = {
6
7
  manifest: 'manifest.json',
@@ -19,9 +20,9 @@ export async function sha256File(path) {
19
20
  return h.digest('hex');
20
21
  }
21
22
  export function writeJsonAtomic(path, value) {
22
- mkdirSync(dirname(path), { recursive: true });
23
+ secureFs.mkdirSync(dirname(path), { recursive: true });
23
24
  const part = `${path}.part`;
24
- writeFileSync(part, JSON.stringify(value, null, 2));
25
+ secureFs.writeFileSync(part, JSON.stringify(value, null, 2));
25
26
  renameSync(part, path);
26
27
  }
27
28
  export class BundleIntegrityError extends Error {
@@ -1,4 +1,4 @@
1
- import type { RestClient, SoqlClient } from '@cclabsnz/sf-core';
1
+ import { type RestClient, type SoqlClient } from '@cclabsnz/sf-core';
2
2
  import type { BundleManifest } from '../model.js';
3
3
  export interface CollectOptions {
4
4
  sinceDays: number;
@@ -1,7 +1,8 @@
1
1
  // src/incident/collect/collectBundle.ts
2
- import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs';
2
+ import { copyFileSync, existsSync, readFileSync, rmSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
4
  import { basename, join } from 'node:path';
5
+ import { secureFs } from '@cclabsnz/sf-core';
5
6
  import { BUNDLE_PATHS, loadBundle, sha256File, writeJsonAtomic } from '../bundleIo.js';
6
7
  import { findActors } from '../analyse/actors.js';
7
8
  import { loadIpRanges, rangeFileName } from '../ipRanges.js';
@@ -37,7 +38,7 @@ async function priorLogs(dir, orgId, guestIds) {
37
38
  }
38
39
  export async function collectBundle(ctx, opts) {
39
40
  const dir = opts.outputDir;
40
- mkdirSync(dir, { recursive: true });
41
+ secureFs.mkdirSync(dir, { recursive: true });
41
42
  const collectedAt = new Date().toISOString();
42
43
  const anomalies = await readAnomalies(ctx.soql, opts.sinceDays);
43
44
  if (!anomalies.available && !opts.window) {
@@ -88,7 +89,7 @@ export async function collectBundle(ctx, opts) {
88
89
  for (const [index, f] of opts.ipRangeFiles.entries()) {
89
90
  // Indexed, so two files with the same name (aws/ranges.txt, gcp/ranges.txt) cannot overwrite each other.
90
91
  const rel = `ip-ranges/${index}-${basename(f)}`;
91
- mkdirSync(join(dir, 'ip-ranges'), { recursive: true });
92
+ secureFs.mkdirSync(join(dir, 'ip-ranges'), { recursive: true });
92
93
  copyFileSync(f, join(dir, rel));
93
94
  ipRangeFiles.push(rel);
94
95
  }
@@ -1,4 +1,4 @@
1
- import type { RestClient, SoqlClient } from '@cclabsnz/sf-core';
1
+ import { type RestClient, type SoqlClient } from '@cclabsnz/sf-core';
2
2
  import { type LogCoverage, type LogType, type Wave } from '../model.js';
3
3
  /** Columns a log of this type needs but its header lacks. Every type needs a user column. */
4
4
  export declare function missingColumns(type: LogType, header: string[]): string[];
@@ -1,6 +1,7 @@
1
1
  // src/incident/collect/streamGuestLogs.ts
2
- import { mkdirSync, rmSync, renameSync, statfsSync } from 'node:fs';
2
+ import { rmSync, renameSync, statfsSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
+ import { secureFs } from '@cclabsnz/sf-core';
4
5
  import { degrades } from './orgErrors.js';
5
6
  import { filterLogFile, MissingColumnsError } from '../csv.js';
6
7
  import { logPath } from '../bundleIo.js';
@@ -47,7 +48,7 @@ onLogDone = () => { }) {
47
48
  const tmp = join(bundleDir, '.tmp');
48
49
  // A killed earlier run can leave raw, unfiltered logs here, which contain non-guest data.
49
50
  rmSync(tmp, { recursive: true, force: true });
50
- mkdirSync(tmp, { recursive: true });
51
+ secureFs.mkdirSync(tmp, { recursive: true });
51
52
  for (const day of days) {
52
53
  for (const type of LOG_TYPES) {
53
54
  const prior = reuse(type, day);
@@ -1,5 +1,5 @@
1
- import { createReadStream, createWriteStream, rmSync, existsSync, statSync } from 'node:fs';
2
- import { mkdir } from 'node:fs/promises';
1
+ import { createReadStream, rmSync, existsSync, statSync } from 'node:fs';
2
+ import { secureFs } from '@cclabsnz/sf-core';
3
3
  import { dirname } from 'node:path';
4
4
  import { finished } from 'node:stream/promises';
5
5
  import { id15 } from './model.js';
@@ -101,8 +101,8 @@ export class MissingColumnsError extends Error {
101
101
  * the header lacks; any at all fails the file closed with MissingColumnsError.
102
102
  */
103
103
  export async function filterLogFile(rawPath, outPath, guestIds, opts = {}) {
104
- await mkdir(dirname(outPath), { recursive: true });
105
- const out = createWriteStream(outPath);
104
+ await secureFs.mkdir(dirname(outPath), { recursive: true });
105
+ const out = secureFs.createWriteStream(outPath);
106
106
  const result = { totalRows: 0, guestRows: 0, guestRowsByUser: {}, malformed: 0 };
107
107
  let header;
108
108
  let userCols = [];
@@ -1,6 +1,6 @@
1
1
  // src/incident/render/evidence.ts
2
- import { mkdirSync, writeFileSync } from 'node:fs';
3
2
  import { join } from 'node:path';
3
+ import { secureFs } from '@cclabsnz/sf-core';
4
4
  import { csvLine } from '../csv.js';
5
5
  import { NOT_COLLECTED, auraCollectedDays, coveredDays } from './labels.js';
6
6
  /** Every number in the report cites one of these tables; ids are assigned in a fixed order. */
@@ -42,10 +42,10 @@ export function buildEvidence(r) {
42
42
  /** Spreadsheet formula-injection guard, applied to written files only (csvLine stays raw for the log filter). */
43
43
  const neutralise = (c) => (/^[=+\-@\t\r]/.test(c) ? `'${c}` : c);
44
44
  export function writeEvidence(dir, tables) {
45
- mkdirSync(join(dir, 'evidence'), { recursive: true });
45
+ secureFs.mkdirSync(join(dir, 'evidence'), { recursive: true });
46
46
  return tables.map((t) => {
47
47
  const p = join(dir, 'evidence', `${t.id}.csv`);
48
- writeFileSync(p, csvLine(t.columns.map(neutralise)) + t.rows.map((row) => csvLine(row.map(neutralise))).join(''));
48
+ secureFs.writeFileSync(p, csvLine(t.columns.map(neutralise)) + t.rows.map((row) => csvLine(row.map(neutralise))).join(''));
49
49
  return p;
50
50
  });
51
51
  }
@@ -1,5 +1,4 @@
1
- // src/incident/render/html.ts
2
- import { esc, fontFaceCss } from '@cclabsnz/sf-core';
1
+ import { esc, fontFaceCss, INTERACTIVE_CSP_META } from '@cclabsnz/sf-core';
3
2
  import { chartJsScript } from '../../renderers/chartAsset.js';
4
3
  import { toolCreditHtml } from '../../renderers/toolCredit.js';
5
4
  import { CLASSIFICATION_LABEL, RESULT_LABEL, auraCollectedDays, coveredDays } from './labels.js';
@@ -56,7 +55,7 @@ export function renderHtml(r, ev, b) {
56
55
  const chart = JSON.stringify({ ...timelineData(r), colours: CHART_COLOURS, ink: b.ink, muted: b.muted, border: b.border, font: b.fontBody }).replace(/</g, '\\u003c');
57
56
  const sec = (num, title) => `<div class="sh"><span class="sec-num">${num} /</span><h2>${title}</h2></div>`;
58
57
  return `<!doctype html>
59
- <html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Guest-access incident report: ${esc(r.orgName)}</title>
58
+ <html lang="en"><head><meta charset="utf-8">${INTERACTIVE_CSP_META}<meta name="viewport" content="width=device-width,initial-scale=1"><title>Guest-access incident report: ${esc(r.orgName)}</title>
60
59
  <style>${fontFaceCss()}
61
60
  :root{--ink:${b.ink};--bg:${b.bg};--bgalt:${b.bgAlt};--muted:${b.muted};--border:${b.border};--primary:${b.primary};
62
61
  --display:'${b.fontDisplay}',Georgia,serif;--body:'${b.fontBody}',system-ui,sans-serif;--mono:ui-monospace,'SF Mono',Menlo,monospace;
package/lib/index.d.ts CHANGED
@@ -5,4 +5,6 @@ export type { OrgMetrics } from '@cclabsnz/sf-core';
5
5
  export type { AuditDiff, FindingChange, FindingChangeType, MetricDelta } from './history/AuditDiff.js';
6
6
  export { HistoryStore } from './history/HistoryStore.js';
7
7
  export { computeDiff } from './history/DiffEngine.js';
8
+ export { WaiverLoader } from './waivers/WaiverLoader.js';
9
+ export { applyWaivers } from './waivers/applyWaivers.js';
8
10
  //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export { HistoryStore } from './history/HistoryStore.js';
2
2
  export { computeDiff } from './history/DiffEngine.js';
3
+ export { WaiverLoader } from './waivers/WaiverLoader.js';
4
+ export { applyWaivers } from './waivers/applyWaivers.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ export interface PackageInfo {
2
+ name: string;
3
+ version: string;
4
+ }
5
+ export declare function packageInfo(): PackageInfo;
6
+ //# sourceMappingURL=packageInfo.d.ts.map