@socketsecurity/cli-with-sentry 1.0.99 → 1.0.101

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
@@ -3379,47 +3379,37 @@ async function fetchGhsaDetails(ids) {
3379
3379
  const octokitGraphql = getOctokitGraphql();
3380
3380
  try {
3381
3381
  const gqlCacheKey = `${ids.join('-')}-graphql-snapshot`;
3382
- const gqlResp = await cacheFetch(gqlCacheKey, () => octokitGraphql(`
3383
- query($identifiers: [SecurityAdvisoryIdentifierFilter!]!) {
3384
- securityAdvisories(first: ${ids.length}, identifiers: $identifiers) {
3385
- nodes {
3386
- ghsaId
3387
- cveId
3388
- summary
3389
- severity
3390
- publishedAt
3391
- withdrawnAt
3392
- references {
3393
- url
3394
- }
3395
- vulnerabilities(first: 10) {
3396
- nodes {
3397
- package {
3398
- ecosystem
3399
- name
3400
- }
3401
- vulnerableVersionRange
3402
- }
3403
- }
3382
+ const aliases = ids.map((id, index) => `advisory${index}: securityAdvisory(ghsaId: "${id}") {
3383
+ ghsaId
3384
+ summary
3385
+ severity
3386
+ publishedAt
3387
+ withdrawnAt
3388
+ vulnerabilities(first: 10) {
3389
+ nodes {
3390
+ package {
3391
+ ecosystem
3392
+ name
3404
3393
  }
3394
+ vulnerableVersionRange
3405
3395
  }
3406
- }`, {
3407
- identifiers: ids.map(id => ({
3408
- type: 'GHSA',
3409
- value: id
3410
- }))
3411
- }));
3412
- const advisories = gqlResp?.securityAdvisories?.nodes || [];
3413
- for (const advisory of advisories) {
3414
- if (advisory.ghsaId) {
3415
- results.set(advisory.ghsaId, advisory);
3416
- }
3417
- }
3418
-
3419
- // Log any missing advisories
3420
- for (const id of ids) {
3421
- if (!results.has(id)) {
3422
- require$$8.debugFn('notice', `No advisory found for ${id}`);
3396
+ }
3397
+ }`).join('\n');
3398
+ const gqlResp = await cacheFetch(gqlCacheKey, () => octokitGraphql(`
3399
+ query {
3400
+ ${aliases}
3401
+ }
3402
+ `));
3403
+ for (let i = 0, {
3404
+ length
3405
+ } = ids; i < length; i += 1) {
3406
+ const id = ids[i];
3407
+ const advisoryKey = `advisory${i}`;
3408
+ const advisory = gqlResp?.[advisoryKey];
3409
+ if (advisory && advisory.ghsaId) {
3410
+ results.set(id, advisory);
3411
+ } else {
3412
+ require$$8.debugFn('notice', `miss: no advisory found for ${id}`);
3423
3413
  }
3424
3414
  }
3425
3415
  } catch (e) {
@@ -3938,7 +3928,9 @@ async function coanaFix(fixConfig) {
3938
3928
  }
3939
3929
  };
3940
3930
  }
3931
+ require$$8.debugFn('notice', `fetch: ${ids.length} GHSA details for ${arrays.joinAnd(ids)}`);
3941
3932
  const ghsaDetails = await fetchGhsaDetails(ids);
3933
+ require$$8.debugFn('notice', `found: ${ghsaDetails.size} GHSA details`);
3942
3934
  const scanBaseNames = new Set(scanFilepaths.map(p => path.basename(p)));
3943
3935
  let count = 0;
3944
3936
  let overallFixed = false;
@@ -3979,7 +3971,9 @@ async function coanaFix(fixConfig) {
3979
3971
  continue ghsaLoop;
3980
3972
  }
3981
3973
  require$$8.debugFn('notice', `pr: creating for ${id}`);
3982
- const summary = ghsaDetails.get(id)?.summary;
3974
+ const details = ghsaDetails.get(id);
3975
+ const summary = details?.summary;
3976
+ require$$8.debugFn('notice', `ghsa: ${id} details ${details ? 'found' : 'missing'}`);
3983
3977
  const pushed =
3984
3978
  // eslint-disable-next-line no-await-in-loop
3985
3979
  (await utils.gitCreateBranch(branch, cwd)) && (
@@ -15529,5 +15523,5 @@ void (async () => {
15529
15523
  await utils.captureException(e);
15530
15524
  }
15531
15525
  })();
15532
- //# debugId=dc11ece4-8083-4322-9e08-9883c0bc7831
15526
+ //# debugId=a4903131-9deb-4ec0-b986-17c43c335d82
15533
15527
  //# sourceMappingURL=cli.js.map