@coana-tech/cli 14.12.5 → 14.12.7

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/cli.mjs CHANGED
@@ -197989,12 +197989,14 @@ async function computeSocketFactArtifacts(rootDir, relativeManifestFilePaths) {
197989
197989
  return void 0;
197990
197990
  }
197991
197991
  }
197992
- async function registerAutofixOrUpgradePurlRun(manifestsTarHash, repositoryName, options, cliCommand) {
197992
+ async function registerAutofixOrUpgradePurlRun(manifestsTarHash, options, cliCommand) {
197993
197993
  try {
197994
197994
  const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/register-autofix-or-upgrade-cli-run`);
197995
197995
  const data2 = {
197996
197996
  manifestsTarHash,
197997
- repositoryName,
197997
+ // disabling rule to also catch case where process.env.SOCKET_REPO_NAME is the empty string.
197998
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
197999
+ repositoryName: process.env.SOCKET_REPO_NAME || "unknown-repo",
197998
198000
  options,
197999
198001
  cliCommand
198000
198002
  };
@@ -210347,6 +210349,12 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash)
210347
210349
  try {
210348
210350
  const { artifacts } = await fetchArtifactsFromManifestsTarHash(manifestsTarHash);
210349
210351
  const properPythonProjects = [];
210352
+ const pipArtifactToRepresentativeManifest = {};
210353
+ for (const artifact of artifacts) {
210354
+ if (artifact.type === "pypi" && artifact.manifestFiles) {
210355
+ pipArtifactToRepresentativeManifest[simplePurl(artifact.type, artifact.namespace ?? "", artifact.name, artifact.version ?? "")] = artifact;
210356
+ }
210357
+ }
210350
210358
  const venvExcludes = [
210351
210359
  "venv",
210352
210360
  ".venv",
@@ -210398,6 +210406,13 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash)
210398
210406
  manifestFiles.push(...(await getFilesRelative(rootWorkingDirectory)).filter((file) => (0, import_picomatch2.default)("{*.csproj,packages.lock.json}")(basename7(file))));
210399
210407
  break;
210400
210408
  }
210409
+ case "PIP": {
210410
+ const sPurl = simplePurl(artifact.type, artifact.namespace ?? "", artifact.name, artifact.version ?? "");
210411
+ if (pipArtifactToRepresentativeManifest[sPurl]) {
210412
+ manifestFiles.push(...(pipArtifactToRepresentativeManifest[sPurl].manifestFiles ?? []).map((ref) => ref.file));
210413
+ }
210414
+ break;
210415
+ }
210401
210416
  default: {
210402
210417
  artifact.manifestFiles?.forEach((ref) => manifestFiles.push(ref.file));
210403
210418
  const allAncestorIds = getAllToplevelAncestors(artifactMap, artifact.id);
@@ -225589,7 +225604,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
225589
225604
  }
225590
225605
 
225591
225606
  // dist/version.js
225592
- var version2 = "14.12.5";
225607
+ var version2 = "14.12.7";
225593
225608
 
225594
225609
  // dist/cli-core.js
225595
225610
  var { mapValues, omit, partition, pick } = import_lodash15.default;
@@ -226280,7 +226295,7 @@ async function upgradePurl(path2, upgrades, options, logFile, cliFixRunId) {
226280
226295
  logger.silent = options.silent;
226281
226296
  let cliRunId = cliFixRunId;
226282
226297
  if (!cliRunId && options.manifestsTarHash) {
226283
- cliRunId = await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, path2, options, "upgrade-purls");
226298
+ cliRunId = await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, options, "upgrade-purls");
226284
226299
  }
226285
226300
  const upgradePurlRunId = cliRunId && await getSocketAPI().registerUpgradePurlRun(cliRunId, upgrades);
226286
226301
  Spinner.instance({ text: "Running Coana Upgrade Purl CLI", isSilent: options.silent }).start();
@@ -226410,7 +226425,7 @@ ${vulnerabilityFixes.map((fix) => ` ${fix.dependencyName} from ${fix.currentVers
226410
226425
 
226411
226426
  // dist/cli-compute-fixes-and-upgrade-purls.js
226412
226427
  async function computeFixesAndUpgradePurls(path2, options, logFile) {
226413
- const autofixRunId = options.manifestsTarHash && await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, path2, options, "autofix");
226428
+ const autofixRunId = options.manifestsTarHash && await getSocketAPI().registerAutofixOrUpgradePurlRun(options.manifestsTarHash, options, "autofix");
226414
226429
  const { artifacts, ghsaToVulnerableArtifactIds } = await computeInputForComputingFixes(path2, options);
226415
226430
  if (Object.keys(ghsaToVulnerableArtifactIds).length === 0) {
226416
226431
  logger.info("No vulnerabilities to compute fixes for");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coana-tech/cli",
3
- "version": "14.12.5",
3
+ "version": "14.12.7",
4
4
  "description": "Coana CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -73399,12 +73399,14 @@ async function getLatestBucketsSocket(subprojectPath, workspacePath) {
73399
73399
  return void 0;
73400
73400
  }
73401
73401
  }
73402
- async function registerAutofixOrUpgradePurlRun(manifestsTarHash, repositoryName, options, cliCommand) {
73402
+ async function registerAutofixOrUpgradePurlRun(manifestsTarHash, options, cliCommand) {
73403
73403
  try {
73404
73404
  const url2 = getSocketApiUrl(`orgs/${process.env.SOCKET_ORG_SLUG}/fixes/register-autofix-or-upgrade-cli-run`);
73405
73405
  const data2 = {
73406
73406
  manifestsTarHash,
73407
- repositoryName,
73407
+ // disabling rule to also catch case where process.env.SOCKET_REPO_NAME is the empty string.
73408
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
73409
+ repositoryName: process.env.SOCKET_REPO_NAME || "unknown-repo",
73408
73410
  options,
73409
73411
  cliCommand
73410
73412
  };