@dataparade/cli 0.0.33 → 0.0.35

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -67,7 +67,7 @@
67
67
  "zod": "^4.3.5"
68
68
  },
69
69
  "devDependencies": {
70
- "@dataparade/scanner": "github:DataParade-io/scanner#175f7366ab54b8bf8c56998a21198d9aaa6858e0",
70
+ "@dataparade/scanner": "github:DataParade-io/scanner#08acc5536bf5b2b0532ee4f4e306798c4774138b",
71
71
  "@eslint/js": "^9.18.0",
72
72
  "@types/jest": "^30.0.0",
73
73
  "@types/node": "^22.0.0",
@@ -1,4 +1,4 @@
1
- import type { Command } from "commander";
2
- import { type ToolStamps } from "./run-diff";
1
+ import type { Command } from 'commander';
2
+ import { type ToolStamps } from './run-diff';
3
3
  /** Hidden for now (DATAP-852): compares two Git revisions of one repository. */
4
4
  export declare function registerDiffCommand(program: Command, tools: () => ToolStamps): void;
@@ -10,38 +10,51 @@ const path_1 = __importDefault(require("path"));
10
10
  const kb_compare_1 = require("../../vendor/kb-compare/dist/src/index.js");
11
11
  const scan_env_1 = require("../config/scan-env");
12
12
  const run_diff_1 = require("./run-diff");
13
+ const build_preview_url_1 = require("../upload/build-preview-url");
13
14
  const upload_diff_1 = require("./upload-diff");
14
15
  /** Scans a folder by running this CLI's own `scan` command, with AI off and no upload. */
15
16
  function scanWithThisCli() {
16
17
  const entry = process.argv[1];
17
18
  return (dir, outDir) => {
18
19
  try {
19
- (0, child_process_1.execFileSync)(process.execPath, [entry, "scan", dir, "--no-ai-inference", "-o", path_1.default.join(outDir, "dataflow.json")], {
20
- env: { ...process.env, DATAPARADE_SKIP_AUTO_UPLOAD: "1", SCAN_AI_INFERENCE: "false" },
21
- stdio: ["ignore", "ignore", "pipe"],
20
+ (0, child_process_1.execFileSync)(process.execPath, [
21
+ entry,
22
+ 'scan',
23
+ dir,
24
+ '--no-ai-inference',
25
+ '-o',
26
+ path_1.default.join(outDir, 'dataflow.json'),
27
+ ], {
28
+ env: {
29
+ ...process.env,
30
+ DATAPARADE_SKIP_AUTO_UPLOAD: '1',
31
+ SCAN_AI_INFERENCE: 'false',
32
+ },
33
+ stdio: ['ignore', 'ignore', 'pipe'],
22
34
  maxBuffer: 64 * 1024 * 1024,
23
35
  });
24
- return JSON.parse(fs_1.default.readFileSync(path_1.default.join(outDir, "facts.json"), "utf8"));
36
+ return JSON.parse(fs_1.default.readFileSync(path_1.default.join(outDir, 'facts.json'), 'utf8'));
25
37
  }
26
38
  catch (error) {
27
39
  const stderr = error.stderr?.toString().trim();
28
- throw new run_diff_1.DiffError("SCAN_FAILED", `The scan of ${dir} failed${stderr ? `:\n${stderr.split("\n").slice(-5).join("\n")}` : "."}`);
40
+ throw new run_diff_1.DiffError('SCAN_FAILED', `The scan of ${dir} failed${stderr ? `:\n${stderr.split('\n').slice(-5).join('\n')}` : '.'}`);
29
41
  }
30
42
  };
31
43
  }
32
44
  /** Hidden for now (DATAP-852): compares two Git revisions of one repository. */
33
45
  function registerDiffCommand(program, tools) {
34
46
  program
35
- .command("diff <repo> <base> <head>", { hidden: true })
36
- .description("Compare two Git revisions of a repository and write the change set (AI off)")
37
- .option("-o, --output <dir>", "Folder for change-set.json, summary.txt and renames.json", "dataparade-diff")
38
- .option("--no-cache", "Scan both revisions again instead of reusing cached scans")
39
- .option("--upload", "Upload both scans, the rename map and the root commit, so the backend compares them (needs a workspace API key)")
40
- .option("--workspace-api-key <key>", "DataParade workspace API key for --upload (env: DATAPARADE_WORKSPACE_API_KEY)")
47
+ .command('diff <repo> <base> <head>', { hidden: true })
48
+ .description('Compare two Git revisions of a repository and write the change set (AI off)')
49
+ .option('-o, --output <dir>', 'Folder for change-set.json, summary.txt and renames.json', 'dataparade-diff')
50
+ .option('--no-cache', 'Scan both revisions again instead of reusing cached scans')
51
+ .option('--upload', 'Upload both scans, the rename map and the root commit, so the backend compares them (needs a workspace API key)')
52
+ .option('--workspace-api-key <key>', 'DataParade workspace API key for --upload (env: DATAPARADE_WORKSPACE_API_KEY)')
41
53
  .action(async (repo, base, head, options) => {
42
- const apiKey = options.workspaceApiKey?.trim() || (0, scan_env_1.resolveWorkspaceApiKey)(process.env);
54
+ const apiKey = options.workspaceApiKey?.trim() ||
55
+ (0, scan_env_1.resolveWorkspaceApiKey)(process.env);
43
56
  if (options.upload && !apiKey) {
44
- console.error("--upload needs a workspace API key: pass --workspace-api-key or set DATAPARADE_WORKSPACE_API_KEY.");
57
+ console.error('--upload needs a workspace API key: pass --workspace-api-key or set DATAPARADE_WORKSPACE_API_KEY.');
45
58
  process.exitCode = 1;
46
59
  return;
47
60
  }
@@ -61,8 +74,14 @@ function registerDiffCommand(program, tools) {
61
74
  console.log(result.summary);
62
75
  console.log(`\nWrote ${result.files.changeSet}`);
63
76
  if (options.upload) {
64
- const uploaded = await (0, upload_diff_1.uploadDiffScans)({ apiKey: apiKey, repo, result, log: (line) => console.error(line) });
77
+ const uploaded = await (0, upload_diff_1.uploadDiffScans)({
78
+ apiKey: apiKey,
79
+ repo,
80
+ result,
81
+ log: (line) => console.error(line),
82
+ });
65
83
  console.log((0, upload_diff_1.describeUploadedComparison)(uploaded));
84
+ console.log(`Open the head scan: ${(0, build_preview_url_1.buildImportPreviewUrl)(uploaded.head.draftId, undefined, uploaded.head.appUrl)}`);
66
85
  }
67
86
  }
68
87
  catch (error) {
@@ -73,7 +92,8 @@ function registerDiffCommand(program, tools) {
73
92
  return;
74
93
  }
75
94
  console.error(error instanceof Error ? error.message : String(error));
76
- process.exitCode = error instanceof run_diff_1.DiffError && error.code === "DIRTY_TREE" ? 2 : 1;
95
+ process.exitCode =
96
+ error instanceof run_diff_1.DiffError && error.code === 'DIRTY_TREE' ? 2 : 1;
77
97
  }
78
98
  });
79
99
  }
@@ -503,6 +503,12 @@ function classifyRawFindings(rawFindings, options) {
503
503
  })) {
504
504
  continue;
505
505
  }
506
+ // Outbound calls whose host is unknown name no destination: a generic "Outbound Http Call"
507
+ // node says nothing and wrongly becomes the hub for the application's flows.
508
+ if (group.findings.length > 0 &&
509
+ group.findings.every(isUnknownDestinationCall)) {
510
+ continue;
511
+ }
506
512
  const confidence = aggregateConfidence(group.findings, config.resolution.confidenceAggregation);
507
513
  const detectedFrom = buildDetectedFromRefs(group.findings);
508
514
  const allLocations = group.findings.map((f) => f.location);
@@ -565,3 +571,17 @@ function classifyRawFindings(rawFindings, options) {
565
571
  });
