@socketsecurity/cli-with-sentry 0.14.53 → 0.14.56

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.
@@ -120,21 +120,21 @@ type SocketArtifact = {
120
120
  id?: string | undefined;
121
121
  author?: string[];
122
122
  license?: string | undefined;
123
- licenseDetails?: {
123
+ licenseDetails?: Array<{
124
124
  spdxDisj: string;
125
125
  provenance: string;
126
126
  filepath: string;
127
127
  match_strength: number;
128
- }[];
129
- licenseAttrib?: {
128
+ }>;
129
+ licenseAttrib?: Array<{
130
130
  attribText: string;
131
- attribData: {
131
+ attribData: Array<{
132
132
  purl: string;
133
133
  foundInFilepath: string;
134
134
  spdxExpr: string;
135
135
  foundAuthors: string[];
136
- }[];
137
- }[];
136
+ }>;
137
+ }>;
138
138
  score?: {
139
139
  supplyChain: number;
140
140
  quality: number;
@@ -171,7 +171,6 @@ declare function readFileUtf8(filepath: PathLike | FileHandle, options?: ReadFil
171
171
  declare function safeReadFile(...args: Parameters<typeof fs.readFile>): ReturnType<typeof fs.readFile> | undefined;
172
172
  declare function safeReadFileSync(...args: Parameters<typeof fsReadFileSync>): ReturnType<typeof fsReadFileSync> | undefined;
173
173
  declare const Arborist: ArboristClass;
174
- declare const kCtorArgs: unique symbol;
175
174
  declare const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES: {
176
175
  __proto__: null;
177
176
  audit: boolean;
@@ -189,4 +188,4 @@ declare class SafeArborist extends Arborist {
189
188
  // @ts-ignore Incorrectly typed.
190
189
  reify(this: SafeArborist, ...args: Parameters<InstanceType<ArboristClass>['reify']>): Promise<SafeNode>;
191
190
  }
192
- export { SafeOverrideSet, depValid, getSocketDevAlertUrl, getSocketDevPackageOverviewUrl, ColorOrMarkdown, createAlertUXLookup, uxLookup, CveAlertType, ArtifactAlertCveFixable, ArtifactAlertFixable, SocketArtifactAlert, SocketArtifact, batchScan, isArtifactAlertCveFixable, isArtifactAlertUpgradeFixable, isArtifactAlertFixable, PackageDetail, getPackagesToQueryFromDiff, findUp, ReadFileOptions, readFileBinary, readFileUtf8, safeReadFile, safeReadFileSync, Arborist, kCtorArgs, SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES, SafeArborist };
191
+ export { SafeOverrideSet, depValid, getSocketDevAlertUrl, getSocketDevPackageOverviewUrl, ColorOrMarkdown, createAlertUXLookup, uxLookup, CveAlertType, ArtifactAlertCveFixable, ArtifactAlertFixable, SocketArtifactAlert, SocketArtifact, batchScan, isArtifactAlertCveFixable, isArtifactAlertUpgradeFixable, isArtifactAlertFixable, PackageDetail, getPackagesToQueryFromDiff, findUp, ReadFileOptions, readFileBinary, readFileUtf8, safeReadFile, safeReadFileSync, Arborist, SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES, SafeArborist };
@@ -387,8 +387,9 @@ async function* createBatchGenerator(chunk) {
387
387
  method: 'POST',
388
388
  headers: {
389
389
  Authorization: `Basic ${btoa(`${getPublicToken()}:`)}`
390
- },
391
- signal: abortSignal$1
390
+ }
391
+ // TODO: Fix to not abort process on network abort.
392
+ // signal: abortSignal
392
393
  }).end(JSON.stringify({
393
394
  components: chunk.map(id => ({
394
395
  purl: `pkg:npm/${id}`
@@ -1577,6 +1578,7 @@ async function getPackagesAlerts(arb, options) {
1577
1578
  consolidate = false,
1578
1579
  includeExisting = false,
1579
1580
  includeUnfixable = true,
1581
+ includeUpgrades = false,
1580
1582
  output
1581
1583
  } = {
1582
1584
  __proto__: null,
@@ -1633,7 +1635,7 @@ async function getPackagesAlerts(arb, options) {
1633
1635
  }
1634
1636
  const fixableCve = isArtifactAlertCveFixable(alert);
1635
1637
  const fixableUpgrade = isArtifactAlertUpgradeFixable(alert);
1636
- if ((fixableCve || fixableUpgrade || includeUnfixable) && !(fixableUpgrade && hasOverride(pkgJson, name))) {
1638
+ if (includeUnfixable || fixableCve || includeUpgrades && fixableUpgrade && !hasOverride(pkgJson, name)) {
1637
1639
  sockPkgAlerts.push({
1638
1640
  name,
1639
1641
  version,
@@ -1751,14 +1753,16 @@ function getCveInfoByPackage(alerts, options) {
1751
1753
  }
1752
1754
  return infoByPkg;
1753
1755
  }
1756
+ const kCtorArgs = Symbol('ctorArgs');
1754
1757
  const kRiskyReify = Symbol('riskyReify');
1755
- async function reify(...args) {
1758
+ async function reify(arb, args, level = 1) {
1756
1759
  const {
1757
1760
  stderr: output,
1758
1761
  stdin: input
1759
1762
  } = process;
1760
- const alerts = await getPackagesAlerts(this, {
1761
- output
1763
+ const alerts = await getPackagesAlerts(arb, {
1764
+ output,
1765
+ includeUnfixable: level < 2
1762
1766
  });
1763
1767
  if (alerts.length && !(await prompts.confirm({
1764
1768
  message: 'Accept risks of installing these packages?',
@@ -1769,7 +1773,7 @@ async function reify(...args) {
1769
1773
  }))) {
1770
1774
  throw new Error('Socket npm exiting due to risks');
1771
1775
  }
1772
- return await this[kRiskyReify](...args);
1776
+ return await arb[kRiskyReify](...args);
1773
1777
  }
1774
1778
 
1775
1779
  const {
@@ -1780,7 +1784,6 @@ const {
1780
1784
  }
1781
1785
  } = constants;
1782
1786
  const Arborist = require(npmPaths.getArboristClassPath());
1783
- const kCtorArgs = Symbol('ctorArgs');
1784
1787
  const SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES = {
1785
1788
  __proto__: null,
1786
1789
  audit: false,
@@ -1810,8 +1813,6 @@ class SafeArborist extends Arborist {
1810
1813
  ...(ctorArgs.length ? ctorArgs[0] : undefined),
1811
1814
  progress: false
1812
1815
  }, ...ctorArgs.slice(1));
1813
- arb.actualTree = this.actualTree;
1814
- arb.idealTree = this.idealTree;
1815
1816
  const ret = await arb.reify({
1816
1817
  ...(args.length ? args[0] : undefined),
1817
1818
  progress: false
@@ -1826,19 +1827,23 @@ class SafeArborist extends Arborist {
1826
1827
  __proto__: null,
1827
1828
  ...(args.length ? args[0] : undefined)
1828
1829
  };
1830
+ if (options.dryRun) {
1831
+ return await this[kRiskyReify](...args);
1832
+ }
1833
+ const level = await getIPC(SOCKET_CLI_SAFE_WRAPPER);
1834
+ if (!level) {
1835
+ return await this[kRiskyReify](...args);
1836
+ }
1829
1837
  const safeArgs = [{
1830
1838
  ...options,
1831
1839
  progress: false
1832
1840
  }, ...args.slice(1)];
1833
- if (options.dryRun || !(await getIPC(SOCKET_CLI_SAFE_WRAPPER))) {
1834
- return await this[kRiskyReify](...safeArgs);
1835
- }
1836
1841
  Object.assign(options, SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES);
1837
1842
  const old = args[0];
1838
1843
  args[0] = options;
1839
1844
  await super.reify(...safeArgs);
1840
1845
  args[0] = old;
1841
- return await Reflect.apply(reify, this, safeArgs);
1846
+ return await reify(this, args, level);
1842
1847
  }
1843
1848
  }
1844
1849
 
@@ -1867,5 +1872,5 @@ exports.safeReadFile = safeReadFile;
1867
1872
  exports.setupSdk = setupSdk;
1868
1873
  exports.updateNode = updateNode;
1869
1874
  exports.updateSetting = updateSetting;
1870
- //# debugId=30e57097-6100-437d-9b6d-904604eeaa8d
1875
+ //# debugId=32696061-6e8b-4f74-95c9-9ae9ce6c9c1c
1871
1876
  //# sourceMappingURL=index.js.map