@dataparade/cli 0.0.35 → 0.1.1

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 (140) hide show
  1. package/README.md +1 -0
  2. package/dist/package.json +4 -4
  3. package/dist/src/ai-enrichment/pii-signal-rules.d.ts +5 -0
  4. package/dist/src/ai-enrichment/pii-signal-rules.js +2 -3
  5. package/dist/src/ai-enrichment/provider-prompt.js +1 -0
  6. package/dist/src/ai-enrichment/providers/provider-contract.js +2 -44
  7. package/dist/src/ai-enrichment/third-party-data-flow.js +5 -4
  8. package/dist/src/cli.js +9 -3
  9. package/dist/src/discoveries/contract/ocsf-discovery-record.d.ts +4 -1
  10. package/dist/src/discoveries/contract/ocsf-discovery-record.js +1 -1
  11. package/dist/src/discoveries/contract/ontology-pins.d.ts +6 -4
  12. package/dist/src/discoveries/contract/ontology-pins.js +7 -5
  13. package/dist/src/facts/build-facts.d.ts +2 -0
  14. package/dist/src/facts/build-facts.js +18 -0
  15. package/dist/src/facts/layout.d.ts +4 -0
  16. package/dist/src/facts/layout.js +5 -1
  17. package/dist/src/facts/scan-stamps.d.ts +7 -0
  18. package/dist/src/facts/scan-stamps.js +30 -0
  19. package/dist/src/facts/schema.d.ts +178 -0
  20. package/dist/src/facts/schema.js +37 -1
  21. package/dist/src/kb/data-category-catalog.generated.d.ts +34 -0
  22. package/dist/src/kb/data-category-catalog.generated.js +962 -0
  23. package/dist/src/kb/kb-store.js +4 -1
  24. package/dist/src/kb/migrate.js +4 -2
  25. package/dist/src/kb/slot-shapes.d.ts +3 -2
  26. package/dist/src/kb/slot-shapes.js +13 -8
  27. package/dist/src/kb/taxonomy.d.ts +12 -6
  28. package/dist/src/kb/taxonomy.js +13 -18
  29. package/dist/src/output/scan-output-excludes.js +2 -0
  30. package/dist/src/output/write-scan-knowledge.d.ts +5 -1
  31. package/dist/src/output/write-scan-knowledge.js +21 -0
  32. package/dist/src/threat-model/build-threat-model.d.ts +3 -0
  33. package/dist/src/threat-model/build-threat-model.js +71 -0
  34. package/dist/src/threat-model/carry-forward-person-set-statuses.d.ts +8 -0
  35. package/dist/src/threat-model/carry-forward-person-set-statuses.js +87 -0
  36. package/dist/src/threat-model/io.d.ts +19 -0
  37. package/dist/src/threat-model/io.js +63 -0
  38. package/dist/src/threat-model/schema.d.ts +214 -0
  39. package/dist/src/threat-model/schema.js +75 -0
  40. package/dist/src/ui/scan-progress-renderer.d.ts +8 -1
  41. package/dist/src/ui/scan-progress-renderer.js +20 -1
  42. package/dist/src/upload/collect-scan-sidecars.d.ts +2 -1
  43. package/dist/src/upload/collect-scan-sidecars.js +3 -1
  44. package/dist/tests/cli/cli.spec.js +10 -1
  45. package/dist/tests/helpers/facts-fixture.js +16 -16
  46. package/dist/tests/schema/scan-result.schema.spec.js +1 -1
  47. package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +1 -1
  48. package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +5 -5
  49. package/dist/tests/unit/core/graph-mapping.spec.js +4 -3
  50. package/dist/tests/unit/discoveries/write-ocsf-discoveries-long-ids.spec.js +3 -3
  51. package/dist/tests/unit/export/export-ocsf.spec.js +4 -4
  52. package/dist/tests/unit/facts/apply-answers.spec.js +20 -20
  53. package/dist/tests/unit/facts/build-facts.spec.js +143 -45
  54. package/dist/tests/unit/facts/identity.spec.js +13 -0
  55. package/dist/tests/unit/facts/scan-stamps.spec.js +32 -0
  56. package/dist/tests/unit/facts/slug.spec.js +2 -0
  57. package/dist/tests/unit/kb/answer-fingerprint.spec.js +9 -9
  58. package/dist/tests/unit/kb/data-category-catalog.spec.d.ts +1 -0
  59. package/dist/tests/unit/kb/data-category-catalog.spec.js +65 -0
  60. package/dist/tests/unit/kb/kb-interview-loop.spec.js +8 -7
  61. package/dist/tests/unit/kb/migrate.spec.js +2 -2
  62. package/dist/tests/unit/output/scan-output-excludes.spec.js +1 -1
  63. package/dist/tests/unit/threat-model/build-threat-model.spec.d.ts +1 -0
  64. package/dist/tests/unit/threat-model/build-threat-model.spec.js +189 -0
  65. package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.d.ts +1 -0
  66. package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.js +163 -0
  67. package/dist/tests/unit/threat-model/io.spec.d.ts +1 -0
  68. package/dist/tests/unit/threat-model/io.spec.js +103 -0
  69. package/dist/tests/unit/threat-model/schema.spec.d.ts +1 -0
  70. package/dist/tests/unit/threat-model/schema.spec.js +42 -0
  71. package/dist/tests/unit/ui/scan-progress-renderer.spec.js +58 -0
  72. package/dist/tests/unit/upload/collect-scan-sidecars.spec.js +8 -5
  73. package/dist/vendor/scanner/dist/src/analyze/code-navigator.d.ts +1 -1
  74. package/dist/vendor/scanner/dist/src/analyze/code-navigator.js +4 -0
  75. package/dist/vendor/scanner/dist/src/analyze/column-catalog.d.ts +1 -1
  76. package/dist/vendor/scanner/dist/src/analyze/column-catalog.js +2 -2
  77. package/dist/vendor/scanner/dist/src/analyze/concept-profile.d.ts +2 -2
  78. package/dist/vendor/scanner/dist/src/analyze/concept-profile.js +5 -3
  79. package/dist/vendor/scanner/dist/src/core/pipeline/build-scan-personal-data-layers.js +1 -1
  80. package/dist/vendor/scanner/dist/src/core/pipeline/deterministic-scan.js +43 -0
  81. package/dist/vendor/scanner/dist/src/core/pipeline/graph-mapping.js +23 -2
  82. package/dist/vendor/scanner/dist/src/core/pipeline/mixed-app-terraform-scan.js +1 -0
  83. package/dist/vendor/scanner/dist/src/core/pipeline/orchestrator-result.d.ts +2 -2
  84. package/dist/vendor/scanner/dist/src/core/pipeline/terraform-minimal-services.js +1 -0
  85. package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.d.ts +160 -2
  86. package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.js +24 -0
  87. package/dist/vendor/scanner/dist/src/core/types/data-flow.d.ts +48 -0
  88. package/dist/vendor/scanner/dist/src/core/types/data-flow.js +53 -0
  89. package/dist/vendor/scanner/dist/src/data-flow/detect.js +1 -0
  90. package/dist/vendor/scanner/dist/src/data-flow/ensure-hub-linked-assets.js +1 -0
  91. package/dist/vendor/scanner/dist/src/data-flow/ensure-manifest-declared-flows.js +1 -0
  92. package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.d.ts +30 -0
  93. package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.js +277 -0
  94. package/dist/vendor/scanner/dist/src/data-flow/flow-builder.js +6 -0
  95. package/dist/vendor/scanner/dist/src/data-flow/flow-controls.d.ts +24 -0
  96. package/dist/vendor/scanner/dist/src/data-flow/flow-controls.js +238 -0
  97. package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.d.ts +22 -0
  98. package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.js +69 -0
  99. package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.d.ts +13 -0
  100. package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.js +263 -0
  101. package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.d.ts +2 -1
  102. package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.js +3 -0
  103. package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.d.ts +37 -0
  104. package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.js +483 -0
  105. package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.d.ts +3 -0
  106. package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.js +12 -17
  107. package/dist/vendor/scanner/dist/src/data-flow/terraform-flows.js +5 -1
  108. package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.d.ts +5 -1
  109. package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.js +17 -37
  110. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.d.ts +36 -5
  111. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.js +53 -60
  112. package/dist/vendor/scanner/dist/src/eval/canonical/graph/endpoints.js +2 -9
  113. package/dist/vendor/scanner/dist/src/eval/canonical/scanner/personal-data.js +10 -7
  114. package/dist/vendor/scanner/dist/src/graph/build-dataparade-graph.js +3 -1
  115. package/dist/vendor/scanner/dist/src/index.d.ts +6 -0
  116. package/dist/vendor/scanner/dist/src/index.js +16 -1
  117. package/dist/vendor/scanner/dist/src/patterns/engine.js +1 -0
  118. package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.d.ts +1 -1
  119. package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.js +2 -2
  120. package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.d.ts +3 -3
  121. package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.js +12 -11
  122. package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.d.ts +44 -0
  123. package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.js +167 -0
  124. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-aliases.js +43 -43
  125. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.d.ts +12 -1
  126. package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.js +28 -7
  127. package/dist/vendor/scanner/dist/src/pii-signals/signal-token.js +1 -1
  128. package/dist/vendor/scanner/dist/src/threats/stride.d.ts +98 -0
  129. package/dist/vendor/scanner/dist/src/threats/stride.js +179 -0
  130. package/dist/vendor/scanner/package.json +2 -2
  131. package/dist/vendor/scanner/patterns/concept-profiles.yaml +2 -2
  132. package/dist/vendor/scanner/patterns/flow-authentication.rules.yaml +75 -0
  133. package/dist/vendor/scanner/patterns/flow-controls.rules.yaml +68 -0
  134. package/dist/vendor/scanner/patterns/personal-data-taxonomy.yaml +155 -0
  135. package/dist/vendor/scanner/patterns/pii-signals.rules.yaml +38 -49
  136. package/dist/vendor/scanner/patterns/stride.rules.yaml +86 -0
  137. package/package.json +4 -4
  138. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.d.ts +0 -17
  139. package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.js +0 -108
  140. package/dist/vendor/scanner/patterns/personal-data-concept-map.yaml +0 -76
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The threat model file, schema v1 (DATAP-920): `.dataparade/threat-model.json`.
3
+ *
4
+ * A scan writes one threat per element and framework category. The rule status comes from the
5
+ * scanner's rules. A person's own status lives in `personSetStatus`, which a scan carries
6
+ * forward and never overwrites. See docs/cli/scan-output.md.
7
+ */
8
+ import { z } from "zod";
9
+ export declare const THREAT_MODEL_SCHEMA_VERSION: 1;
10
+ export declare const threatElementKindSchema: z.ZodEnum<{
11
+ component: "component";
12
+ dataFlow: "dataFlow";
13
+ }>;
14
+ export declare const threatRuleStatusSchema: z.ZodEnum<{
15
+ unknown: "unknown";
16
+ mitigated: "mitigated";
17
+ open: "open";
18
+ }>;
19
+ export declare const personSetThreatStatusValueSchema: z.ZodEnum<{
20
+ mitigated: "mitigated";
21
+ open: "open";
22
+ accepted: "accepted";
23
+ not_applicable: "not_applicable";
24
+ }>;
25
+ export declare const threatEvidenceSchema: z.ZodObject<{
26
+ control: z.ZodString;
27
+ filePath: z.ZodString;
28
+ line: z.ZodNumber;
29
+ }, z.core.$strip>;
30
+ export declare const personSetThreatStatusSchema: z.ZodObject<{
31
+ status: z.ZodEnum<{
32
+ mitigated: "mitigated";
33
+ open: "open";
34
+ accepted: "accepted";
35
+ not_applicable: "not_applicable";
36
+ }>;
37
+ by: z.ZodOptional<z.ZodString>;
38
+ at: z.ZodOptional<z.ZodString>;
39
+ note: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ export declare const threatModelThreatSchema: z.ZodObject<{
42
+ id: z.ZodString;
43
+ elementId: z.ZodString;
44
+ elementKind: z.ZodEnum<{
45
+ component: "component";
46
+ dataFlow: "dataFlow";
47
+ }>;
48
+ frameworkElementKind: z.ZodString;
49
+ elementIdentityKey: z.ZodOptional<z.ZodString>;
50
+ framework: z.ZodString;
51
+ category: z.ZodString;
52
+ ruleStatus: z.ZodEnum<{
53
+ unknown: "unknown";
54
+ mitigated: "mitigated";
55
+ open: "open";
56
+ }>;
57
+ ruleId: z.ZodString;
58
+ statusRuleId: z.ZodOptional<z.ZodString>;
59
+ evidence: z.ZodArray<z.ZodObject<{
60
+ control: z.ZodString;
61
+ filePath: z.ZodString;
62
+ line: z.ZodNumber;
63
+ }, z.core.$strip>>;
64
+ personSetStatus: z.ZodOptional<z.ZodObject<{
65
+ status: z.ZodEnum<{
66
+ mitigated: "mitigated";
67
+ open: "open";
68
+ accepted: "accepted";
69
+ not_applicable: "not_applicable";
70
+ }>;
71
+ by: z.ZodOptional<z.ZodString>;
72
+ at: z.ZodOptional<z.ZodString>;
73
+ note: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$strip>>;
75
+ }, z.core.$strip>;
76
+ export declare const unmatchedPersonSetThreatStatusSchema: z.ZodObject<{
77
+ threatId: z.ZodString;
78
+ elementId: z.ZodString;
79
+ elementKind: z.ZodEnum<{
80
+ component: "component";
81
+ dataFlow: "dataFlow";
82
+ }>;
83
+ elementIdentityKey: z.ZodOptional<z.ZodString>;
84
+ framework: z.ZodString;
85
+ category: z.ZodString;
86
+ personSetStatus: z.ZodObject<{
87
+ status: z.ZodEnum<{
88
+ mitigated: "mitigated";
89
+ open: "open";
90
+ accepted: "accepted";
91
+ not_applicable: "not_applicable";
92
+ }>;
93
+ by: z.ZodOptional<z.ZodString>;
94
+ at: z.ZodOptional<z.ZodString>;
95
+ note: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strip>;
97
+ lastMatchedScannedAt: z.ZodString;
98
+ }, z.core.$strip>;
99
+ export declare const threatFrameworkCategorySchema: z.ZodObject<{
100
+ id: z.ZodString;
101
+ name: z.ZodString;
102
+ }, z.core.$strip>;
103
+ export declare const threatFrameworkSchema: z.ZodObject<{
104
+ id: z.ZodString;
105
+ rulesVersion: z.ZodNumber;
106
+ categories: z.ZodArray<z.ZodObject<{
107
+ id: z.ZodString;
108
+ name: z.ZodString;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>;
111
+ export declare const threatModelFileSchema: z.ZodObject<{
112
+ schemaVersion: z.ZodLiteral<1>;
113
+ scan: z.ZodObject<{
114
+ projectName: z.ZodString;
115
+ scannedAt: z.ZodString;
116
+ cliVersion: z.ZodString;
117
+ scannerVersion: z.ZodString;
118
+ stamps: z.ZodOptional<z.ZodObject<{
119
+ scannerCommit: z.ZodString;
120
+ cliVersion: z.ZodString;
121
+ catalogHash: z.ZodString;
122
+ configHash: z.ZodString;
123
+ aiInference: z.ZodBoolean;
124
+ structureGraph: z.ZodBoolean;
125
+ commitSha: z.ZodNullable<z.ZodString>;
126
+ dirty: z.ZodNullable<z.ZodBoolean>;
127
+ rootCommitSha: z.ZodNullable<z.ZodString>;
128
+ scanRoot: z.ZodNullable<z.ZodString>;
129
+ }, z.core.$strip>>;
130
+ gitBranch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ }, z.core.$strip>;
132
+ frameworks: z.ZodArray<z.ZodObject<{
133
+ id: z.ZodString;
134
+ rulesVersion: z.ZodNumber;
135
+ categories: z.ZodArray<z.ZodObject<{
136
+ id: z.ZodString;
137
+ name: z.ZodString;
138
+ }, z.core.$strip>>;
139
+ }, z.core.$strip>>;
140
+ threats: z.ZodArray<z.ZodObject<{
141
+ id: z.ZodString;
142
+ elementId: z.ZodString;
143
+ elementKind: z.ZodEnum<{
144
+ component: "component";
145
+ dataFlow: "dataFlow";
146
+ }>;
147
+ frameworkElementKind: z.ZodString;
148
+ elementIdentityKey: z.ZodOptional<z.ZodString>;
149
+ framework: z.ZodString;
150
+ category: z.ZodString;
151
+ ruleStatus: z.ZodEnum<{
152
+ unknown: "unknown";
153
+ mitigated: "mitigated";
154
+ open: "open";
155
+ }>;
156
+ ruleId: z.ZodString;
157
+ statusRuleId: z.ZodOptional<z.ZodString>;
158
+ evidence: z.ZodArray<z.ZodObject<{
159
+ control: z.ZodString;
160
+ filePath: z.ZodString;
161
+ line: z.ZodNumber;
162
+ }, z.core.$strip>>;
163
+ personSetStatus: z.ZodOptional<z.ZodObject<{
164
+ status: z.ZodEnum<{
165
+ mitigated: "mitigated";
166
+ open: "open";
167
+ accepted: "accepted";
168
+ not_applicable: "not_applicable";
169
+ }>;
170
+ by: z.ZodOptional<z.ZodString>;
171
+ at: z.ZodOptional<z.ZodString>;
172
+ note: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strip>>;
174
+ }, z.core.$strip>>;
175
+ unmatchedPersonSetStatuses: z.ZodArray<z.ZodObject<{
176
+ threatId: z.ZodString;
177
+ elementId: z.ZodString;
178
+ elementKind: z.ZodEnum<{
179
+ component: "component";
180
+ dataFlow: "dataFlow";
181
+ }>;
182
+ elementIdentityKey: z.ZodOptional<z.ZodString>;
183
+ framework: z.ZodString;
184
+ category: z.ZodString;
185
+ personSetStatus: z.ZodObject<{
186
+ status: z.ZodEnum<{
187
+ mitigated: "mitigated";
188
+ open: "open";
189
+ accepted: "accepted";
190
+ not_applicable: "not_applicable";
191
+ }>;
192
+ by: z.ZodOptional<z.ZodString>;
193
+ at: z.ZodOptional<z.ZodString>;
194
+ note: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strip>;
196
+ lastMatchedScannedAt: z.ZodString;
197
+ }, z.core.$strip>>;
198
+ }, z.core.$strip>;
199
+ export type ThreatElementKind = z.infer<typeof threatElementKindSchema>;
200
+ export type ThreatRuleStatus = z.infer<typeof threatRuleStatusSchema>;
201
+ export type PersonSetThreatStatusValue = z.infer<typeof personSetThreatStatusValueSchema>;
202
+ export type EffectiveThreatStatus = ThreatRuleStatus | PersonSetThreatStatusValue;
203
+ export type ThreatEvidence = z.infer<typeof threatEvidenceSchema>;
204
+ export type PersonSetThreatStatus = z.infer<typeof personSetThreatStatusSchema>;
205
+ export type ThreatModelThreat = z.infer<typeof threatModelThreatSchema>;
206
+ export type UnmatchedPersonSetThreatStatus = z.infer<typeof unmatchedPersonSetThreatStatusSchema>;
207
+ export type ThreatFramework = z.infer<typeof threatFrameworkSchema>;
208
+ export type ThreatModelFile = z.infer<typeof threatModelFileSchema>;
209
+ export declare function threatIdForElementAndCategory(threat: {
210
+ elementId: string;
211
+ framework: string;
212
+ category: string;
213
+ }): string;
214
+ export declare function effectiveThreatStatus(threat: Pick<ThreatModelThreat, "ruleStatus" | "personSetStatus">): EffectiveThreatStatus;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.threatModelFileSchema = exports.threatFrameworkSchema = exports.threatFrameworkCategorySchema = exports.unmatchedPersonSetThreatStatusSchema = exports.threatModelThreatSchema = exports.personSetThreatStatusSchema = exports.threatEvidenceSchema = exports.personSetThreatStatusValueSchema = exports.threatRuleStatusSchema = exports.threatElementKindSchema = exports.THREAT_MODEL_SCHEMA_VERSION = void 0;
4
+ exports.threatIdForElementAndCategory = threatIdForElementAndCategory;
5
+ exports.effectiveThreatStatus = effectiveThreatStatus;
6
+ /**
7
+ * The threat model file, schema v1 (DATAP-920): `.dataparade/threat-model.json`.
8
+ *
9
+ * A scan writes one threat per element and framework category. The rule status comes from the
10
+ * scanner's rules. A person's own status lives in `personSetStatus`, which a scan carries
11
+ * forward and never overwrites. See docs/cli/scan-output.md.
12
+ */
13
+ const zod_1 = require("zod");
14
+ const schema_1 = require("../facts/schema");
15
+ exports.THREAT_MODEL_SCHEMA_VERSION = 1;
16
+ exports.threatElementKindSchema = zod_1.z.enum(["component", "dataFlow"]);
17
+ exports.threatRuleStatusSchema = zod_1.z.enum(["mitigated", "open", "unknown"]);
18
+ exports.personSetThreatStatusValueSchema = zod_1.z.enum(["mitigated", "open", "accepted", "not_applicable"]);
19
+ exports.threatEvidenceSchema = zod_1.z.object({
20
+ control: zod_1.z.string(),
21
+ filePath: zod_1.z.string(),
22
+ line: zod_1.z.number(),
23
+ });
24
+ exports.personSetThreatStatusSchema = zod_1.z.object({
25
+ status: exports.personSetThreatStatusValueSchema,
26
+ by: zod_1.z.string().optional(),
27
+ at: zod_1.z.string().optional(),
28
+ note: zod_1.z.string().optional(),
29
+ });
30
+ exports.threatModelThreatSchema = zod_1.z.object({
31
+ id: zod_1.z.string(),
32
+ elementId: zod_1.z.string(),
33
+ elementKind: exports.threatElementKindSchema,
34
+ frameworkElementKind: zod_1.z.string(),
35
+ elementIdentityKey: zod_1.z.string().optional(),
36
+ framework: zod_1.z.string(),
37
+ category: zod_1.z.string(),
38
+ ruleStatus: exports.threatRuleStatusSchema,
39
+ ruleId: zod_1.z.string(),
40
+ statusRuleId: zod_1.z.string().optional(),
41
+ evidence: zod_1.z.array(exports.threatEvidenceSchema),
42
+ personSetStatus: exports.personSetThreatStatusSchema.optional(),
43
+ });
44
+ exports.unmatchedPersonSetThreatStatusSchema = zod_1.z.object({
45
+ threatId: zod_1.z.string(),
46
+ elementId: zod_1.z.string(),
47
+ elementKind: exports.threatElementKindSchema,
48
+ elementIdentityKey: zod_1.z.string().optional(),
49
+ framework: zod_1.z.string(),
50
+ category: zod_1.z.string(),
51
+ personSetStatus: exports.personSetThreatStatusSchema,
52
+ lastMatchedScannedAt: zod_1.z.string(),
53
+ });
54
+ exports.threatFrameworkCategorySchema = zod_1.z.object({
55
+ id: zod_1.z.string(),
56
+ name: zod_1.z.string(),
57
+ });
58
+ exports.threatFrameworkSchema = zod_1.z.object({
59
+ id: zod_1.z.string(),
60
+ rulesVersion: zod_1.z.number(),
61
+ categories: zod_1.z.array(exports.threatFrameworkCategorySchema),
62
+ });
63
+ exports.threatModelFileSchema = zod_1.z.object({
64
+ schemaVersion: zod_1.z.literal(exports.THREAT_MODEL_SCHEMA_VERSION),
65
+ scan: schema_1.factsFileSchema.shape.scan,
66
+ frameworks: zod_1.z.array(exports.threatFrameworkSchema),
67
+ threats: zod_1.z.array(exports.threatModelThreatSchema),
68
+ unmatchedPersonSetStatuses: zod_1.z.array(exports.unmatchedPersonSetThreatStatusSchema),
69
+ });
70
+ function threatIdForElementAndCategory(threat) {
71
+ return `threat:${threat.elementId}:${threat.framework}:${threat.category}`;
72
+ }
73
+ function effectiveThreatStatus(threat) {
74
+ return threat.personSetStatus?.status ?? threat.ruleStatus;
75
+ }
@@ -8,6 +8,11 @@ type ClackPrompts = typeof import('@clack/prompts');
8
8
  */
9
9
  export declare function formatPreviewLink(url: string, colorEnabled: boolean): string;
10
10
  export declare function formatAiStepResult(result: ScanAiStepResult): string;
11
+ /**
12
+ * Same wording as the web import preview summary: "Scan duration: 3.2s".
13
+ * Returns undefined when ms is not a finite non-negative number.
14
+ */
15
+ export declare function formatScanDuration(ms: number): string | undefined;
11
16
  /** Output path relative to cwd when it lives below it, otherwise the ~ form. */
12
17
  export declare function formatOutputPath(outputPath: string): string;
13
18
  /** Prefer a short, human path in the header (home → ~). */
@@ -79,7 +84,9 @@ export declare class ScanProgressRenderer {
79
84
  * Clack folds them into one dimmed note so they don't break the guide rail.
80
85
  */
81
86
  showTechnicalDetails(title: string, lines: string[]): void;
82
- finish(): void;
87
+ finish(options?: {
88
+ scanDurationMs?: number;
89
+ }): void;
83
90
  /**
84
91
  * Cancel an in-flight scan UI (Ctrl+C). Stops the spinner with a red mark
85
92
  * in Clack mode; prints a short line in plain mode. Does not run finish().
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ScanProgressRenderer = void 0;
7
7
  exports.formatPreviewLink = formatPreviewLink;
8
8
  exports.formatAiStepResult = formatAiStepResult;
9
+ exports.formatScanDuration = formatScanDuration;
9
10
  exports.formatOutputPath = formatOutputPath;
10
11
  exports.formatProjectLabel = formatProjectLabel;
11
12
  exports.createScanProgressRenderer = createScanProgressRenderer;
@@ -64,6 +65,15 @@ function formatAiStepResult(result) {
64
65
  ? 'Filled in 1 detail from your code'
65
66
  : `Filled in ${applied} details from your code`;
66
67
  }
68
+ /**
69
+ * Same wording as the web import preview summary: "Scan duration: 3.2s".
70
+ * Returns undefined when ms is not a finite non-negative number.
71
+ */
72
+ function formatScanDuration(ms) {
73
+ if (!Number.isFinite(ms) || ms < 0)
74
+ return undefined;
75
+ return `Scan duration: ${(ms / 1000).toFixed(1)}s`;
76
+ }
67
77
  /** Output path relative to cwd when it lives below it, otherwise the ~ form. */
68
78
  function formatOutputPath(outputPath) {
69
79
  const relative = node_path_1.default.relative(process.cwd(), outputPath);
@@ -306,11 +316,14 @@ class ScanProgressRenderer {
306
316
  }
307
317
  }
308
318
  }
309
- finish() {
319
+ finish(options) {
310
320
  if (this.closed)
311
321
  return;
312
322
  this.closed = true;
313
323
  this.completeActiveStep();
324
+ const durationLine = typeof options?.scanDurationMs === 'number'
325
+ ? formatScanDuration(options.scanDurationMs)
326
+ : undefined;
314
327
  const nextSteps = [];
315
328
  let closing = 'All done — nice work.';
316
329
  if (this.uploadFailure) {
@@ -332,6 +345,9 @@ class ScanProgressRenderer {
332
345
  nextSteps.push('Jump into DataParade to keep editing the diagram.');
333
346
  }
334
347
  if (this.useClack) {
348
+ if (durationLine) {
349
+ this.prompts().log.info(durationLine);
350
+ }
335
351
  // Not a note(): it hard-wraps to the terminal width, which splits long
336
352
  // preview URLs and breaks click-to-open.
337
353
  this.prompts().log.step('What to do next');
@@ -339,6 +355,9 @@ class ScanProgressRenderer {
339
355
  this.prompts().outro(closing);
340
356
  }
341
357
  else {
358
+ if (durationLine) {
359
+ this.writePlain(durationLine);
360
+ }
342
361
  this.writePlain('What to do next');
343
362
  for (const line of nextSteps) {
344
363
  // Preserve ANSI on the link line when color is on; strip elsewhere.
@@ -5,6 +5,7 @@ export type ScanUploadFile = {
5
5
  };
6
6
  /**
7
7
  * The scan files to upload after dataflow.json: facts.json, every data-items/*.json,
8
- * graphify.json, and answers.json. A file that is missing or is not a JSON object is left out.
8
+ * graphify.json, answers.json and threat-model.json (DATAP-922). A file that is missing or is not
9
+ * a JSON object is left out. threat-model.unreadable.json is never sent.
9
10
  */
10
11
  export declare function collectScanUploadFiles(dataflowFilePath: string): ScanUploadFile[];
@@ -26,7 +26,8 @@ function isJsonObject(text) {
26
26
  }
27
27
  /**
28
28
  * The scan files to upload after dataflow.json: facts.json, every data-items/*.json,
29
- * graphify.json, and answers.json. A file that is missing or is not a JSON object is left out.
29
+ * graphify.json, answers.json and threat-model.json (DATAP-922). A file that is missing or is not
30
+ * a JSON object is left out. threat-model.unreadable.json is never sent.
30
31
  */
31
32
  function collectScanUploadFiles(dataflowFilePath) {
32
33
  const layout = (0, layout_1.layoutForDir)(path_1.default.dirname(path_1.default.resolve(dataflowFilePath)));
@@ -53,5 +54,6 @@ function collectScanUploadFiles(dataflowFilePath) {
53
54
  }
54
55
  add(layout_1.GRAPHIFY_BASENAME, layout.graphifyPath);
55
56
  add(layout_1.ANSWERS_BASENAME, layout.answersPath);
57
+ add(layout_1.THREAT_MODEL_BASENAME, layout.threatModelPath);
56
58
  return files;
57
59
  }
@@ -59,7 +59,7 @@ describe('CLI', () => {
59
59
  // The default folder holds Facts, one file per data item, and nothing from older versions.
60
60
  const outputDir = path_1.default.join(cliCwd, '.dataparade');
61
61
  const names = (0, fs_1.readdirSync)(outputDir).sort();
62
- expect(names).toEqual(expect.arrayContaining(['dataflow.json', 'facts.json']));
62
+ expect(names).toEqual(expect.arrayContaining(['dataflow.json', 'facts.json', 'threat-model.json']));
63
63
  for (const legacy of [
64
64
  'dataparade.json',
65
65
  'dataparade-graph.json',
@@ -73,6 +73,15 @@ describe('CLI', () => {
73
73
  expect(facts.schemaVersion).toBe(1);
74
74
  expect(facts.components.length).toBeGreaterThan(0);
75
75
  expect(JSON.stringify(facts)).not.toContain(cliCwd);
76
+ const threatModelText = (0, fs_1.readFileSync)(path_1.default.join(outputDir, 'threat-model.json'), 'utf8');
77
+ const threatModel = JSON.parse(threatModelText);
78
+ expect(threatModel.schemaVersion).toBe(1);
79
+ expect(threatModel.threats.length).toBeGreaterThan(0);
80
+ expect(threatModel.scan.scannedAt).toBe(facts.scan.scannedAt);
81
+ expect(threatModelText).not.toContain(cliCwd);
82
+ for (const element of [...facts.components, ...facts.dataFlows]) {
83
+ expect(element).not.toHaveProperty('threats');
84
+ }
76
85
  });
77
86
  it('scan fixture produces a dataflow.json wrapper with at least one node', () => {
78
87
  const result = (0, child_process_1.spawnSync)('node', [
@@ -13,29 +13,29 @@ const layout_1 = require("../../src/facts/layout");
13
13
  /** A small scan: an API, Sendgrid, a customer, two flows, and an email data item with two groups. */
14
14
  function sampleFacts() {
15
15
  const groups = [
16
- { id: "group:email:customer", label: "customer", basis: "column", occurrenceCount: 2, handledBy: ["cmp_api"] },
17
- { id: "group:email:staff", label: "staff", basis: "name", occurrenceCount: 1, handledBy: ["cmp_api", "cmp_mail"] },
16
+ { id: "group:pd:EmailAddress:customer", label: "customer", basis: "column", occurrenceCount: 2, handledBy: ["cmp_api"] },
17
+ { id: "group:pd:EmailAddress:staff", label: "staff", basis: "name", occurrenceCount: 1, handledBy: ["cmp_api", "cmp_mail"] },
18
18
  ];
19
19
  const emailFile = {
20
20
  schemaVersion: 1,
21
- id: "data_item:email",
22
- name: "email",
23
- labels: ["contact"],
21
+ id: "data_item:pd:EmailAddress",
22
+ name: "pd:EmailAddress",
23
+ labels: ["pd:EmailAddress"],
24
24
  groups,
25
25
  occurrences: [
26
- { id: "occurrence:email:src/a.ts:3", groupId: "group:email:customer", filePath: "src/a.ts", startLine: 3, endLine: 3, code: "email", labels: ["contact"], codeRefs: [] },
27
- { id: "occurrence:email:src/b.ts:9", groupId: "group:email:customer", filePath: "src/b.ts", startLine: 9, endLine: 9, labels: ["contact"], codeRefs: [] },
28
- { id: "occurrence:email:src/c.ts:1", groupId: "group:email:staff", filePath: "src/c.ts", startLine: 1, endLine: 1, labels: [], codeRefs: [] },
26
+ { id: "occurrence:pd:EmailAddress:src/a.ts:3", groupId: "group:pd:EmailAddress:customer", filePath: "src/a.ts", startLine: 3, endLine: 3, code: "email", labels: ["pd:EmailAddress"], codeRefs: [] },
27
+ { id: "occurrence:pd:EmailAddress:src/b.ts:9", groupId: "group:pd:EmailAddress:customer", filePath: "src/b.ts", startLine: 9, endLine: 9, labels: ["pd:EmailAddress"], codeRefs: [] },
28
+ { id: "occurrence:pd:EmailAddress:src/c.ts:1", groupId: "group:pd:EmailAddress:staff", filePath: "src/c.ts", startLine: 1, endLine: 1, labels: [], codeRefs: [] },
29
29
  ],
30
30
  };
31
31
  const phoneFile = {
32
32
  schemaVersion: 1,
33
- id: "data_item:phone",
34
- name: "phone",
33
+ id: "data_item:pd:TelephoneNumber",
34
+ name: "pd:TelephoneNumber",
35
35
  labels: [],
36
- groups: [{ id: "group:phone:customer", label: "customer", occurrenceCount: 1, handledBy: ["cmp_api"] }],
36
+ groups: [{ id: "group:pd:TelephoneNumber:customer", label: "customer", occurrenceCount: 1, handledBy: ["cmp_api"] }],
37
37
  occurrences: [
38
- { id: "occurrence:phone:src/a.ts:7", groupId: "group:phone:customer", filePath: "src/a.ts", startLine: 7, endLine: 7, labels: [], codeRefs: [] },
38
+ { id: "occurrence:pd:TelephoneNumber:src/a.ts:7", groupId: "group:pd:TelephoneNumber:customer", filePath: "src/a.ts", startLine: 7, endLine: 7, labels: [], codeRefs: [] },
39
39
  ],
40
40
  };
41
41
  const facts = {
@@ -51,13 +51,13 @@ function sampleFacts() {
51
51
  { id: "flow_login", sourceComponentId: "cmp_user", targetComponentId: "cmp_api", type: "api_call", confidence: 0.9, sourceLocations: [], codeRefs: [] },
52
52
  ],
53
53
  dataItems: [
54
- { id: "data_item:email", name: "email", labels: ["contact"], occurrenceCount: 3, file: "data-items/email.json", groups },
55
- { id: "data_item:phone", name: "phone", labels: [], occurrenceCount: 1, file: "data-items/phone.json", groups: phoneFile.groups },
54
+ { id: "data_item:pd:EmailAddress", name: "pd:EmailAddress", labels: ["pd:EmailAddress"], occurrenceCount: 3, file: "data-items/pd-emailaddress.json", groups },
55
+ { id: "data_item:pd:TelephoneNumber", name: "pd:TelephoneNumber", labels: [], occurrenceCount: 1, file: "data-items/pd-telephonenumber.json", groups: phoneFile.groups },
56
56
  ],
57
57
  relations: [
58
58
  { type: "sends", source: "cmp_api", target: "flow_mail", confidence: "EXTRACTED", basis: null },
59
59
  { type: "delivers_to", source: "flow_mail", target: "cmp_mail", confidence: "EXTRACTED", basis: null },
60
- { type: "handled_by", source: "group:email:staff", target: "cmp_mail", confidence: "INFERRED", basis: "same_file" },
60
+ { type: "handled_by", source: "group:pd:EmailAddress:staff", target: "cmp_mail", confidence: "INFERRED", basis: "same_file" },
61
61
  ],
62
62
  };
63
63
  return { facts, files: [emailFile, phoneFile] };
@@ -66,7 +66,7 @@ function sampleFacts() {
66
66
  function makeKbDir() {
67
67
  const layout = (0, layout_1.layoutForDir)(fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "dp-kb-")));
68
68
  const { facts, files } = sampleFacts();
69
- (0, io_1.writeFactsOutput)(layout, facts, new Map(files.map((file) => [`data-items/${file.name}.json`, file])));
69
+ (0, io_1.writeFactsOutput)(layout, facts, new Map(files.map((file) => [facts.dataItems.find((item) => item.id === file.id).file, file])));
70
70
  fs_1.default.writeFileSync(layout.dataflowPath, JSON.stringify({ schemaVersion: "1.0", graph: { nodes: [], edges: [] }, metadata: { projectName: "demo" } }));
71
71
  return layout;
72
72
  }
@@ -148,7 +148,7 @@ describe("scanResultSchema", () => {
148
148
  dataShared: [
149
149
  {
150
150
  category: "credentials",
151
- labels: ["user_email", "user_password"],
151
+ labels: ["pd:EmailAddress", "pd:Password"],
152
152
  },
153
153
  ],
154
154
  confidence: 0.89,
@@ -235,7 +235,7 @@ describe("strictParseAndNormalizeProposals / propertyEvidence", () => {
235
235
  });
236
236
  expect(out).toHaveLength(1);
237
237
  if (out[0]?.kind === "component_patch") {
238
- expect(out[0].setProperties.data_categories_received).toEqual(["other"]);
238
+ expect(out[0].setProperties.data_categories_received).toEqual(["dpv:UncategorisedData"]);
239
239
  expect(out[0].setProperties.processing_purpose).toEqual(["service_provision"]);
240
240
  expect(out[0].setProperties.cloud_provider).toBe("AWS");
241
241
  expect(out[0].propertyEvidence?.cloud_provider).toHaveLength(1);
@@ -433,8 +433,8 @@ describe("buildThirdPartyDataFlowSummary", () => {
433
433
  const entry = summary.entries[0];
434
434
  expect(entry).toBeDefined();
435
435
  const labels = entry?.dataShared.map((x) => x.labels).flat() ?? [];
436
- expect(labels).toContain("first_name");
437
- expect(labels).toContain("last_name");
436
+ expect(labels).toContain("dpx:FirstName");
437
+ expect(labels).toContain("dpx:LastName");
438
438
  });
439
439
  it("does not detect passport_number from Passport auth framework names", () => {
440
440
  const summary = (0, third_party_data_flow_1.buildThirdPartyDataFlowSummary)({
@@ -515,7 +515,7 @@ describe("buildThirdPartyDataFlowSummary", () => {
515
515
  const entry = summary.entries[0];
516
516
  expect(entry).toBeDefined();
517
517
  const labels = entry?.dataShared.map((x) => x.labels).flat() ?? [];
518
- expect(labels).not.toContain("address");
518
+ expect(labels).not.toContain("pd:PhysicalAddress");
519
519
  });
520
520
  it("does not classify OAuth state parameter as profile address", () => {
521
521
  const summary = (0, third_party_data_flow_1.buildThirdPartyDataFlowSummary)({
@@ -555,7 +555,7 @@ describe("buildThirdPartyDataFlowSummary", () => {
555
555
  const entry = summary.entries[0];
556
556
  expect(entry).toBeDefined();
557
557
  const labels = entry?.dataShared.map((x) => x.labels).flat() ?? [];
558
- expect(labels).not.toContain("address");
558
+ expect(labels).not.toContain("pd:PhysicalAddress");
559
559
  });
560
560
  it("derives dataShared from provider evidence reasons when scan signals are missing", () => {
561
561
  const summary = (0, third_party_data_flow_1.buildThirdPartyDataFlowSummary)({
@@ -671,7 +671,7 @@ describe("buildThirdPartyDataFlowSummary", () => {
671
671
  const entry = summary.entries[0];
672
672
  expect(entry).toBeDefined();
673
673
  const labels = entry?.dataShared.map((x) => x.labels).flat() ?? [];
674
- expect(labels).not.toContain("address");
674
+ expect(labels).not.toContain("pd:PhysicalAddress");
675
675
  });
676
676
  it("attributes shared prompt assembly to all AI providers in the same handler file", () => {
677
677
  const handlerPath = "app/api/assistant/route.ts";
@@ -82,7 +82,7 @@ describe("core/pipeline/graph-mapping - DP-P0-CLI-402", () => {
82
82
  },
83
83
  method: "GET",
84
84
  endpoint: "/health",
85
- dataCategories: ["personal_identifiers"],
85
+ dataCategories: ["pd:EmailAddress"],
86
86
  dataSubjectCategories: ["customers"],
87
87
  processingPurpose: ["service_provision"],
88
88
  actions: ["read"],
@@ -131,11 +131,12 @@ describe("core/pipeline/graph-mapping - DP-P0-CLI-402", () => {
131
131
  return;
132
132
  const properties = edge.data.properties;
133
133
  expect(properties.engineering.transferType).toBe("api_call");
134
- expect(properties.engineering.protocol).toBe("rest");
134
+ // A method and endpoint alone no longer set a protocol (scanner DATAP-937).
135
+ expect(properties.engineering.protocol).toBeUndefined();
135
136
  expect(properties.engineering.name).toContain("Test Application");
136
137
  expect(properties.engineering.actions).toEqual(["read"]);
137
138
  expect(properties.privacy.dataCategories).toEqual([
138
- "personal_identifiers",
139
+ "pd:EmailAddress",
139
140
  ]);
140
141
  expect(properties.privacy.dataSubjectCategories).toEqual(["customers"]);
141
142
  expect(properties.privacy.processingPurpose).toEqual([
@@ -13,18 +13,18 @@ describe("OCSF discovery files for long ids", () => {
13
13
  it("keeps file names under the filesystem limit and loads every record back", () => {
14
14
  const scanPath = `/Users/someone/${"deeply-nested-checkout/".repeat(8)}repo`;
15
15
  const occurrence = {
16
- id: `occurrence:phone_number:${"app/actions/contact/".repeat(4)}identify_action.rb:13`,
16
+ id: `occurrence:pd:TelephoneNumber:${"app/actions/contact/".repeat(4)}identify_action.rb:13`,
17
17
  filePath: "app/actions/contact/identify_action.rb",
18
18
  startLine: 13,
19
19
  endLine: 13,
20
- labels: ["phone_number"],
20
+ labels: ["pd:TelephoneNumber"],
21
21
  };
22
22
  const records = (0, scan_discovery_to_ocsf_1.landScanDiscoveryToOcsfRecords)({
23
23
  scanPath,
24
24
  components: [],
25
25
  dataFlows: [],
26
26
  occurrences: [occurrence],
27
- dataItems: [{ id: "data_item:phone_number", occurrenceIds: [occurrence.id], labels: ["phone_number"] }],
27
+ dataItems: [{ id: "data_item:pd:TelephoneNumber", occurrenceIds: [occurrence.id], labels: ["pd:TelephoneNumber"] }],
28
28
  }, { assertedAt: "2026-10-05T00:00:00.000Z" });
29
29
  const dir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "dp-ocsf-long-"));
30
30
  try {
@@ -30,19 +30,19 @@ describe("export ocsf", () => {
30
30
  const { records } = (0, load_ocsf_discoveries_1.loadOcsfDiscoveriesFromDir)(out);
31
31
  expect(records).toHaveLength(result.records);
32
32
  expect(slot(records, "name").sort()).toEqual(["Customer", "Sendgrid", "backend"]);
33
- expect(records.some((r) => r.dataparade.asserts === "dp:scan/entity/occurrence:email:src/a.ts:3")).toBe(true);
34
- expect(records.some((r) => r.dataparade.asserts === "dp:scan/entity/data_item:email")).toBe(true);
33
+ expect(records.some((r) => r.dataparade.asserts === "dp:scan/entity/occurrence:pd:EmailAddress:src/a.ts:3")).toBe(true);
34
+ expect(records.some((r) => r.dataparade.asserts === "dp:scan/entity/data_item:pd:EmailAddress")).toBe(true);
35
35
  expect(JSON.stringify(records)).not.toContain("/Users/");
36
36
  });
37
37
  it("exports the applied state: overrides in, removed Facts out", () => {
38
38
  (0, land_1.landReviewAnswer)(paths, { target: "cmp_mail", action: "set", property: "name", value: "SendGrid Inc", reviewer: "dev@example.com" });
39
- (0, land_1.landReviewAnswer)(paths, { target: "data_item:phone", action: "remove", reviewer: "dev@example.com" });
39
+ (0, land_1.landReviewAnswer)(paths, { target: "data_item:pd:TelephoneNumber", action: "remove", reviewer: "dev@example.com" });
40
40
  (0, export_ocsf_1.exportOcsf)(paths, out);
41
41
  const { records } = (0, load_ocsf_discoveries_1.loadOcsfDiscoveriesFromDir)(out);
42
42
  expect(slot(records, "name")).toContain("SendGrid Inc");
43
43
  expect(slot(records, "name")).not.toContain("Sendgrid");
44
44
  const asserted = records.map((r) => r.dataparade.asserts);
45
- expect(asserted.some((a) => a.includes("phone"))).toBe(false);
45
+ expect(asserted.some((a) => a.includes("pd:TelephoneNumber"))).toBe(false);
46
46
  });
47
47
  it("exports interview answers as interview records that supersede the earlier answer", () => {
48
48
  fs_1.default.mkdirSync(paths.evidenceDir, { recursive: true });