566
572
  return components;
567
573
  }
574
+ /** An outbound HTTP call with no known host, service name or literal URL. */
575
+ function isUnknownDestinationCall(finding) {
576
+ const props = finding.properties ?? {};
577
+ if (props.destination !== "unknown")
578
+ return false;
579
+ if (typeof props.serviceName === "string" && props.serviceName.trim())
580
+ return false;
581
+ if (typeof props.url === "string" && props.url.trim())
582
+ return false;
583
+ // A TS call whose host comes from one env var is named after it: that name is still useful.
584
+ if (typeof props.envVar === "string" && props.envVar.trim())
585
+ return false;
586
+ return true;
587
+ }
@@ -107,6 +107,7 @@ function detectPythonAuthFromConfig(ctx, config) {
107
107
  });
108
108
  }
109
109
  }
110
+ const contentLines = content.split(/\r?\n/);
110
111
  const outgoing = authConfig.libraries.some((lib) => lib.outgoingHeader)
111
112
  ? new Set(outboundHttpFor(ctx, config).outgoingRequestLines)
112
113
  : new Set();
@@ -115,7 +116,7 @@ function detectPythonAuthFromConfig(ctx, config) {
115
116
  let contentLocations = (0, helpers_1.locationsForContentRegexes)(ctx.file, content, lib.contentRegexes);
116
117
  if (lib.outgoingHeader) {
117
118
  const before = contentLocations.length;
118
- contentLocations = contentLocations.filter((loc) => !outgoing.has(loc.startLine));
119
+ contentLocations = contentLocations.filter((loc) => !outgoing.has(loc.startLine) && !isOutgoingHeaderDictLine(contentLines[loc.startLine - 1]));
119
120
  // Every match is a header sent on an outbound request: nothing to report.
120
121
  if (before > 0 && contentLocations.length === 0 && importLocations.length === 0)
121
122
  continue;
@@ -567,3 +568,12 @@ function detectPythonServerlessHandlersFromConfig(ctx, config) {
567
568
  }
568
569
  return findings;
569
570
  }
571
+ /**
572
+ * A line that builds an `Authorization` header to send (`{"Authorization": f"Bearer {token}"}`)
573
+ * rather than reading one from a request. The header dict is often built away from the
574
+ * request call (a `_headers()` helper or a module constant), so the request line alone
575
+ * does not show it is outbound.
576
+ */
577
+ function isOutgoingHeaderDictLine(line) {
578
+ return line !== undefined && /["']Authorization["']\s*:/.test(line);
579
+ }
@@ -4,6 +4,6 @@
4
4
  "license": "Apache-2.0",
5
5
  "description": "Vendored build of @dataparade/scanner bundled into @dataparade/cli",
6
6
  "main": "dist/src/index.js",
7
- "gitHead": "175f7366ab54b8bf8c56998a21198d9aaa6858e0",
8
- "catalogHash": "sha256:409e000237d3d332"
7
+ "gitHead": "08acc5536bf5b2b0532ee4f4e306798c4774138b",
8
+ "catalogHash": "sha256:6e2a57b52ac0116f"
9
9
  }
@@ -192,11 +192,11 @@ auth:
192
192
 
193
193
  - id: oauth2
194
194
  patternId: auth_middleware
195
+ # google.oauth2 and google_auth_oauthlib are client credentials for calling Google
196
+ # APIs, not an auth service in this application.
195
197
  importModules:
196
198
  - oauthlib
197
199
  - authlib
198
- - google.oauth2
199
- - google_auth_oauthlib
200
200
  strategy: oauth2
201
201
  confidence: 0.85
202
202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -67,7 +67,7 @@
67
67
  "zod": "^4.3.5"
68
68
  },
69
69
  "devDependencies": {
70
- "@dataparade/scanner": "github:DataParade-io/scanner#175f7366ab54b8bf8c56998a21198d9aaa6858e0",
70
+ "@dataparade/scanner": "github:DataParade-io/scanner#08acc5536bf5b2b0532ee4f4e306798c4774138b",
71
71
  "@eslint/js": "^9.18.0",
72
72
  "@types/jest": "^30.0.0",
73
73
  "@types/node": "^22.0.0",