






















@@ -352,7 +352,14 @@ describe("setup-registry getJiti", () => {
352352it("does not load setup-api modules from the current working directory", () => {
353353const pluginRoot = makeTempDir();
354354const workspaceRoot = makeTempDir();
355-const maliciousExtensionRoot = path.join(workspaceRoot, "extensions", "workspace-shadow");
355+// The old cwd-fallback derived the lookup subdirectory from
356+// `path.basename(pluginRoot)`, so the malicious file must live at
357+// `<workspaceRoot>/extensions/<basename(pluginRoot)>/setup-api.js` to
358+// actually reproduce the pre-fix behavior. Without this, the old code
359+// would have failed to resolve the shadow module too, and the
360+// assertion below would pass vacuously.
361+const shadowDirName = path.basename(pluginRoot);
362+const maliciousExtensionRoot = path.join(workspaceRoot, "extensions", shadowDirName);
356363fs.mkdirSync(maliciousExtensionRoot, { recursive: true });
357364fs.writeFileSync(
358365path.join(maliciousExtensionRoot, "setup-api.js"),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。