@coana-tech/cli 14.12.20 → 14.12.21
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 +203 -135
- package/package.json +1 -1
- package/repos/coana-tech/alucard/alucard.jar +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
- package/repos/coana-tech/mambalade/dist/mambalade-0.3.12-py3-none-any.whl +0 -0
package/cli.mjs
CHANGED
|
@@ -191180,12 +191180,18 @@ var GoFixingManager = class {
|
|
|
191180
191180
|
await applySeries(Object.entries(fixes), async ([workspacePath, fixesWithId]) => {
|
|
191181
191181
|
const dependencyTree = fixingInfo.dependencyTrees[workspacePath];
|
|
191182
191182
|
await applySeries(fixesWithId, async ({ fixId, vulnerabilityFixes }) => {
|
|
191183
|
-
await this.applySecurityFixesForWorkspace(
|
|
191183
|
+
await this.applySecurityFixesForWorkspace(
|
|
191184
|
+
workspacePath,
|
|
191185
|
+
vulnerabilityFixes,
|
|
191186
|
+
Object.fromEntries(
|
|
191187
|
+
Object.entries(dependencyTree.transitiveDependencies).map(([key, value]) => [key, value.version])
|
|
191188
|
+
)
|
|
191189
|
+
);
|
|
191184
191190
|
signalFixApplied2?.(fixId, this.subprojectPath, workspacePath, vulnerabilityFixes);
|
|
191185
191191
|
});
|
|
191186
191192
|
});
|
|
191187
191193
|
}
|
|
191188
|
-
async applySecurityFixesForWorkspace(workspacePath, fixes,
|
|
191194
|
+
async applySecurityFixesForWorkspace(workspacePath, fixes, dependencyNameToVersion) {
|
|
191189
191195
|
const subprojectPath = resolve(this.rootDir, this.subprojectPath, workspacePath);
|
|
191190
191196
|
const runGoGetCmd = async (projectPath, oldModule, newModule) => {
|
|
191191
191197
|
const success = await execAndLogOnFailure(["go", "get", newModule], projectPath);
|
|
@@ -191204,14 +191210,171 @@ var GoFixingManager = class {
|
|
|
191204
191210
|
for (const fix of fixes) {
|
|
191205
191211
|
const fixedRelease = `${fix.dependencyName}@v${fix.fixedVersion}`;
|
|
191206
191212
|
const currentRelease = `${fix.dependencyName}@v${fix.currentVersion}`;
|
|
191207
|
-
const
|
|
191208
|
-
if (
|
|
191213
|
+
const version3 = dependencyNameToVersion[fix.dependencyName];
|
|
191214
|
+
if (version3 !== fix.currentVersion) return;
|
|
191209
191215
|
await runGoGetCmd(subprojectPath, currentRelease, fixedRelease);
|
|
191210
191216
|
await excludeDowngraded(subprojectPath, fix);
|
|
191211
191217
|
}
|
|
191212
191218
|
}
|
|
191213
191219
|
};
|
|
191214
191220
|
|
|
191221
|
+
// ../fixing-management/src/fixing-management/go/go-socket-upgrade-manager.ts
|
|
191222
|
+
import { dirname } from "path";
|
|
191223
|
+
|
|
191224
|
+
// ../web-compat-utils/src/purl-utils.ts
|
|
191225
|
+
function getPurlType(ecosystem) {
|
|
191226
|
+
switch (ecosystem) {
|
|
191227
|
+
case "NPM":
|
|
191228
|
+
return "npm" /* NPM */;
|
|
191229
|
+
case "MAVEN":
|
|
191230
|
+
return "maven" /* MAVEN */;
|
|
191231
|
+
case "PIP":
|
|
191232
|
+
return "pypi" /* PYPI */;
|
|
191233
|
+
case "NUGET":
|
|
191234
|
+
return "nuget" /* NUGET */;
|
|
191235
|
+
case "GO":
|
|
191236
|
+
return "golang" /* GOLANG */;
|
|
191237
|
+
case "RUST":
|
|
191238
|
+
return "cargo" /* CARGO */;
|
|
191239
|
+
case "RUBYGEMS":
|
|
191240
|
+
return "gem" /* GEM */;
|
|
191241
|
+
default:
|
|
191242
|
+
throw Error(`Unsupported ecosystem: ${ecosystem}`);
|
|
191243
|
+
}
|
|
191244
|
+
}
|
|
191245
|
+
function getAdvisoryEcosystemFromPurl(purl) {
|
|
191246
|
+
const [purlSceme, rest] = purl.split(":");
|
|
191247
|
+
if (purlSceme !== "pkg") throw Error(`Upsupported purl scheme: ${purlSceme}`);
|
|
191248
|
+
const [purlType] = rest.split("/");
|
|
191249
|
+
return getAdvisoryEcosystemFromPurlType(purlType);
|
|
191250
|
+
}
|
|
191251
|
+
function getAdvisoryEcosystemFromPurlType(purlType) {
|
|
191252
|
+
switch (purlType) {
|
|
191253
|
+
case "npm" /* NPM */:
|
|
191254
|
+
return "NPM";
|
|
191255
|
+
case "maven" /* MAVEN */:
|
|
191256
|
+
return "MAVEN";
|
|
191257
|
+
case "pypi" /* PYPI */:
|
|
191258
|
+
return "PIP";
|
|
191259
|
+
case "nuget" /* NUGET */:
|
|
191260
|
+
return "NUGET";
|
|
191261
|
+
case "golang" /* GOLANG */:
|
|
191262
|
+
return "GO";
|
|
191263
|
+
case "cargo" /* CARGO */:
|
|
191264
|
+
return "RUST";
|
|
191265
|
+
case "gem" /* GEM */:
|
|
191266
|
+
return "RUBYGEMS";
|
|
191267
|
+
default:
|
|
191268
|
+
throw Error(`Unsupported purl type: ${purlType}`);
|
|
191269
|
+
}
|
|
191270
|
+
}
|
|
191271
|
+
function getPurlStrings(dependencyTree) {
|
|
191272
|
+
const res = {};
|
|
191273
|
+
for (const [depId, node] of Object.entries(dependencyTree.transitiveDependencies)) {
|
|
191274
|
+
const type = getPurlType(dependencyTree.ecosystem ?? "NPM");
|
|
191275
|
+
const { namespace: namespace2, name } = getNamespaceAndName(dependencyTree.ecosystem, node.packageName);
|
|
191276
|
+
const version3 = node.version;
|
|
191277
|
+
const purl = simplePurl(type, namespace2, name, version3);
|
|
191278
|
+
if (!res[purl]) res[purl] = /* @__PURE__ */ new Set();
|
|
191279
|
+
res[purl].add(depId);
|
|
191280
|
+
}
|
|
191281
|
+
return res;
|
|
191282
|
+
}
|
|
191283
|
+
function simplePurl(type, namespace2, name, version3) {
|
|
191284
|
+
return `pkg:${type}${namespace2 ? `/${namespace2}` : ""}/${name}${version3 ? `@${version3}` : ""}`;
|
|
191285
|
+
}
|
|
191286
|
+
function getNamespaceAndName(ecosystem, packageName) {
|
|
191287
|
+
let namespace2 = "";
|
|
191288
|
+
let name = "";
|
|
191289
|
+
switch (ecosystem) {
|
|
191290
|
+
case "NPM":
|
|
191291
|
+
if (packageName.includes("/")) [namespace2, name] = packageName.split("/", 2);
|
|
191292
|
+
else name = packageName;
|
|
191293
|
+
break;
|
|
191294
|
+
case "MAVEN":
|
|
191295
|
+
if (packageName.includes(":")) [namespace2, name] = packageName.split(":", 2);
|
|
191296
|
+
else name = packageName;
|
|
191297
|
+
break;
|
|
191298
|
+
case "PIP":
|
|
191299
|
+
name = packageName;
|
|
191300
|
+
break;
|
|
191301
|
+
default:
|
|
191302
|
+
name = packageName;
|
|
191303
|
+
}
|
|
191304
|
+
return { namespace: namespace2, name };
|
|
191305
|
+
}
|
|
191306
|
+
function getNameFromNamespaceAndName(purlType, namespace2, name) {
|
|
191307
|
+
if (!name) return "";
|
|
191308
|
+
switch (purlType) {
|
|
191309
|
+
case "npm" /* NPM */:
|
|
191310
|
+
return namespace2 ? `${namespace2}/${name}` : name;
|
|
191311
|
+
case "maven" /* MAVEN */:
|
|
191312
|
+
return namespace2 ? `${namespace2}:${name}` : name;
|
|
191313
|
+
case "pypi" /* PYPI */:
|
|
191314
|
+
return name;
|
|
191315
|
+
case "golang" /* GOLANG */:
|
|
191316
|
+
return namespace2 ? `${namespace2}/${name}` : name;
|
|
191317
|
+
default:
|
|
191318
|
+
return name;
|
|
191319
|
+
}
|
|
191320
|
+
}
|
|
191321
|
+
|
|
191322
|
+
// ../fixing-management/src/fixing-management/go/go-socket-upgrade-manager.ts
|
|
191323
|
+
var GoSocketUpgradeManager = class {
|
|
191324
|
+
constructor(rootDir) {
|
|
191325
|
+
this.rootDir = rootDir;
|
|
191326
|
+
}
|
|
191327
|
+
async applySocketArtifactUpgrades(_manifestFiles, upgrades, artifacts, rangeStyle) {
|
|
191328
|
+
const subprojectsToUpgrade = await this.groupUpgradesBySubproject(upgrades, artifacts);
|
|
191329
|
+
for (const [subprojectDir, upgradesForSubproject] of subprojectsToUpgrade) {
|
|
191330
|
+
const fixingManager = new GoFixingManager(this.rootDir, subprojectDir);
|
|
191331
|
+
await this.applySecurityFixesForSocketArtifacts(fixingManager, artifacts, upgradesForSubproject, rangeStyle);
|
|
191332
|
+
}
|
|
191333
|
+
}
|
|
191334
|
+
async groupUpgradesBySubproject(upgrades, artifacts) {
|
|
191335
|
+
const subprojectToUpgrade = /* @__PURE__ */ new Map();
|
|
191336
|
+
for (const upgrade of upgrades) {
|
|
191337
|
+
const artifact = artifacts[upgrade.idx];
|
|
191338
|
+
const goModFiles = artifact.manifestFiles?.filter((a5) => a5.file.endsWith("go.mod")) ?? [];
|
|
191339
|
+
artifact.toplevelAncestors?.forEach((ancestorId) => {
|
|
191340
|
+
const ancestor = artifacts.find((a5) => a5.id === ancestorId);
|
|
191341
|
+
if (ancestor) {
|
|
191342
|
+
const ancestorGoModFiles = ancestor.manifestFiles?.filter((a5) => a5.file.endsWith("go.mod")) ?? [];
|
|
191343
|
+
goModFiles.push(...ancestorGoModFiles);
|
|
191344
|
+
}
|
|
191345
|
+
});
|
|
191346
|
+
if (goModFiles.length === 0) {
|
|
191347
|
+
throw new Error("Failed to find go.mod file for artifact");
|
|
191348
|
+
}
|
|
191349
|
+
for (const goModFile of goModFiles) {
|
|
191350
|
+
const subprojectDir = dirname(goModFile.file);
|
|
191351
|
+
if (!subprojectToUpgrade.has(subprojectDir)) {
|
|
191352
|
+
subprojectToUpgrade.set(subprojectDir, []);
|
|
191353
|
+
}
|
|
191354
|
+
subprojectToUpgrade.get(subprojectDir).push(upgrade);
|
|
191355
|
+
}
|
|
191356
|
+
}
|
|
191357
|
+
return subprojectToUpgrade;
|
|
191358
|
+
}
|
|
191359
|
+
async applySecurityFixesForSocketArtifacts(fixingManager, artifacts, upgrades, _rangeStyle) {
|
|
191360
|
+
const normalizeVersion = (version3) => version3.startsWith("v") ? version3.slice(1) : version3;
|
|
191361
|
+
const upgradesTransformed = upgrades.map((upgrade) => ({
|
|
191362
|
+
dependencyName: getNameFromNamespaceAndName(
|
|
191363
|
+
"golang" /* GOLANG */,
|
|
191364
|
+
artifacts[upgrade.idx].namespace,
|
|
191365
|
+
artifacts[upgrade.idx].name
|
|
191366
|
+
),
|
|
191367
|
+
currentVersion: normalizeVersion(artifacts[upgrade.idx].version ?? ""),
|
|
191368
|
+
dependencyIdentifier: "" + upgrade.idx,
|
|
191369
|
+
fixedVersion: normalizeVersion(upgrade.upgradeVersion)
|
|
191370
|
+
}));
|
|
191371
|
+
const dependencies = Object.fromEntries(
|
|
191372
|
+
upgradesTransformed.map((fix) => [fix.dependencyName, fix.currentVersion])
|
|
191373
|
+
);
|
|
191374
|
+
await fixingManager.applySecurityFixesForWorkspace(".", upgradesTransformed, dependencies);
|
|
191375
|
+
}
|
|
191376
|
+
};
|
|
191377
|
+
|
|
191215
191378
|
// ../fixing-management/src/fixing-management/maven/gradle-fixing-manager.ts
|
|
191216
191379
|
import { existsSync as existsSync3 } from "node:fs";
|
|
191217
191380
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
@@ -193615,7 +193778,7 @@ import { resolve as resolve6 } from "node:path";
|
|
|
193615
193778
|
var import_parse_xml2 = __toESM(require_dist(), 1);
|
|
193616
193779
|
import { readFile as readFile6 } from "node:fs/promises";
|
|
193617
193780
|
import { existsSync as existsSync4 } from "node:fs";
|
|
193618
|
-
import { resolve as resolve5, join as join4, relative as relative2, dirname } from "node:path";
|
|
193781
|
+
import { resolve as resolve5, join as join4, relative as relative2, dirname as dirname2 } from "node:path";
|
|
193619
193782
|
|
|
193620
193783
|
// ../fixing-management/src/fixing-management/utils/xml-utils.ts
|
|
193621
193784
|
var import_parse_xml = __toESM(require_dist(), 1);
|
|
@@ -194103,7 +194266,7 @@ function getParentPomPath(pom) {
|
|
|
194103
194266
|
if (!parentElement) return void 0;
|
|
194104
194267
|
const relativePathElement = parentElement.children.filter((child) => child instanceof import_parse_xml2.XmlElement).find((child) => child.name === "relativePath");
|
|
194105
194268
|
const relativePath = relativePathElement?.text ?? join4("..", "pom.xml");
|
|
194106
|
-
return relativePath ? resolve5(
|
|
194269
|
+
return relativePath ? resolve5(dirname2(pom.validatedPomFile), relativePath) : void 0;
|
|
194107
194270
|
}
|
|
194108
194271
|
|
|
194109
194272
|
// ../fixing-management/src/fixing-management/maven/maven-fixing-manager.ts
|
|
@@ -194455,7 +194618,7 @@ var MavenFixingManager = class {
|
|
|
194455
194618
|
|
|
194456
194619
|
// ../fixing-management/src/fixing-management/maven/maven-socket-upgrade-manager.ts
|
|
194457
194620
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
194458
|
-
import { basename, dirname as
|
|
194621
|
+
import { basename, dirname as dirname3, relative as relative4, resolve as resolve10 } from "node:path";
|
|
194459
194622
|
|
|
194460
194623
|
// ../fixing-management/src/fixing-management/utils/socket-patch-application.ts
|
|
194461
194624
|
import { existsSync as existsSync5 } from "node:fs";
|
|
@@ -194549,102 +194712,6 @@ async function applySocketPatchResults(ecosystem, rootDir, patchResults) {
|
|
|
194549
194712
|
}
|
|
194550
194713
|
}
|
|
194551
194714
|
|
|
194552
|
-
// ../web-compat-utils/src/purl-utils.ts
|
|
194553
|
-
function getPurlType(ecosystem) {
|
|
194554
|
-
switch (ecosystem) {
|
|
194555
|
-
case "NPM":
|
|
194556
|
-
return "npm" /* NPM */;
|
|
194557
|
-
case "MAVEN":
|
|
194558
|
-
return "maven" /* MAVEN */;
|
|
194559
|
-
case "PIP":
|
|
194560
|
-
return "pypi" /* PYPI */;
|
|
194561
|
-
case "NUGET":
|
|
194562
|
-
return "nuget" /* NUGET */;
|
|
194563
|
-
case "GO":
|
|
194564
|
-
return "golang" /* GOLANG */;
|
|
194565
|
-
case "RUST":
|
|
194566
|
-
return "cargo" /* CARGO */;
|
|
194567
|
-
case "RUBYGEMS":
|
|
194568
|
-
return "gem" /* GEM */;
|
|
194569
|
-
default:
|
|
194570
|
-
throw Error(`Unsupported ecosystem: ${ecosystem}`);
|
|
194571
|
-
}
|
|
194572
|
-
}
|
|
194573
|
-
function getAdvisoryEcosystemFromPurl(purl) {
|
|
194574
|
-
const [purlSceme, rest] = purl.split(":");
|
|
194575
|
-
if (purlSceme !== "pkg") throw Error(`Upsupported purl scheme: ${purlSceme}`);
|
|
194576
|
-
const [purlType] = rest.split("/");
|
|
194577
|
-
return getAdvisoryEcosystemFromPurlType(purlType);
|
|
194578
|
-
}
|
|
194579
|
-
function getAdvisoryEcosystemFromPurlType(purlType) {
|
|
194580
|
-
switch (purlType) {
|
|
194581
|
-
case "npm" /* NPM */:
|
|
194582
|
-
return "NPM";
|
|
194583
|
-
case "maven" /* MAVEN */:
|
|
194584
|
-
return "MAVEN";
|
|
194585
|
-
case "pypi" /* PYPI */:
|
|
194586
|
-
return "PIP";
|
|
194587
|
-
case "nuget" /* NUGET */:
|
|
194588
|
-
return "NUGET";
|
|
194589
|
-
case "golang" /* GOLANG */:
|
|
194590
|
-
return "GO";
|
|
194591
|
-
case "cargo" /* CARGO */:
|
|
194592
|
-
return "RUST";
|
|
194593
|
-
case "gem" /* GEM */:
|
|
194594
|
-
return "RUBYGEMS";
|
|
194595
|
-
default:
|
|
194596
|
-
throw Error(`Unsupported purl type: ${purlType}`);
|
|
194597
|
-
}
|
|
194598
|
-
}
|
|
194599
|
-
function getPurlStrings(dependencyTree) {
|
|
194600
|
-
const res = {};
|
|
194601
|
-
for (const [depId, node] of Object.entries(dependencyTree.transitiveDependencies)) {
|
|
194602
|
-
const type = getPurlType(dependencyTree.ecosystem ?? "NPM");
|
|
194603
|
-
const { namespace: namespace2, name } = getNamespaceAndName(dependencyTree.ecosystem, node.packageName);
|
|
194604
|
-
const version3 = node.version;
|
|
194605
|
-
const purl = simplePurl(type, namespace2, name, version3);
|
|
194606
|
-
if (!res[purl]) res[purl] = /* @__PURE__ */ new Set();
|
|
194607
|
-
res[purl].add(depId);
|
|
194608
|
-
}
|
|
194609
|
-
return res;
|
|
194610
|
-
}
|
|
194611
|
-
function simplePurl(type, namespace2, name, version3) {
|
|
194612
|
-
return `pkg:${type}${namespace2 ? `/${namespace2}` : ""}/${name}${version3 ? `@${version3}` : ""}`;
|
|
194613
|
-
}
|
|
194614
|
-
function getNamespaceAndName(ecosystem, packageName) {
|
|
194615
|
-
let namespace2 = "";
|
|
194616
|
-
let name = "";
|
|
194617
|
-
switch (ecosystem) {
|
|
194618
|
-
case "NPM":
|
|
194619
|
-
if (packageName.includes("/")) [namespace2, name] = packageName.split("/", 2);
|
|
194620
|
-
else name = packageName;
|
|
194621
|
-
break;
|
|
194622
|
-
case "MAVEN":
|
|
194623
|
-
if (packageName.includes(":")) [namespace2, name] = packageName.split(":", 2);
|
|
194624
|
-
else name = packageName;
|
|
194625
|
-
break;
|
|
194626
|
-
case "PIP":
|
|
194627
|
-
name = packageName;
|
|
194628
|
-
break;
|
|
194629
|
-
default:
|
|
194630
|
-
name = packageName;
|
|
194631
|
-
}
|
|
194632
|
-
return { namespace: namespace2, name };
|
|
194633
|
-
}
|
|
194634
|
-
function getNameFromNamespaceAndName(purlType, namespace2, name) {
|
|
194635
|
-
if (!name) return "";
|
|
194636
|
-
switch (purlType) {
|
|
194637
|
-
case "npm" /* NPM */:
|
|
194638
|
-
return namespace2 ? `${namespace2}/${name}` : name;
|
|
194639
|
-
case "maven" /* MAVEN */:
|
|
194640
|
-
return namespace2 ? `${namespace2}:${name}` : name;
|
|
194641
|
-
case "pypi" /* PYPI */:
|
|
194642
|
-
return name;
|
|
194643
|
-
default:
|
|
194644
|
-
return name;
|
|
194645
|
-
}
|
|
194646
|
-
}
|
|
194647
|
-
|
|
194648
194715
|
// ../fixing-management/src/fixing-management/utils/socket-required-upgrade-helper.ts
|
|
194649
194716
|
function collectRequiredSocketUpgradesByIndex(ecosystem, upgrades, originalArtifacts, recomputedArtifacts) {
|
|
194650
194717
|
const requiredUpgrades = [];
|
|
@@ -198567,8 +198634,8 @@ var MavenSocketUpgradeManager = class {
|
|
|
198567
198634
|
const manifestFileSet = /* @__PURE__ */ new Set();
|
|
198568
198635
|
for (const manifestFile of manifestFiles) {
|
|
198569
198636
|
let shouldAdd = true;
|
|
198570
|
-
let curr =
|
|
198571
|
-
while (shouldAdd && curr !==
|
|
198637
|
+
let curr = dirname3(manifestFile);
|
|
198638
|
+
while (shouldAdd && curr !== dirname3(curr)) {
|
|
198572
198639
|
const dirName3 = basename(curr);
|
|
198573
198640
|
if (dirName3 === "target" || dirName3 === "build") {
|
|
198574
198641
|
shouldAdd = false;
|
|
@@ -198577,7 +198644,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
198577
198644
|
`Skipping manifest file ${manifestFile} - appears to be generated by ${buildSystem} (found in ${dirName3}/)`
|
|
198578
198645
|
);
|
|
198579
198646
|
}
|
|
198580
|
-
curr =
|
|
198647
|
+
curr = dirname3(curr);
|
|
198581
198648
|
}
|
|
198582
198649
|
if (shouldAdd) manifestFileSet.add(resolve10(this.rootDir, manifestFile));
|
|
198583
198650
|
}
|
|
@@ -205797,7 +205864,7 @@ glob.glob = glob;
|
|
|
205797
205864
|
// ../utils/src/npm-utils.ts
|
|
205798
205865
|
var import_lodash4 = __toESM(require_lodash(), 1);
|
|
205799
205866
|
var import_lockfile_file = __toESM(require_lib25(), 1);
|
|
205800
|
-
import { dirname as
|
|
205867
|
+
import { dirname as dirname5, relative as relative6, resolve as resolve12, sep as sep2 } from "path";
|
|
205801
205868
|
|
|
205802
205869
|
// ../utils/dist/command-utils.js
|
|
205803
205870
|
import assert4 from "assert";
|
|
@@ -206030,7 +206097,7 @@ function argt2(statics, ...values) {
|
|
|
206030
206097
|
}
|
|
206031
206098
|
|
|
206032
206099
|
// ../utils/dist/package-utils.js
|
|
206033
|
-
import { parse, join as join7, resolve as resolve11, normalize as normalize2, dirname as
|
|
206100
|
+
import { parse, join as join7, resolve as resolve11, normalize as normalize2, dirname as dirname4, basename as basename2, relative as relative5 } from "path";
|
|
206034
206101
|
import { existsSync as existsSync7, readFileSync, readdirSync as readdirSync2, statSync, writeFileSync } from "fs";
|
|
206035
206102
|
function getPackageJsonObject(workspaceRoot) {
|
|
206036
206103
|
const packageJSONContent = getPackageJsonContent(workspaceRoot);
|
|
@@ -206098,7 +206165,7 @@ async function getWorkspacePathsFromPackageJSON(projectFolder, useDotWhenNoWorks
|
|
|
206098
206165
|
const workspacePaths = [];
|
|
206099
206166
|
await asyncForEach(workspaceGlobPatternsArray, async (workspace) => {
|
|
206100
206167
|
workspacePaths.push(
|
|
206101
|
-
...(await glob(resolve12(projectFolder, workspace, "package.json"))).map((path2) => relative6(projectFolder,
|
|
206168
|
+
...(await glob(resolve12(projectFolder, workspace, "package.json"))).map((path2) => relative6(projectFolder, dirname5(path2))).filter((path2) => !path2.includes(`${sep2}node_modules${sep2}`))
|
|
206102
206169
|
);
|
|
206103
206170
|
});
|
|
206104
206171
|
return workspacePaths;
|
|
@@ -206378,7 +206445,7 @@ import { readFile as readFile14, writeFile as writeFile5 } from "fs/promises";
|
|
|
206378
206445
|
import { resolve as resolve16 } from "path";
|
|
206379
206446
|
|
|
206380
206447
|
// ../utils/src/package-utils.ts
|
|
206381
|
-
import { parse as parse2, join as join8, resolve as resolve15, normalize as normalize3, dirname as
|
|
206448
|
+
import { parse as parse2, join as join8, resolve as resolve15, normalize as normalize3, dirname as dirname6, basename as basename3, relative as relative7 } from "path";
|
|
206382
206449
|
import { existsSync as existsSync9, readFileSync as readFileSync2, readdirSync as readdirSync3, statSync as statSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
206383
206450
|
function setFieldInPackageJson(workspaceRoot, field, value) {
|
|
206384
206451
|
const packageJSONContentObj = getPackageJsonObject2(workspaceRoot);
|
|
@@ -206633,7 +206700,7 @@ var YarnFixingManager = class extends NpmEcosystemFixingManager {
|
|
|
206633
206700
|
};
|
|
206634
206701
|
|
|
206635
206702
|
// ../fixing-management/src/fixing-management/npm/npm-ecosystem-socket-fixing-manager.ts
|
|
206636
|
-
import { dirname as
|
|
206703
|
+
import { dirname as dirname7, join as join9, relative as relative8 } from "path";
|
|
206637
206704
|
import { existsSync as existsSync10 } from "fs";
|
|
206638
206705
|
import { readFile as readFile15, writeFile as writeFile6 } from "fs/promises";
|
|
206639
206706
|
function applyUpgradesToPackageJson(packageJsonContent, upgrades, rangeStyle) {
|
|
@@ -206703,7 +206770,7 @@ var NpmSocketUpgradeManager = class {
|
|
|
206703
206770
|
)
|
|
206704
206771
|
);
|
|
206705
206772
|
for (const lockFile of lockFiles ?? []) {
|
|
206706
|
-
const subprojectDir =
|
|
206773
|
+
const subprojectDir = dirname7(lockFile.file);
|
|
206707
206774
|
const isPnpmLockFile = lockFile.file.endsWith("pnpm-lock.yaml") || lockFile.file.endsWith("pnpm-lock.yml");
|
|
206708
206775
|
const workspaces = isPnpmLockFile ? await getWorkspacePathsFromPnpmLockFile(subprojectDir, true) : await getWorkspacePathsFromPackageJSON(subprojectDir, true);
|
|
206709
206776
|
for (const workspace of workspaces) {
|
|
@@ -206712,13 +206779,13 @@ var NpmSocketUpgradeManager = class {
|
|
|
206712
206779
|
}
|
|
206713
206780
|
const packageJsonFiles = artifact.manifestFiles?.filter((a5) => a5.file.endsWith("package.json")) ?? [];
|
|
206714
206781
|
for (const lockFile of lockFiles ?? []) {
|
|
206715
|
-
const correspondingPackageJsonFile = join9(
|
|
206782
|
+
const correspondingPackageJsonFile = join9(dirname7(lockFile.file), "package.json");
|
|
206716
206783
|
if (!packageJsonFiles.some((p3) => p3.file === correspondingPackageJsonFile) && existsSync10(correspondingPackageJsonFile)) {
|
|
206717
206784
|
packageJsonFiles.push({ file: correspondingPackageJsonFile });
|
|
206718
206785
|
}
|
|
206719
206786
|
}
|
|
206720
206787
|
for (const packageJsonFile of packageJsonFiles ?? []) {
|
|
206721
|
-
const packageJsonDir =
|
|
206788
|
+
const packageJsonDir = dirname7(packageJsonFile.file);
|
|
206722
206789
|
const subprojectDir = workspaceToSubproject.get(packageJsonDir) ?? packageJsonDir;
|
|
206723
206790
|
if (!subprojectToUpgrade.has(subprojectDir)) {
|
|
206724
206791
|
subprojectToUpgrade.set(subprojectDir, /* @__PURE__ */ new Map());
|
|
@@ -207104,7 +207171,7 @@ import { basename as basename4, relative as relative10, resolve as resolve18 } f
|
|
|
207104
207171
|
// ../fixing-management/src/fixing-management/nuget/nuget-project-utils.ts
|
|
207105
207172
|
var import_parse_xml3 = __toESM(require_dist(), 1);
|
|
207106
207173
|
import { readFile as readFile17 } from "node:fs/promises";
|
|
207107
|
-
import { dirname as
|
|
207174
|
+
import { dirname as dirname8, join as join12, relative as relative9, resolve as resolve17 } from "node:path";
|
|
207108
207175
|
import { existsSync as existsSync11 } from "node:fs";
|
|
207109
207176
|
function normalizeMSBuildPath(path2) {
|
|
207110
207177
|
return path2.replace(/\\/g, "/");
|
|
@@ -207196,8 +207263,8 @@ function extractPackagesFromXml(xmlDoc, fileContent) {
|
|
|
207196
207263
|
}
|
|
207197
207264
|
async function findDirectoryBuildPropsProjects(project, validateFile) {
|
|
207198
207265
|
const projectsReverse = [];
|
|
207199
|
-
let currentDir =
|
|
207200
|
-
while (currentDir.startsWith(project.rootDir) && currentDir !==
|
|
207266
|
+
let currentDir = dirname8(project.validatedProjectPath);
|
|
207267
|
+
while (currentDir.startsWith(project.rootDir) && currentDir !== dirname8(currentDir)) {
|
|
207201
207268
|
const unvalidatedPath = join12(currentDir, "Directory.Build.props");
|
|
207202
207269
|
const validatedPath = validateFile(unvalidatedPath);
|
|
207203
207270
|
if (validatedPath && validatedPath !== project.validatedProjectPath) {
|
|
@@ -207211,19 +207278,19 @@ async function findDirectoryBuildPropsProjects(project, validateFile) {
|
|
|
207211
207278
|
projectsReverse.push(directoryBuildPropsProject);
|
|
207212
207279
|
}
|
|
207213
207280
|
}
|
|
207214
|
-
currentDir =
|
|
207281
|
+
currentDir = dirname8(currentDir);
|
|
207215
207282
|
}
|
|
207216
207283
|
return projectsReverse.reverse();
|
|
207217
207284
|
}
|
|
207218
207285
|
async function findDirectoryPackagesPropsProjects(project, validateFile) {
|
|
207219
|
-
let currentDir =
|
|
207220
|
-
while (currentDir.startsWith(project.rootDir) && currentDir !==
|
|
207286
|
+
let currentDir = dirname8(project.validatedProjectPath);
|
|
207287
|
+
while (currentDir.startsWith(project.rootDir) && currentDir !== dirname8(currentDir)) {
|
|
207221
207288
|
const unvalidatedPath = join12(currentDir, "Directory.Packages.props");
|
|
207222
207289
|
const validatedPath = validateFile(unvalidatedPath);
|
|
207223
207290
|
if (validatedPath) {
|
|
207224
207291
|
return validatedPath !== project.validatedProjectPath ? await loadNuGetProject(project.rootDir, unvalidatedPath, validateFile, project.visited) : void 0;
|
|
207225
207292
|
}
|
|
207226
|
-
currentDir =
|
|
207293
|
+
currentDir = dirname8(currentDir);
|
|
207227
207294
|
}
|
|
207228
207295
|
return void 0;
|
|
207229
207296
|
}
|
|
@@ -207249,7 +207316,7 @@ async function handleImportElement(project, importElement, validateFile) {
|
|
|
207249
207316
|
if (!projectValue) return;
|
|
207250
207317
|
const importPath = evaluate2(projectValue.text, project);
|
|
207251
207318
|
if (!importPath) return;
|
|
207252
|
-
const resolvedPath = resolve17(
|
|
207319
|
+
const resolvedPath = resolve17(dirname8(project.validatedProjectPath), normalizeMSBuildPath(importPath));
|
|
207253
207320
|
const validatedPath = validateFile(resolvedPath);
|
|
207254
207321
|
if (!validatedPath || !existsSync11(validatedPath)) return;
|
|
207255
207322
|
const importedProject = await loadNuGetProject(project.rootDir, resolvedPath, validateFile, project.visited);
|
|
@@ -207990,6 +208057,7 @@ var fixingManagerConstructors = {
|
|
|
207990
208057
|
}
|
|
207991
208058
|
};
|
|
207992
208059
|
var socketUpgradeManagerConstructors = {
|
|
208060
|
+
GO: GoSocketUpgradeManager,
|
|
207993
208061
|
MAVEN: MavenSocketUpgradeManager,
|
|
207994
208062
|
NPM: NpmSocketUpgradeManager,
|
|
207995
208063
|
NUGET: NuGetSocketUpgradeManager
|
|
@@ -208027,7 +208095,7 @@ import { resolve as resolve20 } from "path";
|
|
|
208027
208095
|
|
|
208028
208096
|
// ../utils/dist/constants.js
|
|
208029
208097
|
var import_lodash6 = __toESM(require_lodash(), 1);
|
|
208030
|
-
import { dirname as
|
|
208098
|
+
import { dirname as dirname9, join as join14 } from "node:path";
|
|
208031
208099
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
208032
208100
|
|
|
208033
208101
|
// ../utils/dist/file-utils.js
|
|
@@ -208055,7 +208123,7 @@ function findParent(dir, predicate, wholePath) {
|
|
|
208055
208123
|
// ../utils/dist/constants.js
|
|
208056
208124
|
var { once: once2 } = import_lodash6.default;
|
|
208057
208125
|
var fileName = fileURLToPath3(import.meta.url);
|
|
208058
|
-
var dirName =
|
|
208126
|
+
var dirName = dirname9(fileName);
|
|
208059
208127
|
var COANA_ROOT = once2(() => {
|
|
208060
208128
|
const coanaRoot = process.env.COANA_ROOT ?? findParent(dirName, (d3) => ["coana-package-manager", "coana"].includes(d3));
|
|
208061
208129
|
if (!coanaRoot) {
|
|
@@ -209179,11 +209247,11 @@ import { resolve as resolve22 } from "path";
|
|
|
209179
209247
|
|
|
209180
209248
|
// ../utils/src/constants.ts
|
|
209181
209249
|
var import_lodash9 = __toESM(require_lodash(), 1);
|
|
209182
|
-
import { dirname as
|
|
209250
|
+
import { dirname as dirname10, join as join19 } from "node:path";
|
|
209183
209251
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
209184
209252
|
var { once: once4 } = import_lodash9.default;
|
|
209185
209253
|
var fileName2 = fileURLToPath4(import.meta.url);
|
|
209186
|
-
var dirName2 =
|
|
209254
|
+
var dirName2 = dirname10(fileName2);
|
|
209187
209255
|
var COANA_ROOT2 = once4(() => {
|
|
209188
209256
|
const coanaRoot = process.env.COANA_ROOT ?? findParent2(dirName2, (d3) => ["coana-package-manager", "coana"].includes(d3));
|
|
209189
209257
|
if (!coanaRoot) {
|
|
@@ -211799,13 +211867,13 @@ function transformToVulnChainNode(dependencyTree) {
|
|
|
211799
211867
|
// dist/internal/socket-mode-helpers-socket-dependency-trees.js
|
|
211800
211868
|
var import_packageurl_js = __toESM(require_packageurl_js(), 1);
|
|
211801
211869
|
var import_picomatch3 = __toESM(require_picomatch2(), 1);
|
|
211802
|
-
import { basename as basename8, dirname as
|
|
211870
|
+
import { basename as basename8, dirname as dirname11, join as join24, sep as sep5 } from "path";
|
|
211803
211871
|
var REQUIREMENTS_FILES_SEARCH_DEPTH2 = 3;
|
|
211804
211872
|
function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonProjects) {
|
|
211805
211873
|
switch (ecosystem) {
|
|
211806
211874
|
case "NPM": {
|
|
211807
211875
|
const base = basename8(manifestPath);
|
|
211808
|
-
const dir =
|
|
211876
|
+
const dir = dirname11(manifestPath);
|
|
211809
211877
|
return base === "package.json" ? dir || "." : void 0;
|
|
211810
211878
|
}
|
|
211811
211879
|
case "MAVEN": {
|
|
@@ -211813,7 +211881,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
211813
211881
|
}
|
|
211814
211882
|
case "PIP": {
|
|
211815
211883
|
const base = basename8(manifestPath);
|
|
211816
|
-
const dir =
|
|
211884
|
+
const dir = dirname11(manifestPath);
|
|
211817
211885
|
const workspaceDir = dir === "" ? "." : dir;
|
|
211818
211886
|
if (properPythonProjects.includes(workspaceDir)) {
|
|
211819
211887
|
return workspaceDir;
|
|
@@ -211835,11 +211903,11 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
211835
211903
|
return ".";
|
|
211836
211904
|
}
|
|
211837
211905
|
case "RUST": {
|
|
211838
|
-
return
|
|
211906
|
+
return dirname11(manifestPath) || ".";
|
|
211839
211907
|
}
|
|
211840
211908
|
case "GO": {
|
|
211841
211909
|
const base = basename8(manifestPath);
|
|
211842
|
-
const dir =
|
|
211910
|
+
const dir = dirname11(manifestPath);
|
|
211843
211911
|
return base === "go.mod" ? dir || "." : void 0;
|
|
211844
211912
|
}
|
|
211845
211913
|
default: {
|
|
@@ -211852,7 +211920,7 @@ function inferProjectFromManifestPath(ecosystem, manifestPath) {
|
|
|
211852
211920
|
case "NPM": {
|
|
211853
211921
|
const filename = basename8(manifestPath);
|
|
211854
211922
|
if (["package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml", "yarn.lock"].includes(filename)) {
|
|
211855
|
-
return
|
|
211923
|
+
return dirname11(manifestPath) || ".";
|
|
211856
211924
|
}
|
|
211857
211925
|
return void 0;
|
|
211858
211926
|
}
|
|
@@ -211917,7 +211985,7 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash,
|
|
|
211917
211985
|
const allFiles = await getFilesRelative(rootWorkingDirectory, venvExcludes);
|
|
211918
211986
|
for (const file of allFiles) {
|
|
211919
211987
|
const base = basename8(file);
|
|
211920
|
-
const workspaceDir =
|
|
211988
|
+
const workspaceDir = dirname11(file) || ".";
|
|
211921
211989
|
if (base === "pyproject.toml" || base === "setup.py" && await isSetupPySetuptools(join24(rootWorkingDirectory, file))) {
|
|
211922
211990
|
if (!properPythonProjects.includes(workspaceDir)) {
|
|
211923
211991
|
properPythonProjects.push(workspaceDir);
|
|
@@ -227145,7 +227213,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
227145
227213
|
}
|
|
227146
227214
|
|
|
227147
227215
|
// dist/version.js
|
|
227148
|
-
var version2 = "14.12.
|
|
227216
|
+
var version2 = "14.12.21";
|
|
227149
227217
|
|
|
227150
227218
|
// dist/cli-core.js
|
|
227151
227219
|
var { mapValues, omit, partition, pick } = import_lodash15.default;
|
|
@@ -227831,7 +227899,7 @@ async function getGitDataToMetadataIfAvailable(rootWorkingDirectory) {
|
|
|
227831
227899
|
// dist/cli-upgrade-purl.js
|
|
227832
227900
|
import { join as join27, relative as relative17 } from "node:path";
|
|
227833
227901
|
var import_packageurl_js2 = __toESM(require_packageurl_js(), 1);
|
|
227834
|
-
var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET"];
|
|
227902
|
+
var ECOSYSTEMS_WITH_SOCKET_UPGRADES = ["NPM", "MAVEN", "NUGET", "GO"];
|
|
227835
227903
|
async function upgradePurl(path2, upgrades, options, logFile, cliFixRunId) {
|
|
227836
227904
|
if (options.rangeStyle && options.rangeStyle !== "pin") {
|
|
227837
227905
|
throw new Error('Range style must be "pin"');
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|