@dataparade/cli 0.1.0 → 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.
- package/dist/package.json +1 -1
- package/dist/src/ai-enrichment/provider-prompt.js +1 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +2 -44
- package/dist/src/discoveries/contract/ocsf-discovery-record.d.ts +4 -1
- package/dist/src/discoveries/contract/ocsf-discovery-record.js +1 -1
- package/dist/src/discoveries/contract/ontology-pins.d.ts +6 -4
- package/dist/src/discoveries/contract/ontology-pins.js +7 -5
- package/dist/src/facts/build-facts.js +4 -0
- package/dist/src/facts/schema.d.ts +104 -0
- package/dist/src/facts/schema.js +5 -0
- package/dist/src/kb/data-category-catalog.generated.d.ts +34 -0
- package/dist/src/kb/data-category-catalog.generated.js +962 -0
- package/dist/src/kb/kb-store.js +4 -1
- package/dist/src/kb/migrate.js +4 -2
- package/dist/src/kb/slot-shapes.d.ts +3 -2
- package/dist/src/kb/slot-shapes.js +13 -8
- package/dist/src/kb/taxonomy.d.ts +12 -6
- package/dist/src/kb/taxonomy.js +13 -18
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +1 -1
- package/dist/tests/unit/facts/build-facts.spec.js +17 -0
- package/dist/tests/unit/kb/data-category-catalog.spec.d.ts +1 -0
- package/dist/tests/unit/kb/data-category-catalog.spec.js +65 -0
- package/dist/tests/unit/kb/kb-interview-loop.spec.js +5 -4
- package/dist/tests/unit/kb/migrate.spec.js +2 -2
- package/dist/tests/unit/threat-model/build-threat-model.spec.js +5 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -247,6 +247,7 @@ function buildProviderPromptPayload(input) {
|
|
|
247
247
|
'Propose `relay` only when cited code/config corroborates passthrough/proxy/gateway behavior; otherwise omit relay. ' +
|
|
248
248
|
'Cite `propertyEvidence.data_action` with filePath + line range + reason for every verb you assert. ' +
|
|
249
249
|
'Other multi-value fields such as `data_categories_received`, `supported_export_formats`, `cloud_services_used`, `regions_availability_zones` must be string arrays, not one comma-joined string. ' +
|
|
250
|
+
'`data_categories_received` values are W3C DPV data category concepts written as compact IRIs, such as `pd:EmailAddress`, `pd:Financial`, `pd:Authenticating` or `dpv:NonPersonalData`; use `dpv:UncategorisedData` when none fits. ' +
|
|
250
251
|
'Booleans must be true/false (not strings). Prefer enum-like values in lowercase snake_case (e.g. integration_status: "active"). ' +
|
|
251
252
|
'For any field that corresponds to an app dropdown or multi-select, use the product\'s option tokens (snake_case / exact strings) — e.g. legal_basis: "contractual_necessity" not "contract"; pci_scope: "saq_d" not "full"; data_transfer_mechanism: "standard_contractual_clauses" not raw "HTTPS"; risk_rating and encrypt_at_rest must match allowed values.';
|
|
252
253
|
const groundedInstructions = "Walk every key in sparsePropertyKeys and emit every key you can **ground in code/config text**. You may output multiple component_patch proposals for one target when each patch has a different, disjoint key set. Use propertiesSet as truth for fields already set and never rewrite those values. For every key in setProperties, **propertyEvidence[key]** must be a non-empty array citing filePath + startLine/endLine + reason where that key's value appears in relevantFileContents (when provided) or in the file paths listed on that component in detectedFrom/sourceLocations. If you cannot tie a property to cited text or a cited path, **omit that key**. Indirect guesses are not allowed. It is valid to return **no proposals** only when no sparse key can be cited. Never invent URLs, vendor names, analytics products, retention numbers, or compliance labels without a literal basis in the excerpts or cited lines. `targetComponentId` must be exactly one of canonicalComponentIds (componentContext keys). ";
|
|
@@ -5,6 +5,7 @@ exports.buildProposalsValidationContext = buildProposalsValidationContext;
|
|
|
5
5
|
exports.parseAgentFromPrompt = parseAgentFromPrompt;
|
|
6
6
|
exports.aiDebugEnabled = aiDebugEnabled;
|
|
7
7
|
exports.strictParseAndNormalizeProposals = strictParseAndNormalizeProposals;
|
|
8
|
+
const data_category_catalog_generated_1 = require("../../kb/data-category-catalog.generated");
|
|
8
9
|
const scanner_1 = require("../../../vendor/scanner/dist/src/index.js");
|
|
9
10
|
const openai_proposals_response_schema_1 = require("../openai-proposals-response.schema");
|
|
10
11
|
const scan_paths_1 = require("../scan-paths");
|
|
@@ -195,49 +196,6 @@ function sanitizeSetProperties(raw) {
|
|
|
195
196
|
}
|
|
196
197
|
return sanitized;
|
|
197
198
|
}
|
|
198
|
-
const UI_DATA_CATEGORY_ALLOWED = new Set([
|
|
199
|
-
"personal_identifiers",
|
|
200
|
-
"contact_information",
|
|
201
|
-
"financial_information",
|
|
202
|
-
"health_data",
|
|
203
|
-
"biometric_data",
|
|
204
|
-
"location_data",
|
|
205
|
-
"behavioral_data",
|
|
206
|
-
"employment_data",
|
|
207
|
-
"education_data",
|
|
208
|
-
"special_category_data",
|
|
209
|
-
"criminal_records",
|
|
210
|
-
"demographic_data",
|
|
211
|
-
"online_identifiers",
|
|
212
|
-
"device_identifiers",
|
|
213
|
-
"usage_data",
|
|
214
|
-
"aggregated_analytics",
|
|
215
|
-
"financial_data",
|
|
216
|
-
"geolocation_gps",
|
|
217
|
-
"geolocation_ip",
|
|
218
|
-
"photos_selfies",
|
|
219
|
-
"professional_data",
|
|
220
|
-
"sensitive_personal_data",
|
|
221
|
-
"special_categories",
|
|
222
|
-
"user_identity_direct",
|
|
223
|
-
"user_identity_indirect",
|
|
224
|
-
"other",
|
|
225
|
-
]);
|
|
226
|
-
const UI_DATA_CATEGORY_ALIASES = {
|
|
227
|
-
personal_data: "user_identity_direct",
|
|
228
|
-
pii: "user_identity_direct",
|
|
229
|
-
personally_identifiable_information: "user_identity_direct",
|
|
230
|
-
document_files: "other",
|
|
231
|
-
document_metadata: "other",
|
|
232
|
-
file_content: "other",
|
|
233
|
-
file_metadata: "other",
|
|
234
|
-
email_address: "contact_information",
|
|
235
|
-
credit_card_data: "financial_data",
|
|
236
|
-
payment_data: "financial_data",
|
|
237
|
-
phi: "health_data",
|
|
238
|
-
ip_address: "geolocation_ip",
|
|
239
|
-
device_id: "device_identifiers",
|
|
240
|
-
};
|
|
241
199
|
const UI_PROCESSING_PURPOSE_ALLOWED = new Set([
|
|
242
200
|
"authentication",
|
|
243
201
|
"service_provision",
|
|
@@ -375,7 +333,7 @@ function normalizeThirdPartySetPropertiesForUi(input) {
|
|
|
375
333
|
const evidenceSourceByKey = {};
|
|
376
334
|
if (Object.prototype.hasOwnProperty.call(normalized, "data_categories_received")) {
|
|
377
335
|
const values = toStringArray(normalized.data_categories_received);
|
|
378
|
-
const mapped =
|
|
336
|
+
const mapped = (0, data_category_catalog_generated_1.resolveDataCategoryValues)(values);
|
|
379
337
|
if (mapped.length > 0)
|
|
380
338
|
normalized.data_categories_received = mapped;
|
|
381
339
|
else
|
|
@@ -28,7 +28,10 @@ export declare const ocsfDiscoveryRecordSchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strip>>>;
|
|
29
29
|
dataparade: z.ZodObject<{
|
|
30
30
|
record_kind: z.ZodLiteral<"discovery">;
|
|
31
|
-
ontology_version: z.
|
|
31
|
+
ontology_version: z.ZodEnum<{
|
|
32
|
+
"0.4.0": "0.4.0";
|
|
33
|
+
"0.3.0": "0.3.0";
|
|
34
|
+
}>;
|
|
32
35
|
source: z.ZodEnum<{
|
|
33
36
|
scan: "scan";
|
|
34
37
|
interview: "interview";
|
|
@@ -14,7 +14,7 @@ const fullShaSchema = zod_1.z.string().regex(/^[0-9a-f]{40}$/, "must be a full 4
|
|
|
14
14
|
const dataparadePayloadSchema = zod_1.z
|
|
15
15
|
.object({
|
|
16
16
|
record_kind: zod_1.z.literal("discovery"),
|
|
17
|
-
ontology_version: zod_1.z.
|
|
17
|
+
ontology_version: zod_1.z.enum(ontology_pins_1.READABLE_ONTOLOGY_VERSIONS),
|
|
18
18
|
source: zod_1.z.enum(["scan", "cloud", "interview"]),
|
|
19
19
|
asserted_at: zod_1.z.string().datetime(),
|
|
20
20
|
asserts: zod_1.z.string().min(1),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/** Ontology pin: DataParade-io/ontology v0.
|
|
2
|
-
export declare const PINNED_ONTOLOGY_VERSION = "0.
|
|
3
|
-
export declare const PINNED_ONTOLOGY_TAG = "v0.
|
|
4
|
-
export declare const PINNED_ONTOLOGY_SHA = "
|
|
1
|
+
/** Ontology pin: DataParade-io/ontology v0.4.0 (DataCategory as W3C DPV concepts, DATAP-961; OCSF Architecture Discovery extension since 0.3.0, DATAP-696). */
|
|
2
|
+
export declare const PINNED_ONTOLOGY_VERSION = "0.4.0";
|
|
3
|
+
export declare const PINNED_ONTOLOGY_TAG = "v0.4.0";
|
|
4
|
+
export declare const PINNED_ONTOLOGY_SHA = "5b13b7224c8ea6e53a1b3e90ce14140db040530e";
|
|
5
|
+
/** Ontology versions whose Discovery records still load, so older KB folders can be read and migrated. */
|
|
6
|
+
export declare const READABLE_ONTOLOGY_VERSIONS: readonly ["0.3.0", "0.4.0"];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PINNED_ONTOLOGY_SHA = exports.PINNED_ONTOLOGY_TAG = exports.PINNED_ONTOLOGY_VERSION = void 0;
|
|
4
|
-
/** Ontology pin: DataParade-io/ontology v0.
|
|
5
|
-
exports.PINNED_ONTOLOGY_VERSION = "0.
|
|
6
|
-
exports.PINNED_ONTOLOGY_TAG = "v0.
|
|
7
|
-
exports.PINNED_ONTOLOGY_SHA = "
|
|
3
|
+
exports.READABLE_ONTOLOGY_VERSIONS = exports.PINNED_ONTOLOGY_SHA = exports.PINNED_ONTOLOGY_TAG = exports.PINNED_ONTOLOGY_VERSION = void 0;
|
|
4
|
+
/** Ontology pin: DataParade-io/ontology v0.4.0 (DataCategory as W3C DPV concepts, DATAP-961; OCSF Architecture Discovery extension since 0.3.0, DATAP-696). */
|
|
5
|
+
exports.PINNED_ONTOLOGY_VERSION = "0.4.0";
|
|
6
|
+
exports.PINNED_ONTOLOGY_TAG = "v0.4.0";
|
|
7
|
+
exports.PINNED_ONTOLOGY_SHA = "5b13b7224c8ea6e53a1b3e90ce14140db040530e";
|
|
8
|
+
/** Ontology versions whose Discovery records still load, so older KB folders can be read and migrated. */
|
|
9
|
+
exports.READABLE_ONTOLOGY_VERSIONS = ["0.3.0", exports.PINNED_ONTOLOGY_VERSION];
|
|
@@ -116,6 +116,10 @@ function buildFacts(input) {
|
|
|
116
116
|
type: f.type,
|
|
117
117
|
...(f.targetScope !== undefined ? { targetScope: f.targetScope } : {}),
|
|
118
118
|
...(f.dataCategories !== undefined ? { dataCategories: [...f.dataCategories].sort() } : {}),
|
|
119
|
+
...(f.relationship !== undefined ? { relationship: f.relationship } : {}),
|
|
120
|
+
...(f.protocol !== undefined ? { protocol: f.protocol } : {}),
|
|
121
|
+
...(f.transport !== undefined ? { transport: f.transport } : {}),
|
|
122
|
+
...(f.channel !== undefined ? { channel: f.channel } : {}),
|
|
119
123
|
confidence: f.confidence,
|
|
120
124
|
sourceLocations: locations(f.sourceLocations ?? (f.sourceLocation ? [f.sourceLocation] : [])),
|
|
121
125
|
codeRefs: refsFor(scrub(f.id)),
|
|
@@ -154,6 +154,58 @@ export declare const dataFlowFactSchema: z.ZodObject<{
|
|
|
154
154
|
filePath: z.ZodString;
|
|
155
155
|
line: z.ZodNumber;
|
|
156
156
|
}, z.core.$strip>>>;
|
|
157
|
+
relationship: z.ZodOptional<z.ZodEnum<{
|
|
158
|
+
invokes: "invokes";
|
|
159
|
+
queries: "queries";
|
|
160
|
+
publishes: "publishes";
|
|
161
|
+
consumes: "consumes";
|
|
162
|
+
interacts: "interacts";
|
|
163
|
+
authenticates_via: "authenticates_via";
|
|
164
|
+
exposes: "exposes";
|
|
165
|
+
uses_in_process: "uses_in_process";
|
|
166
|
+
depends_on: "depends_on";
|
|
167
|
+
provisions: "provisions";
|
|
168
|
+
}>>;
|
|
169
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
unknown: "unknown";
|
|
171
|
+
sql: "sql";
|
|
172
|
+
redis: "redis";
|
|
173
|
+
rest: "rest";
|
|
174
|
+
graphql: "graphql";
|
|
175
|
+
grpc: "grpc";
|
|
176
|
+
soap: "soap";
|
|
177
|
+
json_rpc: "json_rpc";
|
|
178
|
+
mcp: "mcp";
|
|
179
|
+
mongodb_wire: "mongodb_wire";
|
|
180
|
+
kafka: "kafka";
|
|
181
|
+
amqp: "amqp";
|
|
182
|
+
mqtt: "mqtt";
|
|
183
|
+
smtp: "smtp";
|
|
184
|
+
oauth_oidc: "oauth_oidc";
|
|
185
|
+
otlp: "otlp";
|
|
186
|
+
vendor_sdk: "vendor_sdk";
|
|
187
|
+
}>>;
|
|
188
|
+
transport: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
unknown: "unknown";
|
|
190
|
+
https: "https";
|
|
191
|
+
http: "http";
|
|
192
|
+
websocket: "websocket";
|
|
193
|
+
http2: "http2";
|
|
194
|
+
tcp_tls: "tcp_tls";
|
|
195
|
+
tcp: "tcp";
|
|
196
|
+
stdio: "stdio";
|
|
197
|
+
in_process: "in_process";
|
|
198
|
+
}>>;
|
|
199
|
+
channel: z.ZodOptional<z.ZodEnum<{
|
|
200
|
+
unknown: "unknown";
|
|
201
|
+
mcp: "mcp";
|
|
202
|
+
web_gui: "web_gui";
|
|
203
|
+
mobile_app: "mobile_app";
|
|
204
|
+
desktop_app: "desktop_app";
|
|
205
|
+
cli: "cli";
|
|
206
|
+
api_direct: "api_direct";
|
|
207
|
+
email: "email";
|
|
208
|
+
}>>;
|
|
157
209
|
}, z.core.$strip>;
|
|
158
210
|
export declare const dataItemGroupSchema: z.ZodObject<{
|
|
159
211
|
id: z.ZodString;
|
|
@@ -340,6 +392,58 @@ export declare const factsFileSchema: z.ZodObject<{
|
|
|
340
392
|
filePath: z.ZodString;
|
|
341
393
|
line: z.ZodNumber;
|
|
342
394
|
}, z.core.$strip>>>;
|
|
395
|
+
relationship: z.ZodOptional<z.ZodEnum<{
|
|
396
|
+
invokes: "invokes";
|
|
397
|
+
queries: "queries";
|
|
398
|
+
publishes: "publishes";
|
|
399
|
+
consumes: "consumes";
|
|
400
|
+
interacts: "interacts";
|
|
401
|
+
authenticates_via: "authenticates_via";
|
|
402
|
+
exposes: "exposes";
|
|
403
|
+
uses_in_process: "uses_in_process";
|
|
404
|
+
depends_on: "depends_on";
|
|
405
|
+
provisions: "provisions";
|
|
406
|
+
}>>;
|
|
407
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
408
|
+
unknown: "unknown";
|
|
409
|
+
sql: "sql";
|
|
410
|
+
redis: "redis";
|
|
411
|
+
rest: "rest";
|
|
412
|
+
graphql: "graphql";
|
|
413
|
+
grpc: "grpc";
|
|
414
|
+
soap: "soap";
|
|
415
|
+
json_rpc: "json_rpc";
|
|
416
|
+
mcp: "mcp";
|
|
417
|
+
mongodb_wire: "mongodb_wire";
|
|
418
|
+
kafka: "kafka";
|
|
419
|
+
amqp: "amqp";
|
|
420
|
+
mqtt: "mqtt";
|
|
421
|
+
smtp: "smtp";
|
|
422
|
+
oauth_oidc: "oauth_oidc";
|
|
423
|
+
otlp: "otlp";
|
|
424
|
+
vendor_sdk: "vendor_sdk";
|
|
425
|
+
}>>;
|
|
426
|
+
transport: z.ZodOptional<z.ZodEnum<{
|
|
427
|
+
unknown: "unknown";
|
|
428
|
+
https: "https";
|
|
429
|
+
http: "http";
|
|
430
|
+
websocket: "websocket";
|
|
431
|
+
http2: "http2";
|
|
432
|
+
tcp_tls: "tcp_tls";
|
|
433
|
+
tcp: "tcp";
|
|
434
|
+
stdio: "stdio";
|
|
435
|
+
in_process: "in_process";
|
|
436
|
+
}>>;
|
|
437
|
+
channel: z.ZodOptional<z.ZodEnum<{
|
|
438
|
+
unknown: "unknown";
|
|
439
|
+
mcp: "mcp";
|
|
440
|
+
web_gui: "web_gui";
|
|
441
|
+
mobile_app: "mobile_app";
|
|
442
|
+
desktop_app: "desktop_app";
|
|
443
|
+
cli: "cli";
|
|
444
|
+
api_direct: "api_direct";
|
|
445
|
+
email: "email";
|
|
446
|
+
}>>;
|
|
343
447
|
}, z.core.$strip>>;
|
|
344
448
|
dataItems: z.ZodArray<z.ZodObject<{
|
|
345
449
|
id: z.ZodString;
|
package/dist/src/facts/schema.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.answersFileSchema = exports.answerSchema = exports.dataItemFileSchema =
|
|
|
9
9
|
* See docs/cli/scan-output.md.
|
|
10
10
|
*/
|
|
11
11
|
const kb_compare_1 = require("../../vendor/kb-compare/dist/src/index.js");
|
|
12
|
+
const scanner_1 = require("../../vendor/scanner/dist/src/index.js");
|
|
12
13
|
const zod_1 = require("zod");
|
|
13
14
|
exports.SCHEMA_VERSION = 1;
|
|
14
15
|
exports.sourceLocationSchema = zod_1.z.object({
|
|
@@ -98,6 +99,10 @@ exports.dataFlowFactSchema = zod_1.z.object({
|
|
|
98
99
|
codeRefs: zod_1.z.array(exports.codeRefSchema),
|
|
99
100
|
authentication: exports.flowAuthenticationSchema.optional(),
|
|
100
101
|
controls: zod_1.z.array(exports.flowControlSchema).optional(),
|
|
102
|
+
relationship: zod_1.z.enum(scanner_1.FLOW_RELATIONSHIPS).optional(),
|
|
103
|
+
protocol: zod_1.z.enum(scanner_1.FLOW_PROTOCOLS).optional(),
|
|
104
|
+
transport: zod_1.z.enum(scanner_1.FLOW_TRANSPORTS).optional(),
|
|
105
|
+
channel: zod_1.z.enum(scanner_1.HUMAN_INTERACTION_CHANNELS).optional(),
|
|
101
106
|
});
|
|
102
107
|
exports.dataItemGroupSchema = zod_1.z.object({
|
|
103
108
|
id: zod_1.z.string(),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface DataCategoryConcept {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
iri: string;
|
|
5
|
+
parent: string | null;
|
|
6
|
+
group: string;
|
|
7
|
+
depth: number;
|
|
8
|
+
definition: string;
|
|
9
|
+
sensitive: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface DataCategoryGroup {
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const DATA_CATEGORY_DPV_VERSION = "2.3";
|
|
16
|
+
export declare const DATA_CATEGORY_SCANNER_TAXONOMY_VERSION = "2.0.0";
|
|
17
|
+
export declare const DATA_CATEGORY_NAMESPACES: Readonly<Record<string, string>>;
|
|
18
|
+
export declare const DATA_CATEGORY_GROUPS: readonly DataCategoryGroup[];
|
|
19
|
+
export declare const DATA_CATEGORY_CONCEPTS: readonly DataCategoryConcept[];
|
|
20
|
+
export declare const LEGACY_DATA_CATEGORY_VALUE_TO_CONCEPT: Readonly<Record<string, string>>;
|
|
21
|
+
export declare function findDataCategoryConcept(value: string): DataCategoryConcept | undefined;
|
|
22
|
+
export declare function isWellFormedDataCategoryConceptValue(value: string): boolean;
|
|
23
|
+
/** A catalog concept for a concept value (any letter case), a concept IRI or an older category value. */
|
|
24
|
+
export declare function resolveCatalogDataCategoryValue(raw: string): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Like resolveCatalogDataCategoryValue, but also keeps a well-formed dpv:, pd: or dpx: concept the
|
|
27
|
+
* catalog does not list yet, so a newer scanner's categories are shown rather than dropped.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveDataCategoryValue(raw: string): string | undefined;
|
|
30
|
+
export declare function resolveDataCategoryValues(rawValues: readonly string[]): string[];
|
|
31
|
+
/** The catalog label of a concept; any other value is humanized as written. */
|
|
32
|
+
export declare function dataCategoryLabel(value: string): string;
|
|
33
|
+
export declare function dataCategoryAncestorValues(value: string): string[];
|
|
34
|
+
export declare function isSensitiveDataCategory(value: string): boolean;
|