Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(cli): detect Windows Yarn global installs in update notices (#1692)

wj47ad7aa59835
diff --git a/sdk/typescript/src/version.ts b/sdk/typescript/src/version.ts
index fa4d4ce5c..16451e264 100644
--- a/sdk/typescript/src/version.ts
+++ b/sdk/typescript/src/version.ts
@@ -53,7 +53,8 @@ export function updateCommand(
path.includes("/pnpm/global/") ||
path.includes("/.bun/install/global/") ||
path.includes("/.yarn/global/") ||
- path.includes("/yarn/global/");
+ path.includes("/yarn/global/") ||
+ path.includes("/yarn/data/global/");
if (agent.startsWith("pnpm/") || path.includes("/.pnpm/")) {
return `pnpm add${global ? " -g" : ""} ${PACKAGE_NAME}@latest`;
@@ -61,7 +62,8 @@ export function updateCommand(
if (
agent.startsWith("yarn/") ||
path.includes("/.yarn/") ||
- path.includes("/yarn/global/")
+ path.includes("/yarn/global/") ||
+ path.includes("/yarn/data/global/")
) {
return `yarn${global ? " global" : ""} add ${PACKAGE_NAME}@latest`;
}
diff --git a/sdk/typescript/tests-ts/update-notice.test.ts b/sdk/typescript/tests-ts/update-notice.test.ts
index f526c7f4f..c4c0e1b1c 100644
--- a/sdk/typescript/tests-ts/update-notice.test.ts
+++ b/sdk/typescript/tests-ts/update-notice.test.ts
@@ -103,6 +103,11 @@ describe("CLI update notice", () => {
],
[{}, "/.yarn/global/pkg", `yarn global add ${packageName}`],
[{}, "/.config/yarn/global/pkg", `yarn global add ${packageName}`],
+ [
+ {},
+ "C:\\AppData\\Local\\Yarn\\Data\\global\\node_modules\\pkg",
+ `yarn global add ${packageName}`,
+ ],
[
{ npm_config_user_agent: "bun/1.3.0" },
installed,