@socketsecurity/cli 0.14.20 → 0.14.22

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/link.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var require$$0 = require('node:fs');
4
4
  var require$$1 = require('node:path');
5
- var require$$6 = require('which');
5
+ var require$$8 = require('which');
6
6
 
7
7
  var link = {};
8
8
 
@@ -12,7 +12,7 @@ Object.defineProperty(link, "__esModule", {
12
12
  link.installLinks = installLinks;
13
13
  var _nodeFs = require$$0;
14
14
  var _nodePath = require$$1;
15
- var _which = require$$6;
15
+ var _which = require$$8;
16
16
  function installLinks(realDirname, binName) {
17
17
  const realShadowBinDir = realDirname;
18
18
  // find package manager being shadowed by this process
package/dist/npm-cli.js CHANGED
@@ -25,24 +25,24 @@ const injectionPath = _nodePath.join(realDirname, 'npm-injection.js');
25
25
  // Adding the `--quiet` and `--no-progress` flags when the `proc-log` module
26
26
  // is found to fix a UX issue when running the command with recent versions of
27
27
  // npm (input swallowed by the standard npm spinner)
28
- let npmArgs = [];
29
- if (process.argv.slice(2).includes('install')) {
28
+ const npmArgs = process.argv.slice(2);
29
+ if (npmArgs.includes('install') && !npmArgs.includes('--no-progress') && !npmArgs.includes('--quiet')) {
30
30
  const npmEntrypoint = (0, _nodeFs.realpathSync)(npmPath);
31
31
  const npmRootPath = (0, _pathResolve.findRoot)(_nodePath.dirname(npmEntrypoint));
32
32
  if (npmRootPath === undefined) {
33
33
  process.exit(127);
34
34
  }
35
35
  const npmDepPath = _nodePath.join(npmRootPath, 'node_modules');
36
- let npmlog;
36
+ let procLog;
37
37
  try {
38
- npmlog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
38
+ procLog = require(_nodePath.join(npmDepPath, 'proc-log/lib/index.js')).log;
39
39
  } catch {}
40
- if (npmlog) {
41
- npmArgs = ['--quiet', '--no-progress'];
40
+ if (procLog) {
41
+ npmArgs.push('--no-progress', '--quiet');
42
42
  }
43
43
  }
44
44
  process.exitCode = 1;
45
- const spawnPromise = _promiseSpawn(process.execPath, ['--require', injectionPath, npmPath, ...process.argv.slice(2), ...npmArgs], {
45
+ const spawnPromise = _promiseSpawn(process.execPath, ['--require', injectionPath, npmPath, ...npmArgs], {
46
46
  stdio: 'inherit'
47
47
  });
48
48
  spawnPromise.process.on('exit', (code, signal) => {
@@ -17,7 +17,6 @@ var require$$1$1 = require('node:net');
17
17
  var require$$2 = require('node:os');
18
18
  var require$$6 = require('../package.json');
19
19
  var pathResolve = require('./path-resolve.js');
20
- var require$$0$1 = require('pacote');
21
20
 
22
21
  var npmInjection$1 = {};
23
22
 
@@ -63,12 +62,12 @@ function createNonStandardTTYServer() {
63
62
  conn.removeListener('data', awaitCapture);
64
63
  conn.push(lineBuff.slice(eolIndex + 1));
65
64
  const {
66
- ipc_version: remote_ipc_version,
67
65
  capabilities: {
66
+ colorLevel: ipcColorLevel,
68
67
  input: hasInput,
69
- output: hasOutput,
70
- colorLevel: ipcColorLevel
71
- }
68
+ output: hasOutput
69
+ },
70
+ ipc_version: remote_ipc_version
72
71
  } = JSON.parse(lineBuff.slice(0, eolIndex).toString('utf-8'));
73
72
  lineBuff = null;
74
73
  captured = true;
@@ -313,7 +312,6 @@ function issueRuleValueDoesNotDefer(issueRule) {
313
312
 
314
313
  /**
315
314
  * Handles booleans for backwards compatibility
316
-
317
315
  */
318
316
  function uxForDefinedNonDeferValue(issueRuleValue) {
319
317
  if (typeof issueRuleValue === 'boolean') {
@@ -402,51 +400,69 @@ var _ttyServer = ttyServer$1;
402
400
  var _chalkMarkdown = sdk.chalkMarkdown;
403
401
  var _issueRules = issueRules;
404
402
  var _misc = sdk.misc;
405
- var _objects = sdk.objects;
403
+ var _objects = vendor.objects;
406
404
  var _pathResolve = pathResolve.pathResolve;
407
405
  var _sdk = sdk.sdk;
408
406
  var _settings = sdk.settings;
409
- const LOOP_SENTINEL = 1_000_000;
410
407
  const POTENTIALLY_BUG_ERROR_SNIPPET = 'this is potentially a bug with socket-npm caused by changes to the npm cli';
411
408
  const distPath$1 = __dirname;
412
409
  const rootPath$1 = _nodePath$1.resolve(distPath$1, '..');
413
- const translations = require(_nodePath$1.join(rootPath$1, 'translations.json'));
414
- const npmEntrypoint = (0, _nodeFs$1.realpathSync)(`${process.argv[1]}`);
410
+ const npmEntrypoint = (0, _nodeFs$1.realpathSync)(process.argv[1]);
415
411
  const npmRootPath = (0, _pathResolve.findRoot)(_nodePath$1.dirname(npmEntrypoint));
416
- const abortController = new AbortController();
417
- const {
418
- signal: abortSignal
419
- } = abortController;
412
+ function tryRequire(...ids) {
413
+ for (const data of ids) {
414
+ let id;
415
+ let transformer;
416
+ if (Array.isArray(data)) {
417
+ id = data[0];
418
+ transformer = data[1];
419
+ } else {
420
+ id = data;
421
+ transformer = mod => mod;
422
+ }
423
+ try {
424
+ // Check that the transformed value isn't `undefined` because older
425
+ // versions of packages like 'proc-log' may not export a `log` method.
426
+ const exported = transformer(require(id));
427
+ if (exported !== undefined) {
428
+ return exported;
429
+ }
430
+ } catch {}
431
+ }
432
+ return undefined;
433
+ }
420
434
  if (npmRootPath === undefined) {
421
435
  console.error(`Unable to find npm cli install directory, ${POTENTIALLY_BUG_ERROR_SNIPPET}.`);
422
436
  console.error(`Searched parent directories of ${npmEntrypoint}`);
423
437
  process.exit(127);
424
438
  }
439
+ const LOOP_SENTINEL = 1_000_000;
440
+ const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
425
441
  const npmNmPath = _nodePath$1.join(npmRootPath, 'node_modules');
426
442
  const arboristClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/arborist/index.js');
443
+ const arboristDepValidPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/dep-valid.js');
427
444
  const arboristEdgeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/edge.js');
428
445
  const arboristNodeClassPath = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/node.js');
429
446
  const arboristOverrideSetClassPatch = _nodePath$1.join(npmNmPath, '@npmcli/arborist/lib/override-set.js');
430
- let npmlog;
431
- try {
432
- npmlog = require(_nodePath$1.join(npmNmPath, 'proc-log/lib/index.js')).log;
433
- } catch {}
434
- if (npmlog === undefined) {
435
- try {
436
- npmlog = require(_nodePath$1.join(npmNmPath, 'npmlog/lib/log.js'));
437
- } catch {}
438
- }
439
- if (npmlog === undefined) {
447
+ const log = tryRequire([_nodePath$1.join(npmNmPath, 'proc-log/lib/index.js'),
448
+ // The proc-log DefinitelyTyped definition is incorrect. The type definition
449
+ // is really that of its export log.
450
+ mod => mod.log], _nodePath$1.join(npmNmPath, 'npmlog/lib/log.js'));
451
+ if (log === undefined) {
440
452
  console.error(`Unable to integrate with npm cli logging infrastructure, ${POTENTIALLY_BUG_ERROR_SNIPPET}.`);
441
453
  process.exit(127);
442
454
  }
443
- let tarball;
444
- try {
445
- tarball = require(_nodePath$1.join(npmNmPath, 'pacote')).tarball;
446
- } catch {
447
- tarball = require$$0$1.tarball;
448
- }
455
+ const pacote = tryRequire(_nodePath$1.join(npmNmPath, 'pacote'), 'pacote');
456
+ const {
457
+ tarball
458
+ } = pacote;
459
+ const translations = require(_nodePath$1.join(rootPath$1, 'translations.json'));
460
+ const abortController = new AbortController();
461
+ const {
462
+ signal: abortSignal
463
+ } = abortController;
449
464
  const Arborist = require(arboristClassPath);
465
+ const depValid = require(arboristDepValidPath);
450
466
  const Edge = require(arboristEdgeClassPath);
451
467
  const Node = require(arboristNodeClassPath);
452
468
  const OverrideSet = require(arboristOverrideSetClassPatch);
@@ -456,7 +472,7 @@ const formatter = new _chalkMarkdown.ChalkOrMarkdown(false);
456
472
  const pubToken = (0, _sdk.getDefaultKey)() ?? _sdk.FREE_API_KEY;
457
473
  const ttyServer = (0, _ttyServer.createTTYServer)(_chalk.default.level, (0, _isInteractive.default)({
458
474
  stream: process.stdin
459
- }), npmlog);
475
+ }), log);
460
476
  let _uxLookup;
461
477
  async function uxLookup(settings) {
462
478
  while (_uxLookup === undefined) {
@@ -502,6 +518,12 @@ async function* batchScan(pkgIds) {
502
518
  yield JSON.parse(line);
503
519
  }
504
520
  }
521
+
522
+ // Patch adding doOverrideSetsConflict is based on
523
+ // https://github.com/npm/cli/pull/7025.
524
+ function doOverrideSetsConflict(first, second) {
525
+ return findSpecificOverrideSet(first, second) === undefined;
526
+ }
505
527
  function findSocketYmlSync() {
506
528
  let prevDir = null;
507
529
  let dir = process.cwd();
@@ -545,7 +567,7 @@ function findSpecificOverrideSet(first, second) {
545
567
  }
546
568
  overrideSet = overrideSet.parent;
547
569
  }
548
- console.error('Conflicting override sets');
570
+ log.silly('Conflicting override sets', first, second);
549
571
  return undefined;
550
572
  }
551
573
  function maybeReadfileSync(filepath) {
@@ -747,11 +769,13 @@ class SafeEdge extends Edge {
747
769
  #safeError;
748
770
  #safeExplanation;
749
771
  #safeFrom;
772
+ #safeName;
750
773
  #safeTo;
751
774
  constructor(options) {
752
775
  const {
753
776
  accept,
754
- from
777
+ from,
778
+ name
755
779
  } = options;
756
780
  // Defer to supper to validate options and assign non-private values.
757
781
  super(options);
@@ -761,43 +785,51 @@ class SafeEdge extends Edge {
761
785
  this.#safeError = null;
762
786
  this.#safeExplanation = null;
763
787
  this.#safeFrom = from;
788
+ this.#safeName = name;
764
789
  this.#safeTo = null;
765
790
  this.reload(true);
766
791
  }
767
-
768
- // Return the edge data, and an explanation of how that edge came to be here.
769
- // @ts-ignore: Edge#explain is defined with an unused `seen = []` param.
770
- explain() {
771
- if (!this.#safeExplanation) {
772
- const explanation = {
773
- type: this.type,
774
- name: this.name,
775
- spec: this.spec,
776
- bundled: false,
777
- overridden: false,
778
- error: undefined,
779
- from: undefined,
780
- rawSpec: undefined
781
- };
782
- if (this.rawSpec !== this.spec) {
783
- explanation.rawSpec = this.rawSpec;
784
- explanation.overridden = true;
785
- }
786
- if (this.bundled) {
787
- explanation.bundled = this.bundled;
788
- }
789
- if (this.error) {
790
- explanation.error = this.error;
792
+ get accept() {
793
+ return this.#safeAccept;
794
+ }
795
+ get bundled() {
796
+ return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name);
797
+ }
798
+ get error() {
799
+ if (!this.#safeError) {
800
+ if (!this.#safeTo) {
801
+ if (this.optional) {
802
+ this.#safeError = null;
803
+ } else {
804
+ this.#safeError = 'MISSING';
805
+ }
806
+ } else if (this.peer && this.#safeFrom === this.#safeTo.parent && !this.#safeFrom?.isTop) {
807
+ this.#safeError = 'PEER LOCAL';
808
+ } else if (!this.satisfiedBy(this.#safeTo)) {
809
+ this.#safeError = 'INVALID';
791
810
  }
792
- if (this.#safeFrom) {
793
- explanation.from = this.#safeFrom.explain();
811
+ // Patch adding "else if" condition is based on
812
+ // https://github.com/npm/cli/pull/7025.
813
+ else if (this.overrides && this.#safeTo.edgesOut.size && doOverrideSetsConflict(this.overrides, this.#safeTo.overrides)) {
814
+ // Any inconsistency between the edge's override set and the target's
815
+ // override set is potentially problematic. But we only say the edge is
816
+ // in error if the override sets are plainly conflicting. Note that if
817
+ // the target doesn't have any dependencies of their own, then this
818
+ // inconsistency is irrelevant.
819
+ this.#safeError = 'INVALID';
820
+ } else {
821
+ this.#safeError = 'OK';
794
822
  }
795
- this.#safeExplanation = explanation;
796
823
  }
797
- return this.#safeExplanation;
824
+ if (this.#safeError === 'OK') {
825
+ return null;
826
+ }
827
+ return this.#safeError;
798
828
  }
799
- get bundled() {
800
- return !!this.#safeFrom?.package?.bundleDependencies?.includes(this.name);
829
+
830
+ // @ts-ignore: Incorrectly typed as a property instead of an accessor.
831
+ get from() {
832
+ return this.#safeFrom;
801
833
  }
802
834
 
803
835
  // @ts-ignore: Incorrectly typed as a property instead of an accessor.
@@ -835,39 +867,55 @@ class SafeEdge extends Edge {
835
867
  }
836
868
  return this.rawSpec;
837
869
  }
838
- get accept() {
839
- return this.#safeAccept;
870
+
871
+ // @ts-ignore: Incorrectly typed as a property instead of an accessor.
872
+ get to() {
873
+ return this.#safeTo;
840
874
  }
841
- get error() {
842
- if (!this.#safeError) {
843
- if (!this.#safeTo) {
844
- if (this.optional) {
845
- this.#safeError = null;
846
- } else {
847
- this.#safeError = 'MISSING';
848
- }
849
- } else if (this.peer && this.#safeFrom === this.#safeTo.parent && !this.#safeFrom?.isTop) {
850
- this.#safeError = 'PEER LOCAL';
851
- } else if (!this.satisfiedBy(this.#safeTo)) {
852
- this.#safeError = 'INVALID';
875
+ detach() {
876
+ this.#safeExplanation = null;
877
+ // Patch replacing
878
+ // if (this.#safeTo) {
879
+ // this.#safeTo.edgesIn.delete(this)
880
+ // }
881
+ // is based on https://github.com/npm/cli/pull/7025.
882
+ this.#safeTo?.deleteEdgeIn(this);
883
+ this.#safeFrom?.edgesOut.delete(this.name);
884
+ this.#safeTo = null;
885
+ this.#safeError = 'DETACHED';
886
+ this.#safeFrom = null;
887
+ }
888
+
889
+ // Return the edge data, and an explanation of how that edge came to be here.
890
+ // @ts-ignore: Edge#explain is defined with an unused `seen = []` param.
891
+ explain() {
892
+ if (!this.#safeExplanation) {
893
+ const explanation = {
894
+ type: this.type,
895
+ name: this.name,
896
+ spec: this.spec,
897
+ bundled: false,
898
+ overridden: false,
899
+ error: undefined,
900
+ from: undefined,
901
+ rawSpec: undefined
902
+ };
903
+ if (this.rawSpec !== this.spec) {
904
+ explanation.rawSpec = this.rawSpec;
905
+ explanation.overridden = true;
853
906
  }
854
- // Patch adding "else if" condition is based on
855
- // https://github.com/npm/cli/pull/7025.
856
- else if (this.overrides && this.#safeTo.edgesOut.size && !findSpecificOverrideSet(this.overrides, this.#safeTo.overrides)) {
857
- // Any inconsistency between the edge's override set and the target's
858
- // override set is potentially problematic. But we only say the edge is
859
- // in error if the override sets are plainly conflicting. Note that if
860
- // the target doesn't have any dependencies of their own, then this
861
- // inconsistency is irrelevant.
862
- this.#safeError = 'INVALID';
863
- } else {
864
- this.#safeError = 'OK';
907
+ if (this.bundled) {
908
+ explanation.bundled = this.bundled;
865
909
  }
910
+ if (this.error) {
911
+ explanation.error = this.error;
912
+ }
913
+ if (this.#safeFrom) {
914
+ explanation.from = this.#safeFrom.explain();
915
+ }
916
+ this.#safeExplanation = explanation;
866
917
  }
867
- if (this.#safeError === 'OK') {
868
- return null;
869
- }
870
- return this.#safeError;
918
+ return this.#safeExplanation;
871
919
  }
872
920
  reload(hard = false) {
873
921
  this.#safeExplanation = null;
@@ -916,36 +964,100 @@ class SafeEdge extends Edge {
916
964
  this.#safeTo.updateOverridesEdgeInAdded(newOverrideSet);
917
965
  }
918
966
  }
919
- detach() {
920
- this.#safeExplanation = null;
921
- if (this.#safeTo) {
922
- // Patch replacing
923
- // this.#safeTo.edgesIn.delete(this)
924
- // is based on https://github.com/npm/cli/pull/7025.
925
- this.#safeTo.deleteEdgeIn(this);
967
+ satisfiedBy(node) {
968
+ // Patch replacing
969
+ // if (node.name !== this.#name) {
970
+ // return false
971
+ // }
972
+ // is based on https://github.com/npm/cli/pull/7025.
973
+ if (node.name !== this.#safeName || !this.#safeFrom) {
974
+ return false;
926
975
  }
927
- if (this.#safeFrom) {
928
- this.#safeFrom.edgesOut.delete(this.name);
976
+ // NOTE: this condition means we explicitly do not support overriding
977
+ // bundled or shrinkwrapped dependencies
978
+ if (node.hasShrinkwrap || node.inShrinkwrap || node.inBundle) {
979
+ return depValid(node, this.rawSpec, this.#safeAccept, this.#safeFrom);
929
980
  }
930
- this.#safeTo = null;
931
- this.#safeError = 'DETACHED';
932
- this.#safeFrom = null;
933
- }
934
-
935
- // @ts-ignore: Incorrectly typed as a property instead of an accessor.
936
- get from() {
937
- return this.#safeFrom;
938
- }
939
-
940
- // @ts-ignore: Incorrectly typed as a property instead of an accessor.
941
- get to() {
942
- return this.#safeTo;
981
+ // Patch replacing
982
+ // return depValid(node, this.spec, this.#accept, this.#from)
983
+ // is based on https://github.com/npm/cli/pull/7025.
984
+ //
985
+ // If there's no override we just use the spec.
986
+ if (!this.overrides?.keySpec) {
987
+ return depValid(node, this.spec, this.#safeAccept, this.#safeFrom);
988
+ }
989
+ // There's some override. If the target node satisfies the overriding spec
990
+ // then it's okay.
991
+ if (depValid(node, this.spec, this.#safeAccept, this.#safeFrom)) {
992
+ return true;
993
+ }
994
+ // If it doesn't, then it should at least satisfy the original spec.
995
+ if (!depValid(node, this.rawSpec, this.#safeAccept, this.#safeFrom)) {
996
+ return false;
997
+ }
998
+ // It satisfies the original spec, not the overriding spec. We need to make
999
+ // sure it doesn't use the overridden spec.
1000
+ // For example, we might have an ^8.0.0 rawSpec, and an override that makes
1001
+ // keySpec=8.23.0 and the override value spec=9.0.0.
1002
+ // If the node is 9.0.0, then it's okay because it's consistent with spec.
1003
+ // If the node is 8.24.0, then it's okay because it's consistent with the rawSpec.
1004
+ // If the node is 8.23.0, then it's not okay because even though it's consistent
1005
+ // with the rawSpec, it's also consistent with the keySpec.
1006
+ // So we're looking for ^8.0.0 or 9.0.0 and not 8.23.0.
1007
+ return !depValid(node, this.overrides.keySpec, this.#safeAccept, this.#safeFrom);
943
1008
  }
944
1009
  }
945
1010
 
946
1011
  // Implementation code not related to patch https://github.com/npm/cli/pull/7025
947
1012
  // is based on https://github.com/npm/cli/blob/v10.9.0/workspaces/arborist/lib/node.js:
948
1013
  class SafeNode extends Node {
1014
+ // Return true if it's safe to remove this node, because anything that is
1015
+ // depending on it would be fine with the thing that they would resolve to if
1016
+ // it was removed, or nothing is depending on it in the first place.
1017
+ canDedupe(preferDedupe = false) {
1018
+ // Not allowed to mess with shrinkwraps or bundles.
1019
+ if (this.inDepBundle || this.inShrinkwrap) {
1020
+ return false;
1021
+ }
1022
+ // It's a top level pkg, or a dep of one.
1023
+ if (!this.resolveParent?.resolveParent) {
1024
+ return false;
1025
+ }
1026
+ // No one wants it, remove it.
1027
+ if (this.edgesIn.size === 0) {
1028
+ return true;
1029
+ }
1030
+ const other = this.resolveParent.resolveParent.resolve(this.name);
1031
+ // Nothing else, need this one.
1032
+ if (!other) {
1033
+ return false;
1034
+ }
1035
+ // If it's the same thing, then always fine to remove.
1036
+ if (other.matches(this)) {
1037
+ return true;
1038
+ }
1039
+ // If the other thing can't replace this, then skip it.
1040
+ if (!other.canReplace(this)) {
1041
+ return false;
1042
+ }
1043
+ // Patch replacing
1044
+ // if (preferDedupe || semver.gte(other.version, this.version)) {
1045
+ // return true
1046
+ // }
1047
+ // is based on https://github.com/npm/cli/pull/7025.
1048
+ //
1049
+ // If we prefer dedupe, or if the version is equal, take the other.
1050
+ if (preferDedupe || _semver.eq(other.version, this.version)) {
1051
+ return true;
1052
+ }
1053
+ // If our current version isn't the result of an override, then prefer to
1054
+ // take the greater version.
1055
+ if (!this.overridden && _semver.gt(other.version, this.version)) {
1056
+ return true;
1057
+ }
1058
+ return false;
1059
+ }
1060
+
949
1061
  // Is it safe to replace one node with another? check the edges to
950
1062
  // make sure no one will get upset. Note that the node might end up
951
1063
  // having its own unmet dependencies, if the new node has new deps.
@@ -1036,7 +1148,7 @@ class SafeNode extends Node {
1036
1148
  // overridden, we check whether any edge going in had the rule applied to it,
1037
1149
  // in which case its overrides set is different than its source node.
1038
1150
  for (const edge of this.edgesIn) {
1039
- if (this.overrides.isEqual(edge.overrides)) {
1151
+ if (edge.overrides && edge.overrides.name === this.name && edge.overrides.value === this.version) {
1040
1152
  if (!edge.overrides?.isEqual(edge.from?.overrides)) {
1041
1153
  return true;
1042
1154
  }
@@ -1123,9 +1235,9 @@ class SafeNode extends Node {
1123
1235
  this.recalculateOutEdgesOverrides();
1124
1236
  return true;
1125
1237
  }
1126
- // This is an error condition. We can only get here if the new override set is
1127
- // in conflict with the existing.
1128
- console.error('Conflicting override sets');
1238
+ // This is an error condition. We can only get here if the new override set
1239
+ // is in conflict with the existing.
1240
+ log.silly('Conflicting override sets', this.name);
1129
1241
  return false;
1130
1242
  }
1131
1243
 
@@ -1318,7 +1430,7 @@ class SafeArborist extends Arborist {
1318
1430
  options['save'] = old.save;
1319
1431
  options['saveBundle'] = old.saveBundle;
1320
1432
  // Nothing to check, mmm already installed or all private?
1321
- if (diff.findIndex(c => c.newPackage.repository_url === 'https://registry.npmjs.org') === -1) {
1433
+ if (diff.findIndex(c => c.newPackage.repository_url === NPM_REGISTRY_URL) === -1) {
1322
1434
  return await this[kRiskyReify](...args);
1323
1435
  }
1324
1436
  let proceed = _constants.ENV.UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE;
@@ -1381,7 +1493,7 @@ void (async () => {
1381
1493
  const socketSdk = await (0, _sdk.setupSdk)(pubToken);
1382
1494
  const orgResult = await socketSdk.getOrganizations();
1383
1495
  if (!orgResult.success) {
1384
- throw new Error('Failed to fetch Socket organization info: ' + orgResult.error.message);
1496
+ throw new Error(`Failed to fetch Socket organization info: ${orgResult.error.message}`);
1385
1497
  }
1386
1498
  const orgs = [];
1387
1499
  for (const org of Object.values(orgResult.data.organizations)) {
@@ -1393,7 +1505,7 @@ void (async () => {
1393
1505
  organization: org.id
1394
1506
  })));
1395
1507
  if (!result.success) {
1396
- throw new Error('Failed to fetch API key settings: ' + result.error.message);
1508
+ throw new Error(`Failed to fetch API key settings: ${result.error.message}`);
1397
1509
  }
1398
1510
  return {
1399
1511
  orgs,
@@ -1434,10 +1546,14 @@ void (async () => {
1434
1546
  if (socketYml) {
1435
1547
  settings.entries.push({
1436
1548
  start: socketYml.path,
1437
- // @ts-ignore
1438
1549
  settings: {
1439
1550
  [socketYml.path]: {
1440
1551
  deferTo: null,
1552
+ // TODO: TypeScript complains about the type not matching. We should
1553
+ // figure out why are providing
1554
+ // issueRules: { [issueName: string]: boolean }
1555
+ // but expecting
1556
+ // issueRules: { [issueName: string]: { action: 'defer' | 'error' | 'ignore' | 'monitor' | 'warn' } }
1441
1557
  issueRules: socketYml.parsed.issueRules
1442
1558
  }
1443
1559
  }
@@ -4,7 +4,7 @@ var require$$1$1 = require('node:fs/promises');
4
4
  var require$$1 = require('node:path');
5
5
  var require$$2 = require('ignore');
6
6
  var require$$3 = require('micromatch');
7
- var require$$11 = require('tinyglobby');
7
+ var require$$10 = require('tinyglobby');
8
8
 
9
9
  var pathResolve = {};
10
10
 
@@ -51,7 +51,7 @@ var _promises = require$$1$1;
51
51
  var _nodePath = require$$1;
52
52
  var _ignore = require$$2;
53
53
  var _micromatch = require$$3;
54
- var _tinyglobby = require$$11;
54
+ var _tinyglobby = require$$10;
55
55
  var _ignoreByDefault = ignoreByDefault;
56
56
  async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
57
57
  const patterns = ['golang', 'npm', 'pypi'].reduce((r, n) => {
@@ -63,8 +63,8 @@ async function filterGlobResultToSupportedFiles(entries, supportedFiles) {
63
63
  }
64
64
  async function globWithGitIgnore(patterns, options) {
65
65
  const {
66
- socketConfig,
67
66
  cwd = process.cwd(),
67
+ socketConfig,
68
68
  ...additionalOptions
69
69
  } = {
70
70
  __proto__: null,
package/dist/sdk.d.ts CHANGED
@@ -1,12 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import { SocketSdk } from '@socketsecurity/sdk';
3
- declare function hasOwn(obj: any, propKey: PropertyKey): boolean;
4
- declare function isObject(value: any): value is object;
5
- declare function isObjectObject(value: any): value is {
6
- [key: string]: any;
7
- };
8
- declare function objectSome(obj: Record<string, any>): boolean;
9
- declare function pick<T extends Record<string, any>, K extends keyof T>(input: T, keys: K[] | ReadonlyArray<K>): Pick<T, K>;
10
3
  declare function createDebugLogger(printDebugLogs?: boolean): typeof console.error;
11
4
  declare function isErrnoException(value: unknown): value is NodeJS.ErrnoException;
12
5
  declare function stringJoinWithSeparateFinalSeparator(list: (string | undefined)[], separator?: string): string;
@@ -14,9 +7,7 @@ declare const API_V0_URL = "https://api.socket.dev/v0";
14
7
  declare const ENV: Readonly<{
15
8
  UPDATE_SOCKET_OVERRIDES_IN_PACKAGE_LOCK_FILE: boolean;
16
9
  }>;
17
- declare const packumentCache: Map<any, any>;
18
- declare const pacoteCachePath: any;
19
10
  declare const FREE_API_KEY = "sktsec_t_--RAN5U4ivauy4w37-6aoKyYPDt5ZbaT5JBVMqiwKo_api";
20
11
  declare function getDefaultKey(): string | undefined;
21
12
  declare function setupSdk(apiKey?: string | undefined, apiBaseUrl?: string | undefined, proxy?: string | undefined): Promise<SocketSdk>;
22
- export { hasOwn, isObject, isObjectObject, objectSome, pick, createDebugLogger, isErrnoException, stringJoinWithSeparateFinalSeparator, API_V0_URL, ENV, packumentCache, pacoteCachePath, FREE_API_KEY, getDefaultKey, setupSdk };
13
+ export { createDebugLogger, isErrnoException, stringJoinWithSeparateFinalSeparator, API_V0_URL, ENV, FREE_API_KEY, getDefaultKey, setupSdk };