@patchstack/connect 0.5.22 → 0.5.23

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/cli.js CHANGED
@@ -7181,6 +7181,17 @@ function npmPackageOf(spec) {
7181
7181
  // src/map/sinks.ts
7182
7182
  import { createHash as createHash4 } from "crypto";
7183
7183
 
7184
+ // src/map/capabilities.ts
7185
+ var PACKAGE_SINK_MODELS = [
7186
+ {
7187
+ package: "node-serialize",
7188
+ api: "unserialize",
7189
+ sinkKind: "eval",
7190
+ argumentRole: "code",
7191
+ candidateFamily: "code-injection"
7192
+ }
7193
+ ];
7194
+
7184
7195
  // src/map/scope.ts
7185
7196
  var scopeCache = /* @__PURE__ */ new WeakMap();
7186
7197
  function declarationOf(id, ts) {
@@ -7300,9 +7311,10 @@ var FS_PACKAGES = ["fs-extra", "graceful-fs", "memfs"];
7300
7311
  var isFsPackage = (pkg) => /^node:fs(\/promises)?$/.test(pkg) || FS_PACKAGES.includes(pkg);
7301
7312
  var EXEC_PACKAGES = ["execa", "cross-spawn", "shelljs", "zx"];
7302
7313
  var isExecPackage = (pkg) => pkg === "node:child_process" || EXEC_PACKAGES.includes(pkg);
7303
- var DESERIALIZE_CALLS = /^unserialize$/;
7304
- var DESERIALIZE_PACKAGES = ["node-serialize"];
7305
- var isDeserializePackage = (pkg) => DESERIALIZE_PACKAGES.includes(pkg);
7314
+ var deserializeModel = (pkg, api) => PACKAGE_SINK_MODELS.find(
7315
+ (model) => model.sinkKind === "eval" && model.package === pkg && (api === void 0 || model.api === api)
7316
+ );
7317
+ var isDeserializePackage = (pkg) => deserializeModel(pkg) !== void 0;
7306
7318
  function recognizedSinkKinds(pkg) {
7307
7319
  const kinds = [];
7308
7320
  if (isDbPackage(pkg)) kinds.push("db");
@@ -7449,7 +7461,7 @@ function directSinks(node, ts, bindings, ctx) {
7449
7461
  if (EXEC_CALLS.test(method) && b.pkg && isExecPackage(b.pkg)) {
7450
7462
  push({ kind: "exec", package: b.pkg, op: method, attribution: "import", ...spanOf(n) });
7451
7463
  }
7452
- if (DESERIALIZE_CALLS.test(method) && b.pkg && isDeserializePackage(b.pkg)) {
7464
+ if (b.pkg && deserializeModel(b.pkg, method)) {
7453
7465
  push({ kind: "eval", provider: b.root, package: b.pkg, op: method, attribution: "import", ...spanOf(n) });
7454
7466
  }
7455
7467
  if (HTTP_MEMBER_METHODS.has(method)) {
@@ -7479,7 +7491,7 @@ function directSinks(node, ts, bindings, ctx) {
7479
7491
  push({ kind: "exec", package: pkg, op: name, attribution: "import", ...spanOf(n) });
7480
7492
  }
7481
7493
  if (name === "eval" && trueGlobal) push({ kind: "eval", op: "eval", attribution: "global", ...spanOf(n) });
7482
- if (DESERIALIZE_CALLS.test(name) && pkg && isDeserializePackage(pkg)) {
7494
+ if (pkg && deserializeModel(pkg, name)) {
7483
7495
  push({ kind: "eval", package: pkg, op: name, attribution: "import", ...spanOf(n) });
7484
7496
  }
7485
7497
  }
@@ -7558,7 +7570,10 @@ var CANDIDATE_FAMILIES = {
7558
7570
  };
7559
7571
  function argumentRoleOf(sinkKind, method, index, total = 0) {
7560
7572
  if (sinkKind === "eval" && method === "Function") return index === total - 1 ? "code" : "args";
7561
- if (sinkKind === "eval" && method === "unserialize") return index === 0 ? "code" : "unknown";
7573
+ const packageModel = PACKAGE_SINK_MODELS.find(
7574
+ (model) => model.sinkKind === sinkKind && model.api === method
7575
+ );
7576
+ if (packageModel) return index === 0 ? packageModel.argumentRole : "unknown";
7562
7577
  const table = method ? ARGUMENT_ROLES[sinkKind]?.[method] : void 0;
7563
7578
  return table?.[index] ?? "unknown";
7564
7579
  }