@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.
- package/README.md +1 -0
- package/dist/package.json +4 -4
- package/dist/src/ai-enrichment/pii-signal-rules.d.ts +5 -0
- package/dist/src/ai-enrichment/pii-signal-rules.js +2 -3
- package/dist/src/ai-enrichment/provider-prompt.js +1 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +2 -44
- package/dist/src/ai-enrichment/third-party-data-flow.js +5 -4
- package/dist/src/cli.js +9 -3
- 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.d.ts +2 -0
- package/dist/src/facts/build-facts.js +18 -0
- package/dist/src/facts/layout.d.ts +4 -0
- package/dist/src/facts/layout.js +5 -1
- package/dist/src/facts/scan-stamps.d.ts +7 -0
- package/dist/src/facts/scan-stamps.js +30 -0
- package/dist/src/facts/schema.d.ts +178 -0
- package/dist/src/facts/schema.js +37 -1
- 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/src/output/scan-output-excludes.js +2 -0
- package/dist/src/output/write-scan-knowledge.d.ts +5 -1
- package/dist/src/output/write-scan-knowledge.js +21 -0
- package/dist/src/threat-model/build-threat-model.d.ts +3 -0
- package/dist/src/threat-model/build-threat-model.js +71 -0
- package/dist/src/threat-model/carry-forward-person-set-statuses.d.ts +8 -0
- package/dist/src/threat-model/carry-forward-person-set-statuses.js +87 -0
- package/dist/src/threat-model/io.d.ts +19 -0
- package/dist/src/threat-model/io.js +63 -0
- package/dist/src/threat-model/schema.d.ts +214 -0
- package/dist/src/threat-model/schema.js +75 -0
- package/dist/src/ui/scan-progress-renderer.d.ts +8 -1
- package/dist/src/ui/scan-progress-renderer.js +20 -1
- package/dist/src/upload/collect-scan-sidecars.d.ts +2 -1
- package/dist/src/upload/collect-scan-sidecars.js +3 -1
- package/dist/tests/cli/cli.spec.js +10 -1
- package/dist/tests/helpers/facts-fixture.js +16 -16
- package/dist/tests/schema/scan-result.schema.spec.js +1 -1
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +1 -1
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +5 -5
- package/dist/tests/unit/core/graph-mapping.spec.js +4 -3
- package/dist/tests/unit/discoveries/write-ocsf-discoveries-long-ids.spec.js +3 -3
- package/dist/tests/unit/export/export-ocsf.spec.js +4 -4
- package/dist/tests/unit/facts/apply-answers.spec.js +20 -20
- package/dist/tests/unit/facts/build-facts.spec.js +143 -45
- package/dist/tests/unit/facts/identity.spec.js +13 -0
- package/dist/tests/unit/facts/scan-stamps.spec.js +32 -0
- package/dist/tests/unit/facts/slug.spec.js +2 -0
- package/dist/tests/unit/kb/answer-fingerprint.spec.js +9 -9
- 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 +8 -7
- package/dist/tests/unit/kb/migrate.spec.js +2 -2
- package/dist/tests/unit/output/scan-output-excludes.spec.js +1 -1
- package/dist/tests/unit/threat-model/build-threat-model.spec.d.ts +1 -0
- package/dist/tests/unit/threat-model/build-threat-model.spec.js +189 -0
- package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.d.ts +1 -0
- package/dist/tests/unit/threat-model/carry-forward-person-set-statuses.spec.js +163 -0
- package/dist/tests/unit/threat-model/io.spec.d.ts +1 -0
- package/dist/tests/unit/threat-model/io.spec.js +103 -0
- package/dist/tests/unit/threat-model/schema.spec.d.ts +1 -0
- package/dist/tests/unit/threat-model/schema.spec.js +42 -0
- package/dist/tests/unit/ui/scan-progress-renderer.spec.js +58 -0
- package/dist/tests/unit/upload/collect-scan-sidecars.spec.js +8 -5
- package/dist/vendor/scanner/dist/src/analyze/code-navigator.d.ts +1 -1
- package/dist/vendor/scanner/dist/src/analyze/code-navigator.js +4 -0
- package/dist/vendor/scanner/dist/src/analyze/column-catalog.d.ts +1 -1
- package/dist/vendor/scanner/dist/src/analyze/column-catalog.js +2 -2
- package/dist/vendor/scanner/dist/src/analyze/concept-profile.d.ts +2 -2
- package/dist/vendor/scanner/dist/src/analyze/concept-profile.js +5 -3
- package/dist/vendor/scanner/dist/src/core/pipeline/build-scan-personal-data-layers.js +1 -1
- package/dist/vendor/scanner/dist/src/core/pipeline/deterministic-scan.js +43 -0
- package/dist/vendor/scanner/dist/src/core/pipeline/graph-mapping.js +23 -2
- package/dist/vendor/scanner/dist/src/core/pipeline/mixed-app-terraform-scan.js +1 -0
- package/dist/vendor/scanner/dist/src/core/pipeline/orchestrator-result.d.ts +2 -2
- package/dist/vendor/scanner/dist/src/core/pipeline/terraform-minimal-services.js +1 -0
- package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.d.ts +160 -2
- package/dist/vendor/scanner/dist/src/core/schema/scan-result.schema.js +24 -0
- package/dist/vendor/scanner/dist/src/core/types/data-flow.d.ts +48 -0
- package/dist/vendor/scanner/dist/src/core/types/data-flow.js +53 -0
- package/dist/vendor/scanner/dist/src/data-flow/detect.js +1 -0
- package/dist/vendor/scanner/dist/src/data-flow/ensure-hub-linked-assets.js +1 -0
- package/dist/vendor/scanner/dist/src/data-flow/ensure-manifest-declared-flows.js +1 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.d.ts +30 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-authentication.js +277 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-builder.js +6 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-controls.d.ts +24 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-controls.js +238 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.d.ts +22 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-data-categories.js +69 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.d.ts +13 -0
- package/dist/vendor/scanner/dist/src/data-flow/flow-interaction-description.js +263 -0
- package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.d.ts +2 -1
- package/dist/vendor/scanner/dist/src/data-flow/hub-link-policy.js +3 -0
- package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.d.ts +37 -0
- package/dist/vendor/scanner/dist/src/data-flow/human-interaction-channels.js +483 -0
- package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.d.ts +3 -0
- package/dist/vendor/scanner/dist/src/data-flow/intra-component-lineage.js +12 -17
- package/dist/vendor/scanner/dist/src/data-flow/terraform-flows.js +5 -1
- package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.d.ts +5 -1
- package/dist/vendor/scanner/dist/src/data-flow/transformation-patterns.js +17 -37
- package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.d.ts +36 -5
- package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.js +53 -60
- package/dist/vendor/scanner/dist/src/eval/canonical/graph/endpoints.js +2 -9
- package/dist/vendor/scanner/dist/src/eval/canonical/scanner/personal-data.js +10 -7
- package/dist/vendor/scanner/dist/src/graph/build-dataparade-graph.js +3 -1
- package/dist/vendor/scanner/dist/src/index.d.ts +6 -0
- package/dist/vendor/scanner/dist/src/index.js +16 -1
- package/dist/vendor/scanner/dist/src/patterns/engine.js +1 -0
- package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.d.ts +1 -1
- package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.js +2 -2
- package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.d.ts +3 -3
- package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.js +12 -11
- package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.d.ts +44 -0
- package/dist/vendor/scanner/dist/src/pii-signals/personal-data-taxonomy.js +167 -0
- package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-aliases.js +43 -43
- package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.d.ts +12 -1
- package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-rules.js +28 -7
- package/dist/vendor/scanner/dist/src/pii-signals/signal-token.js +1 -1
- package/dist/vendor/scanner/dist/src/threats/stride.d.ts +98 -0
- package/dist/vendor/scanner/dist/src/threats/stride.js +179 -0
- package/dist/vendor/scanner/package.json +2 -2
- package/dist/vendor/scanner/patterns/concept-profiles.yaml +2 -2
- package/dist/vendor/scanner/patterns/flow-authentication.rules.yaml +75 -0
- package/dist/vendor/scanner/patterns/flow-controls.rules.yaml +68 -0
- package/dist/vendor/scanner/patterns/personal-data-taxonomy.yaml +155 -0
- package/dist/vendor/scanner/patterns/pii-signals.rules.yaml +38 -49
- package/dist/vendor/scanner/patterns/stride.rules.yaml +86 -0
- package/package.json +4 -4
- package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.d.ts +0 -17
- package/dist/vendor/scanner/dist/src/eval/canonical/concept-map.validate.js +0 -108
- package/dist/vendor/scanner/patterns/personal-data-concept-map.yaml +0 -76
|
@@ -50,6 +50,7 @@ jest.mock('@clack/prompts', () => {
|
|
|
50
50
|
message: jest.fn(),
|
|
51
51
|
success: jest.fn(),
|
|
52
52
|
step: jest.fn(),
|
|
53
|
+
info: jest.fn(),
|
|
53
54
|
warn: jest.fn(),
|
|
54
55
|
error: jest.fn(),
|
|
55
56
|
},
|
|
@@ -163,6 +164,63 @@ describe('ScanProgressRenderer', () => {
|
|
|
163
164
|
// No underline (SGR 4): it reads as broken next to the terminal's own link styling.
|
|
164
165
|
expect(colored).not.toMatch(/\[[0-9;]*\b4\b[0-9;]*m/);
|
|
165
166
|
});
|
|
167
|
+
it('formats scan duration like the web preview summary', () => {
|
|
168
|
+
expect((0, scan_progress_renderer_1.formatScanDuration)(3200)).toBe('Scan duration: 3.2s');
|
|
169
|
+
expect((0, scan_progress_renderer_1.formatScanDuration)(0)).toBe('Scan duration: 0.0s');
|
|
170
|
+
expect((0, scan_progress_renderer_1.formatScanDuration)(-1)).toBeUndefined();
|
|
171
|
+
expect((0, scan_progress_renderer_1.formatScanDuration)(Number.NaN)).toBeUndefined();
|
|
172
|
+
});
|
|
173
|
+
it('plain finish prints scan duration before What to do next', async () => {
|
|
174
|
+
const { lines, writeLine } = captureLines();
|
|
175
|
+
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
176
|
+
isTTY: false,
|
|
177
|
+
noColor: true,
|
|
178
|
+
writeLine,
|
|
179
|
+
});
|
|
180
|
+
ui.onWroteDataflow('/tmp/out.json');
|
|
181
|
+
ui.finish({ scanDurationMs: 3200 });
|
|
182
|
+
const joined = lines.join('\n');
|
|
183
|
+
expect(joined).toContain('Scan duration: 3.2s');
|
|
184
|
+
expect(joined.indexOf('Scan duration: 3.2s')).toBeLessThan(joined.indexOf('What to do next'));
|
|
185
|
+
});
|
|
186
|
+
it('plain finish omits scan duration when not provided', async () => {
|
|
187
|
+
const { lines, writeLine } = captureLines();
|
|
188
|
+
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
189
|
+
isTTY: false,
|
|
190
|
+
noColor: true,
|
|
191
|
+
writeLine,
|
|
192
|
+
});
|
|
193
|
+
ui.finish();
|
|
194
|
+
expect(lines.join('\n')).not.toContain('Scan duration:');
|
|
195
|
+
});
|
|
196
|
+
it('plain finish still prints duration when upload failed', async () => {
|
|
197
|
+
const { lines, writeLine } = captureLines();
|
|
198
|
+
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
199
|
+
isTTY: false,
|
|
200
|
+
noColor: true,
|
|
201
|
+
writeLine,
|
|
202
|
+
});
|
|
203
|
+
ui.onUploadFailed({
|
|
204
|
+
reason: 'network error',
|
|
205
|
+
retryCommand: 'dataparade upload .dataparade/dataflow.json',
|
|
206
|
+
});
|
|
207
|
+
ui.finish({ scanDurationMs: 1500 });
|
|
208
|
+
const joined = lines.join('\n');
|
|
209
|
+
expect(joined).toContain('Scan duration: 1.5s');
|
|
210
|
+
expect(joined).toContain('Scan finished. The upload did not complete.');
|
|
211
|
+
});
|
|
212
|
+
it('TTY finish prints scan duration via Clack info', async () => {
|
|
213
|
+
const { writeLine } = captureLines();
|
|
214
|
+
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
215
|
+
isTTY: true,
|
|
216
|
+
noColor: false,
|
|
217
|
+
writeLine,
|
|
218
|
+
prompts,
|
|
219
|
+
});
|
|
220
|
+
ui.finish({ scanDurationMs: 3200 });
|
|
221
|
+
expect(prompts.log.info).toHaveBeenCalledWith('Scan duration: 3.2s');
|
|
222
|
+
expect(prompts.log.step).toHaveBeenCalledWith('What to do next');
|
|
223
|
+
});
|
|
166
224
|
it('TTY finish prints What to do next without a wrapping box', async () => {
|
|
167
225
|
const { writeLine } = captureLines();
|
|
168
226
|
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
@@ -17,21 +17,24 @@ describe('collectScanUploadFiles', () => {
|
|
|
17
17
|
afterEach(() => {
|
|
18
18
|
fs_1.default.rmSync(dir, { recursive: true, force: true });
|
|
19
19
|
});
|
|
20
|
-
it('sends facts.json, the data item files, graphify.json and
|
|
20
|
+
it('sends facts.json, the data item files, graphify.json, answers.json and threat-model.json, in that order', () => {
|
|
21
21
|
fs_1.default.writeFileSync(path_1.default.join(dir, 'facts.json'), '{"schemaVersion":1}');
|
|
22
22
|
fs_1.default.mkdirSync(path_1.default.join(dir, 'data-items'));
|
|
23
|
-
fs_1.default.writeFileSync(path_1.default.join(dir, 'data-items', '
|
|
24
|
-
fs_1.default.writeFileSync(path_1.default.join(dir, 'data-items', '
|
|
23
|
+
fs_1.default.writeFileSync(path_1.default.join(dir, 'data-items', 'pd-telephonenumber.json'), '{"id":"data_item:pd:TelephoneNumber"}');
|
|
24
|
+
fs_1.default.writeFileSync(path_1.default.join(dir, 'data-items', 'pd-emailaddress.json'), '{"id":"data_item:pd:EmailAddress"}');
|
|
25
25
|
fs_1.default.writeFileSync(path_1.default.join(dir, 'graphify.json'), '{"nodes":[]}');
|
|
26
26
|
fs_1.default.writeFileSync(path_1.default.join(dir, 'answers.json'), '{"schemaVersion":1,"answers":[]}');
|
|
27
|
+
fs_1.default.writeFileSync(path_1.default.join(dir, 'threat-model.json'), '{"schemaVersion":1,"threats":[]}');
|
|
28
|
+
fs_1.default.writeFileSync(path_1.default.join(dir, 'threat-model.unreadable.json'), '{"schemaVersion":1,"threats":[]}');
|
|
27
29
|
fs_1.default.writeFileSync(path_1.default.join(dir, 'sensitive-findings.json'), '{"schemaVersion":1,"findings":[]}');
|
|
28
30
|
const files = (0, collect_scan_sidecars_1.collectScanUploadFiles)(path_1.default.join(dir, 'dataflow.json'));
|
|
29
31
|
expect(files.map((file) => file.relativePath)).toEqual([
|
|
30
32
|
'facts.json',
|
|
31
|
-
'data-items/
|
|
32
|
-
'data-items/
|
|
33
|
+
'data-items/pd-emailaddress.json',
|
|
34
|
+
'data-items/pd-telephonenumber.json',
|
|
33
35
|
'graphify.json',
|
|
34
36
|
'answers.json',
|
|
37
|
+
'threat-model.json',
|
|
35
38
|
]);
|
|
36
39
|
expect(files[0].content).toBe('{"schemaVersion":1}');
|
|
37
40
|
});
|
|
@@ -20,7 +20,7 @@ export interface NavRequest {
|
|
|
20
20
|
file?: string;
|
|
21
21
|
line?: number;
|
|
22
22
|
name?: string;
|
|
23
|
-
/** `columns`: the concept whose stored columns are listed (`
|
|
23
|
+
/** `columns`: the concept whose stored columns are listed (`pd:EmailAddress`). */
|
|
24
24
|
concept?: string;
|
|
25
25
|
/** `columns`: `"configured"` adds configured address keys (settings, config, env). */
|
|
26
26
|
include?: string;
|
|
@@ -8,6 +8,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const column_catalog_1 = require("./column-catalog");
|
|
9
9
|
const engine_1 = require("./engine/engine");
|
|
10
10
|
const languages_1 = require("./languages");
|
|
11
|
+
const pii_signal_rules_1 = require("../pii-signals/pii-signal-rules");
|
|
11
12
|
/**
|
|
12
13
|
* Code navigator over the tree-sitter engine (KDATAP-059e1e): LSP-style answers
|
|
13
14
|
* (outline, symbols on a line, definition, callers, key writers) for tools that trace a
|
|
@@ -558,6 +559,9 @@ class CodeNavigator {
|
|
|
558
559
|
case "columns":
|
|
559
560
|
if (!request.concept)
|
|
560
561
|
return fail("columns needs a concept");
|
|
562
|
+
if (!(0, pii_signal_rules_1.loadPiiSignalRules)().some((rule) => rule.id === request.concept)) {
|
|
563
|
+
return fail(`columns: '${request.concept}' is not a detected type; use a detector rule id such as pd:EmailAddress`);
|
|
564
|
+
}
|
|
561
565
|
return done("columns", this.columns(request.concept, Number.isInteger(request.limit) && (request.limit ?? 0) > 0 ? request.limit : exports.COLUMNS_DEFAULT_LIMIT, request.include === "configured" ? "configured" : undefined));
|
|
562
566
|
case "writers":
|
|
563
567
|
if (!request.name)
|
|
@@ -78,7 +78,7 @@ export type ColumnCandidate = Omit<ColumnEntry, "locations">;
|
|
|
78
78
|
export declare function columnCandidates(file: AnalyzedFile, filePath: string): ColumnCandidate[];
|
|
79
79
|
/**
|
|
80
80
|
* Whether a source token (a column name, a settings key) is an occurrence of the concept.
|
|
81
|
-
* It uses the scanner's own signal rules for the concept id (`
|
|
81
|
+
* It uses the scanner's own signal rules for the concept id (`pd:TelephoneNumber`: phone,
|
|
82
82
|
* telephone, tel, mobile, cell, msisdn): the signal's token rule, and the rule's patterns
|
|
83
83
|
* against the token's words, so `billing_phone` and `shippingPhone` match as well as `phone`.
|
|
84
84
|
*/
|
|
@@ -96,7 +96,7 @@ function configuredTable(name) {
|
|
|
96
96
|
const SETTING_READER = /^(?:get_?(?:setting|config|conf|env|environment)s?|getenv)$/i;
|
|
97
97
|
/**
|
|
98
98
|
* Whether a source token (a column name, a settings key) is an occurrence of the concept.
|
|
99
|
-
* It uses the scanner's own signal rules for the concept id (`
|
|
99
|
+
* It uses the scanner's own signal rules for the concept id (`pd:TelephoneNumber`: phone,
|
|
100
100
|
* telephone, tel, mobile, cell, msisdn): the signal's token rule, and the rule's patterns
|
|
101
101
|
* against the token's words, so `billing_phone` and `shippingPhone` match as well as `phone`.
|
|
102
102
|
*/
|
|
@@ -584,7 +584,7 @@ function writesConceptValue(value, concept, _filePath) {
|
|
|
584
584
|
return false;
|
|
585
585
|
// The concept's own head word names it (`sender_email`, `phone_identity`); the detection
|
|
586
586
|
// matcher's looser tokens (`mail`, `address`) are not enough to call a column a copy.
|
|
587
|
-
const head =
|
|
587
|
+
const head = (0, pii_signal_rules_1.ruleNameWords)(concept)[0];
|
|
588
588
|
return wordsOf(name).some((word) => word === head || word === `${head}s`);
|
|
589
589
|
}
|
|
590
590
|
/** Methods that transform a value without changing what it is. */
|
|
@@ -11,8 +11,8 @@ export interface ConceptProfile {
|
|
|
11
11
|
/** Lower-case a type name and drop its module prefix and punctuation: `models.EmailField` -> `emailfield`. */
|
|
12
12
|
export declare function normalizeTypeName(type: string): string;
|
|
13
13
|
/**
|
|
14
|
-
* The profile of a concept id (`
|
|
15
|
-
* an empty one plus the types named
|
|
14
|
+
* The profile of a concept id (`pd:EmailAddress`, `pd:TelephoneNumber`). A concept without an entry gets
|
|
15
|
+
* an empty one plus the types named by the concept's rule words (`phonenumber`, `phonenumberfield`).
|
|
16
16
|
*/
|
|
17
17
|
export declare function conceptProfile(concept: string): ConceptProfile;
|
|
18
18
|
/** Whether `patterns/concept-profiles.yaml` has an entry for the concept id. */
|
|
@@ -11,6 +11,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
11
11
|
const yaml_1 = __importDefault(require("yaml"));
|
|
12
12
|
const zod_1 = require("zod");
|
|
13
13
|
const package_root_1 = require("../package-root");
|
|
14
|
+
const pii_signal_rules_1 = require("../pii-signals/pii-signal-rules");
|
|
14
15
|
/**
|
|
15
16
|
* Per-concept hints of the declared-column catalog, read from `patterns/concept-profiles.yaml`
|
|
16
17
|
* (KDATAP-0df343): the type names that settle a concept, and the role words of its
|
|
@@ -41,13 +42,14 @@ function normalizeTypeName(type) {
|
|
|
41
42
|
return (type.split(".").pop() ?? type).toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
|
-
* The profile of a concept id (`
|
|
45
|
-
* an empty one plus the types named
|
|
45
|
+
* The profile of a concept id (`pd:EmailAddress`, `pd:TelephoneNumber`). A concept without an entry gets
|
|
46
|
+
* an empty one plus the types named by the concept's rule words (`phonenumber`, `phonenumberfield`).
|
|
46
47
|
*/
|
|
47
48
|
function conceptProfile(concept) {
|
|
48
49
|
const catalog = loadCatalog();
|
|
49
50
|
const entry = catalog.concept_profiles.find((profile) => profile.id === concept);
|
|
50
|
-
|
|
51
|
+
// A type named like the concept's words (`PhoneNumberField`), never like its CURIE.
|
|
52
|
+
const own = (0, pii_signal_rules_1.ruleNameWords)(concept).join("");
|
|
51
53
|
return {
|
|
52
54
|
typeHints: new Set([own, `${own}field`, ...(entry?.type_hints ?? []).map(normalizeTypeName)]),
|
|
53
55
|
roleWords: new Set(entry?.role_words ?? []),
|
|
@@ -71,7 +71,7 @@ function buildScanPersonalDataLayers(inventory) {
|
|
|
71
71
|
// Sets keep first-seen order, as the arrays with an `includes` check did, without the
|
|
72
72
|
// quadratic scan.
|
|
73
73
|
entry.occurrenceIds.add(occurrenceId);
|
|
74
|
-
// A location-named singleton (`
|
|
74
|
+
// A location-named singleton (`pd:EmailAddress~file:line`) is a occurrence no evidence grouped; it
|
|
75
75
|
// stays on the occurrence for external labels but is not listed as a data item group.
|
|
76
76
|
if (hit.group && !hit.group.startsWith(`${hit.id}~`)) {
|
|
77
77
|
const groupOccurrences = entry.groups.get(hit.group) ?? new Set();
|
|
@@ -8,6 +8,11 @@ exports.runDeterministicScanPhases = runDeterministicScanPhases;
|
|
|
8
8
|
exports.finalizeDeterministicScanResult = finalizeDeterministicScanResult;
|
|
9
9
|
exports.runDeterministicScan = runDeterministicScan;
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const flow_authentication_1 = require("../../data-flow/flow-authentication");
|
|
12
|
+
const flow_controls_1 = require("../../data-flow/flow-controls");
|
|
13
|
+
const flow_data_categories_1 = require("../../data-flow/flow-data-categories");
|
|
14
|
+
const flow_interaction_description_1 = require("../../data-flow/flow-interaction-description");
|
|
15
|
+
const human_interaction_channels_1 = require("../../data-flow/human-interaction-channels");
|
|
11
16
|
const scan_result_schema_1 = require("../schema/scan-result.schema");
|
|
12
17
|
const drop_cross_section_flows_1 = require("../../data-flow/drop-cross-section-flows");
|
|
13
18
|
const structural_scan_1 = require("./structural-scan");
|
|
@@ -68,6 +73,29 @@ async function runDeterministicScanPhases(rootPath, config, onProgress, workStat
|
|
|
68
73
|
dataFlows = [];
|
|
69
74
|
}
|
|
70
75
|
}
|
|
76
|
+
try {
|
|
77
|
+
(0, flow_authentication_1.annotateFlowAuthentication)(dataFlows, files);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
const message = err instanceof Error
|
|
81
|
+
? err.message
|
|
82
|
+
: "Unknown error during flow authentication.";
|
|
83
|
+
errors.push(`flow-authentication: ${message}`);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
(0, flow_controls_1.annotateFlowControls)(dataFlows, files);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
const message = err instanceof Error ? err.message : "Unknown error during flow controls.";
|
|
90
|
+
errors.push(`flow-controls: ${message}`);
|
|
91
|
+
}
|
|
92
|
+
try {
|
|
93
|
+
(0, flow_data_categories_1.annotateFlowDataCategories)(dataFlows, files);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
const message = err instanceof Error ? err.message : "Unknown error during flow data categories.";
|
|
97
|
+
errors.push(`flow-data-categories: ${message}`);
|
|
98
|
+
}
|
|
71
99
|
try {
|
|
72
100
|
(0, data_actions_1.runDataActionPhase)(components, dataFlows, files, findings);
|
|
73
101
|
}
|
|
@@ -118,6 +146,21 @@ function finalizeDeterministicScanResult(input, onProgress) {
|
|
|
118
146
|
aiInferenceProposalDetails: input.aiInferenceProposalDetails,
|
|
119
147
|
terraformScanSummary: work.terraformScanSummary,
|
|
120
148
|
});
|
|
149
|
+
try {
|
|
150
|
+
const withInteractionChannels = (0, human_interaction_channels_1.applyHumanInteractionChannels)({
|
|
151
|
+
components: reduced.components,
|
|
152
|
+
flows: reduced.dataFlows,
|
|
153
|
+
files: work.files,
|
|
154
|
+
sections: work.sections,
|
|
155
|
+
});
|
|
156
|
+
reduced.components = withInteractionChannels.components;
|
|
157
|
+
reduced.dataFlows = withInteractionChannels.flows;
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
const message = err instanceof Error ? err.message : "Unknown error during interaction channel detection.";
|
|
161
|
+
errors.push(`interaction-channels: ${message}`);
|
|
162
|
+
}
|
|
163
|
+
(0, flow_interaction_description_1.completeFlowInteractionDescriptions)(reduced.dataFlows, reduced.components);
|
|
121
164
|
// Content-derived component and flow ids (stable across re-scans); rewrites
|
|
122
165
|
// every component/flow reference, including AI summaries and proposal details.
|
|
123
166
|
const scanResult = (0, stable_entity_ids_1.assignStableEntityIds)({
|
|
@@ -13,6 +13,7 @@ const section_helpers_1 = require("./diagram-layout/section-helpers");
|
|
|
13
13
|
const section_packing_1 = require("./diagram-layout/section-packing");
|
|
14
14
|
const terraform_lane_layout_1 = require("./diagram-layout/terraform-lane-layout");
|
|
15
15
|
const terraform_minimal_services_1 = require("./terraform-minimal-services");
|
|
16
|
+
const flow_interaction_description_1 = require("../../data-flow/flow-interaction-description");
|
|
16
17
|
const infer_data_flow_protocol_1 = require("./infer-data-flow-protocol");
|
|
17
18
|
function isAssertedDataAction(assignment) {
|
|
18
19
|
return (assignment.status ?? "asserted") === "asserted";
|
|
@@ -186,12 +187,32 @@ function normalizeTransformation(transformation) {
|
|
|
186
187
|
return "redacted";
|
|
187
188
|
return "none";
|
|
188
189
|
}
|
|
190
|
+
const ENGINEERING_PROTOCOL_OPTIONS_THE_EDITOR_OFFERS = new Set([
|
|
191
|
+
"rest",
|
|
192
|
+
"graphql",
|
|
193
|
+
"grpc",
|
|
194
|
+
"kafka",
|
|
195
|
+
"amqp",
|
|
196
|
+
"mqtt",
|
|
197
|
+
"smtp",
|
|
198
|
+
]);
|
|
199
|
+
/**
|
|
200
|
+
* The editor's protocol for a flow, or undefined (unknown). An endpoint or HTTP method
|
|
201
|
+
* alone does not make a flow REST, so the inferred "rest" fallback is not used (DATAP-937).
|
|
202
|
+
*/
|
|
203
|
+
function engineeringProtocolForFlow(flow) {
|
|
204
|
+
if (flow.protocol) {
|
|
205
|
+
return ENGINEERING_PROTOCOL_OPTIONS_THE_EDITOR_OFFERS.has(flow.protocol) ? flow.protocol : undefined;
|
|
206
|
+
}
|
|
207
|
+
const inferred = (0, infer_data_flow_protocol_1.inferDataFlowProtocol)(flow);
|
|
208
|
+
return inferred === "graphql" ? inferred : undefined;
|
|
209
|
+
}
|
|
189
210
|
function buildFlowName(flow, componentsById) {
|
|
190
211
|
const source = componentsById.get(flow.sourceComponentId);
|
|
191
212
|
const target = componentsById.get(flow.targetComponentId);
|
|
192
213
|
const sourceName = source?.name ?? flow.sourceComponentId;
|
|
193
214
|
const targetName = target?.name ?? flow.targetComponentId;
|
|
194
|
-
return `${sourceName} → ${targetName} (${flow
|
|
215
|
+
return `${sourceName} → ${targetName} (${(0, flow_interaction_description_1.flowInteractionLabel)(flow)})`;
|
|
195
216
|
}
|
|
196
217
|
function mapDataFlowToEdge(flow, componentsById) {
|
|
197
218
|
// Intra-component lineage is useful to scanner evaluation and data-action
|
|
@@ -213,7 +234,7 @@ function mapDataFlowToEdge(flow, componentsById) {
|
|
|
213
234
|
if (flow.actions && flow.actions.length > 0) {
|
|
214
235
|
engineering.actions = flow.actions;
|
|
215
236
|
}
|
|
216
|
-
const protocol = (
|
|
237
|
+
const protocol = engineeringProtocolForFlow(flow);
|
|
217
238
|
if (protocol) {
|
|
218
239
|
engineering.protocol = protocol;
|
|
219
240
|
}
|
|
@@ -20,7 +20,7 @@ export interface ScanOccurrence {
|
|
|
20
20
|
location?: "code" | "comment";
|
|
21
21
|
/** Comments immediately around a code match. */
|
|
22
22
|
commentContext?: CommentContext;
|
|
23
|
-
/** Data item group, e.g. `
|
|
23
|
+
/** Data item group, e.g. `pd:EmailAddress:customer`, when the scanner can tell. */
|
|
24
24
|
group?: string;
|
|
25
25
|
/** The evidence that named the group (see `PiiSignalHit.groupBasis`). */
|
|
26
26
|
groupBasis?: string;
|
|
@@ -33,7 +33,7 @@ export interface ScanOccurrence {
|
|
|
33
33
|
} | "unresolved";
|
|
34
34
|
}
|
|
35
35
|
export interface ScanDataItemGroup {
|
|
36
|
-
/** Group id, e.g. `
|
|
36
|
+
/** Group id, e.g. `pd:EmailAddress:customer`. */
|
|
37
37
|
id: string;
|
|
38
38
|
occurrenceIds: string[];
|
|
39
39
|
}
|
|
@@ -147,6 +147,7 @@ function ensureTerraformMinimalHubAndManagedFlows(components, flows) {
|
|
|
147
147
|
type,
|
|
148
148
|
confidence: 0.72,
|
|
149
149
|
description: "terraform_minimal_service_hub",
|
|
150
|
+
...(provider && sourceId === provider.id ? { relationship: "provisions" } : {}),
|
|
150
151
|
});
|
|
151
152
|
};
|
|
152
153
|
if (actor && main) {
|
|
@@ -103,10 +103,10 @@ export declare const detectedDataFlowSchema: z.ZodObject<{
|
|
|
103
103
|
enrichmentConfidence: z.ZodOptional<z.ZodNumber>;
|
|
104
104
|
enrichmentNotes: z.ZodOptional<z.ZodString>;
|
|
105
105
|
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
unknown: "unknown";
|
|
106
107
|
local: "local";
|
|
107
108
|
cross_section_internal: "cross_section_internal";
|
|
108
109
|
external: "external";
|
|
109
|
-
unknown: "unknown";
|
|
110
110
|
}>>;
|
|
111
111
|
targetScopeConfidence: z.ZodOptional<z.ZodEnum<{
|
|
112
112
|
high: "high";
|
|
@@ -114,6 +114,85 @@ export declare const detectedDataFlowSchema: z.ZodObject<{
|
|
|
114
114
|
low: "low";
|
|
115
115
|
}>>;
|
|
116
116
|
targetScopeReason: z.ZodOptional<z.ZodString>;
|
|
117
|
+
authentication: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
status: z.ZodEnum<{
|
|
119
|
+
seen: "seen";
|
|
120
|
+
none_seen: "none_seen";
|
|
121
|
+
}>;
|
|
122
|
+
kinds: z.ZodArray<z.ZodString>;
|
|
123
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
124
|
+
kind: z.ZodString;
|
|
125
|
+
filePath: z.ZodString;
|
|
126
|
+
line: z.ZodNumber;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
controls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
+
control: z.ZodString;
|
|
131
|
+
effect: z.ZodEnum<{
|
|
132
|
+
mitigates: "mitigates";
|
|
133
|
+
weakens: "weakens";
|
|
134
|
+
}>;
|
|
135
|
+
filePath: z.ZodString;
|
|
136
|
+
line: z.ZodNumber;
|
|
137
|
+
}, z.core.$strip>>>;
|
|
138
|
+
relationship: z.ZodOptional<z.ZodEnum<{
|
|
139
|
+
invokes: "invokes";
|
|
140
|
+
queries: "queries";
|
|
141
|
+
publishes: "publishes";
|
|
142
|
+
consumes: "consumes";
|
|
143
|
+
interacts: "interacts";
|
|
144
|
+
authenticates_via: "authenticates_via";
|
|
145
|
+
exposes: "exposes";
|
|
146
|
+
uses_in_process: "uses_in_process";
|
|
147
|
+
depends_on: "depends_on";
|
|
148
|
+
provisions: "provisions";
|
|
149
|
+
}>>;
|
|
150
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
rest: "rest";
|
|
152
|
+
graphql: "graphql";
|
|
153
|
+
grpc: "grpc";
|
|
154
|
+
soap: "soap";
|
|
155
|
+
json_rpc: "json_rpc";
|
|
156
|
+
mcp: "mcp";
|
|
157
|
+
sql: "sql";
|
|
158
|
+
mongodb_wire: "mongodb_wire";
|
|
159
|
+
redis: "redis";
|
|
160
|
+
kafka: "kafka";
|
|
161
|
+
amqp: "amqp";
|
|
162
|
+
mqtt: "mqtt";
|
|
163
|
+
smtp: "smtp";
|
|
164
|
+
oauth_oidc: "oauth_oidc";
|
|
165
|
+
otlp: "otlp";
|
|
166
|
+
vendor_sdk: "vendor_sdk";
|
|
167
|
+
unknown: "unknown";
|
|
168
|
+
}>>;
|
|
169
|
+
transport: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
unknown: "unknown";
|
|
171
|
+
https: "https";
|
|
172
|
+
http: "http";
|
|
173
|
+
websocket: "websocket";
|
|
174
|
+
http2: "http2";
|
|
175
|
+
tcp_tls: "tcp_tls";
|
|
176
|
+
tcp: "tcp";
|
|
177
|
+
stdio: "stdio";
|
|
178
|
+
in_process: "in_process";
|
|
179
|
+
}>>;
|
|
180
|
+
client: z.ZodOptional<z.ZodString>;
|
|
181
|
+
channel: z.ZodOptional<z.ZodEnum<{
|
|
182
|
+
mcp: "mcp";
|
|
183
|
+
unknown: "unknown";
|
|
184
|
+
web_gui: "web_gui";
|
|
185
|
+
mobile_app: "mobile_app";
|
|
186
|
+
desktop_app: "desktop_app";
|
|
187
|
+
cli: "cli";
|
|
188
|
+
api_direct: "api_direct";
|
|
189
|
+
email: "email";
|
|
190
|
+
}>>;
|
|
191
|
+
channelEvidence: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
192
|
+
signal: z.ZodString;
|
|
193
|
+
filePath: z.ZodString;
|
|
194
|
+
line: z.ZodNumber;
|
|
195
|
+
}, z.core.$strip>>>;
|
|
117
196
|
}, z.core.$strip>;
|
|
118
197
|
export declare const languageParserStatsSchema: z.ZodObject<{
|
|
119
198
|
language: z.ZodString;
|
|
@@ -283,10 +362,10 @@ export declare const scanResultSchema: z.ZodObject<{
|
|
|
283
362
|
enrichmentConfidence: z.ZodOptional<z.ZodNumber>;
|
|
284
363
|
enrichmentNotes: z.ZodOptional<z.ZodString>;
|
|
285
364
|
targetScope: z.ZodOptional<z.ZodEnum<{
|
|
365
|
+
unknown: "unknown";
|
|
286
366
|
local: "local";
|
|
287
367
|
cross_section_internal: "cross_section_internal";
|
|
288
368
|
external: "external";
|
|
289
|
-
unknown: "unknown";
|
|
290
369
|
}>>;
|
|
291
370
|
targetScopeConfidence: z.ZodOptional<z.ZodEnum<{
|
|
292
371
|
high: "high";
|
|
@@ -294,6 +373,85 @@ export declare const scanResultSchema: z.ZodObject<{
|
|
|
294
373
|
low: "low";
|
|
295
374
|
}>>;
|
|
296
375
|
targetScopeReason: z.ZodOptional<z.ZodString>;
|
|
376
|
+
authentication: z.ZodOptional<z.ZodObject<{
|
|
377
|
+
status: z.ZodEnum<{
|
|
378
|
+
seen: "seen";
|
|
379
|
+
none_seen: "none_seen";
|
|
380
|
+
}>;
|
|
381
|
+
kinds: z.ZodArray<z.ZodString>;
|
|
382
|
+
evidence: z.ZodArray<z.ZodObject<{
|
|
383
|
+
kind: z.ZodString;
|
|
384
|
+
filePath: z.ZodString;
|
|
385
|
+
line: z.ZodNumber;
|
|
386
|
+
}, z.core.$strip>>;
|
|
387
|
+
}, z.core.$strip>>;
|
|
388
|
+
controls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
389
|
+
control: z.ZodString;
|
|
390
|
+
effect: z.ZodEnum<{
|
|
391
|
+
mitigates: "mitigates";
|
|
392
|
+
weakens: "weakens";
|
|
393
|
+
}>;
|
|
394
|
+
filePath: z.ZodString;
|
|
395
|
+
line: z.ZodNumber;
|
|
396
|
+
}, z.core.$strip>>>;
|
|
397
|
+
relationship: z.ZodOptional<z.ZodEnum<{
|
|
398
|
+
invokes: "invokes";
|
|
399
|
+
queries: "queries";
|
|
400
|
+
publishes: "publishes";
|
|
401
|
+
consumes: "consumes";
|
|
402
|
+
interacts: "interacts";
|
|
403
|
+
authenticates_via: "authenticates_via";
|
|
404
|
+
exposes: "exposes";
|
|
405
|
+
uses_in_process: "uses_in_process";
|
|
406
|
+
depends_on: "depends_on";
|
|
407
|
+
provisions: "provisions";
|
|
408
|
+
}>>;
|
|
409
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
410
|
+
rest: "rest";
|
|
411
|
+
graphql: "graphql";
|
|
412
|
+
grpc: "grpc";
|
|
413
|
+
soap: "soap";
|
|
414
|
+
json_rpc: "json_rpc";
|
|
415
|
+
mcp: "mcp";
|
|
416
|
+
sql: "sql";
|
|
417
|
+
mongodb_wire: "mongodb_wire";
|
|
418
|
+
redis: "redis";
|
|
419
|
+
kafka: "kafka";
|
|
420
|
+
amqp: "amqp";
|
|
421
|
+
mqtt: "mqtt";
|
|
422
|
+
smtp: "smtp";
|
|
423
|
+
oauth_oidc: "oauth_oidc";
|
|
424
|
+
otlp: "otlp";
|
|
425
|
+
vendor_sdk: "vendor_sdk";
|
|
426
|
+
unknown: "unknown";
|
|
427
|
+
}>>;
|
|
428
|
+
transport: z.ZodOptional<z.ZodEnum<{
|
|
429
|
+
unknown: "unknown";
|
|
430
|
+
https: "https";
|
|
431
|
+
http: "http";
|
|
432
|
+
websocket: "websocket";
|
|
433
|
+
http2: "http2";
|
|
434
|
+
tcp_tls: "tcp_tls";
|
|
435
|
+
tcp: "tcp";
|
|
436
|
+
stdio: "stdio";
|
|
437
|
+
in_process: "in_process";
|
|
438
|
+
}>>;
|
|
439
|
+
client: z.ZodOptional<z.ZodString>;
|
|
440
|
+
channel: z.ZodOptional<z.ZodEnum<{
|
|
441
|
+
mcp: "mcp";
|
|
442
|
+
unknown: "unknown";
|
|
443
|
+
web_gui: "web_gui";
|
|
444
|
+
mobile_app: "mobile_app";
|
|
445
|
+
desktop_app: "desktop_app";
|
|
446
|
+
cli: "cli";
|
|
447
|
+
api_direct: "api_direct";
|
|
448
|
+
email: "email";
|
|
449
|
+
}>>;
|
|
450
|
+
channelEvidence: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
451
|
+
signal: z.ZodString;
|
|
452
|
+
filePath: z.ZodString;
|
|
453
|
+
line: z.ZodNumber;
|
|
454
|
+
}, z.core.$strip>>>;
|
|
297
455
|
}, z.core.$strip>>;
|
|
298
456
|
filesScanned: z.ZodNumber;
|
|
299
457
|
filesSkipped: z.ZodNumber;
|
|
@@ -4,6 +4,7 @@ exports.scanResultSchema = exports.aiInferenceSummarySchema = exports.structural
|
|
|
4
4
|
exports.parseScanResult = parseScanResult;
|
|
5
5
|
exports.validateScanResult = validateScanResult;
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
+
const data_flow_1 = require("../types/data-flow");
|
|
7
8
|
const fileLanguageEnum = zod_1.z.enum([
|
|
8
9
|
"typescript",
|
|
9
10
|
"javascript",
|
|
@@ -80,6 +81,29 @@ exports.detectedDataFlowSchema = zod_1.z.object({
|
|
|
80
81
|
.optional(),
|
|
81
82
|
targetScopeConfidence: zod_1.z.enum(["high", "medium", "low"]).optional(),
|
|
82
83
|
targetScopeReason: zod_1.z.string().optional(),
|
|
84
|
+
authentication: zod_1.z
|
|
85
|
+
.object({
|
|
86
|
+
status: zod_1.z.enum(["seen", "none_seen"]),
|
|
87
|
+
kinds: zod_1.z.array(zod_1.z.string()),
|
|
88
|
+
evidence: zod_1.z.array(zod_1.z.object({ kind: zod_1.z.string(), filePath: zod_1.z.string(), line: zod_1.z.number().int().positive() })),
|
|
89
|
+
})
|
|
90
|
+
.optional(),
|
|
91
|
+
controls: zod_1.z
|
|
92
|
+
.array(zod_1.z.object({
|
|
93
|
+
control: zod_1.z.string(),
|
|
94
|
+
effect: zod_1.z.enum(["mitigates", "weakens"]),
|
|
95
|
+
filePath: zod_1.z.string(),
|
|
96
|
+
line: zod_1.z.number().int().positive(),
|
|
97
|
+
}))
|
|
98
|
+
.optional(),
|
|
99
|
+
relationship: zod_1.z.enum(data_flow_1.FLOW_RELATIONSHIPS).optional(),
|
|
100
|
+
protocol: zod_1.z.enum(data_flow_1.FLOW_PROTOCOLS).optional(),
|
|
101
|
+
transport: zod_1.z.enum(data_flow_1.FLOW_TRANSPORTS).optional(),
|
|
102
|
+
client: zod_1.z.string().min(1).optional(),
|
|
103
|
+
channel: zod_1.z.enum(data_flow_1.HUMAN_INTERACTION_CHANNELS).optional(),
|
|
104
|
+
channelEvidence: zod_1.z
|
|
105
|
+
.array(zod_1.z.object({ signal: zod_1.z.string(), filePath: zod_1.z.string(), line: zod_1.z.number().int().positive() }))
|
|
106
|
+
.optional(),
|
|
83
107
|
});
|
|
84
108
|
exports.languageParserStatsSchema = zod_1.z.object({
|
|
85
109
|
language: zod_1.z.string().min(1),
|
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
import type { SourceLocation } from "./file";
|
|
2
2
|
export type DataFlowType = "api_call" | "database_query" | "message_queue" | "file_transfer" | "webhook" | "rpc" | "data_transfer";
|
|
3
|
+
export declare const FLOW_RELATIONSHIPS: readonly ["invokes", "queries", "publishes", "consumes", "interacts", "authenticates_via", "exposes", "uses_in_process", "depends_on", "provisions"];
|
|
4
|
+
export type FlowRelationship = (typeof FLOW_RELATIONSHIPS)[number];
|
|
5
|
+
export declare const FLOW_PROTOCOLS: readonly ["rest", "graphql", "grpc", "soap", "json_rpc", "mcp", "sql", "mongodb_wire", "redis", "kafka", "amqp", "mqtt", "smtp", "oauth_oidc", "otlp", "vendor_sdk", "unknown"];
|
|
6
|
+
export type FlowProtocol = (typeof FLOW_PROTOCOLS)[number];
|
|
7
|
+
export declare const FLOW_TRANSPORTS: readonly ["https", "http", "websocket", "http2", "tcp_tls", "tcp", "stdio", "in_process", "unknown"];
|
|
8
|
+
export type FlowTransport = (typeof FLOW_TRANSPORTS)[number];
|
|
9
|
+
export declare const HUMAN_INTERACTION_CHANNELS: readonly ["web_gui", "mobile_app", "desktop_app", "cli", "mcp", "api_direct", "email", "unknown"];
|
|
10
|
+
export type HumanInteractionChannel = (typeof HUMAN_INTERACTION_CHANNELS)[number];
|
|
11
|
+
export interface HumanInteractionChannelEvidence {
|
|
12
|
+
signal: string;
|
|
13
|
+
filePath: string;
|
|
14
|
+
line: number;
|
|
15
|
+
}
|
|
16
|
+
/** One line of authentication evidence on a flow (DATAP-912). */
|
|
17
|
+
export interface FlowAuthenticationEvidence {
|
|
18
|
+
kind: string;
|
|
19
|
+
filePath: string;
|
|
20
|
+
line: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Authentication evidence on a flow (DATAP-912). `none_seen` means no evidence was found,
|
|
24
|
+
* not that the flow is unauthenticated. Absent when the flow type is not checked.
|
|
25
|
+
*/
|
|
26
|
+
export interface FlowAuthentication {
|
|
27
|
+
status: "seen" | "none_seen";
|
|
28
|
+
kinds: string[];
|
|
29
|
+
evidence: FlowAuthenticationEvidence[];
|
|
30
|
+
}
|
|
31
|
+
export type FlowControlEffect = "mitigates" | "weakens";
|
|
32
|
+
/**
|
|
33
|
+
* One line of control evidence on a flow (DATAP-915): TLS, a timeout, plain HTTP.
|
|
34
|
+
* "weakens" means the line removes a control.
|
|
35
|
+
*/
|
|
36
|
+
export interface FlowControlEvidence {
|
|
37
|
+
control: string;
|
|
38
|
+
effect: FlowControlEffect;
|
|
39
|
+
filePath: string;
|
|
40
|
+
line: number;
|
|
41
|
+
}
|
|
3
42
|
export interface DetectedDataFlow {
|
|
4
43
|
id: string;
|
|
5
44
|
sourceComponentId: string;
|
|
@@ -21,4 +60,13 @@ export interface DetectedDataFlow {
|
|
|
21
60
|
targetScope?: "local" | "cross_section_internal" | "external" | "unknown";
|
|
22
61
|
targetScopeConfidence?: "high" | "medium" | "low";
|
|
23
62
|
targetScopeReason?: string;
|
|
63
|
+
authentication?: FlowAuthentication;
|
|
64
|
+
/** Control evidence (DATAP-915). Empty when nothing was seen; absent when not checked. */
|
|
65
|
+
controls?: FlowControlEvidence[];
|
|
66
|
+
relationship?: FlowRelationship;
|
|
67
|
+
protocol?: FlowProtocol;
|
|
68
|
+
transport?: FlowTransport;
|
|
69
|
+
client?: string;
|
|
70
|
+
channel?: HumanInteractionChannel;
|
|
71
|
+
channelEvidence?: HumanInteractionChannelEvidence[];
|
|
24
72
|
}
|