[Aikido] Fix 4 security issues in nx, yargs - #1746
Open
aikido-autofix[bot] wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade Nx and Yargs to fix critical path traversal RCE in tarball extraction, command injection in git operations, CORS bypass exposing workspace metadata, and prototype pollution in config merging. This update includes breaking changes that require manual migration.
1. Removed deprecated
getJestProjectsfunction (21.0.0)Where your code is affected:
jest.config.ts:1- The root Jest configuration imports and usesgetJestProjects()from@nx/jestImpact: The
getJestProjects()function has been removed in nx 21.0.0. This will cause the Jest configuration to fail when trying to import this function, breaking all test execution across the workspace.Remediation: Replace
getJestProjects()with the new approach. In nx 21+, Jest projects are automatically discovered through the nx plugins configuration innx.json, so you can remove thegetJestProjects()call and use a simpler configuration or rely on the plugin-based discovery.Note on Node.js version compatibility:
While both nx 21.0.0 and yargs 18.0.0 require Node.js >= 20.19.0, this codebase is already using Node.js v24.15.0 (as specified in
.nvmrc), so the Node.js version requirement is already satisfied and poses no risk.Note on yargs:
Although yargs is pinned to version 18.1.0 in the resolutions, it's not directly imported or used in the codebase - it's only a transitive dependency through nx/jest. The yargs upgrade breaking changes (ESM-first, singleton removal, command name derivation) do not affect this codebase since there's no direct usage of yargs.
All breaking changes by upgrading nx from version 20.8.4 to 22.7.8 (CHANGELOG)
cliproperty from migration definitionsreadWorkspaceConfiggetJestProjectstsConfigoption from the@nx/jest:jestexecutortsConfigandcopyFilesoptions from the@nx/cypress:cypressexecutoruseLegacyVersioningis false by default in release configurationNX_DISABLE_DBenvironment variable has been removed.tscandswcexecutors (theexternalandexternalBuildTargetsoptions are no longer available).decorate-cliscript has been removed.nx formatcommand and generators no longer default to sorting TypeScript path mappings (use--sort-root-tsconfig-pathsflag or setNX_FORMAT_SORT_TSCONFIG_PATHS=trueto keep previous behavior).deleteOutputPathandsassImplementationoptions have been removed from webpack executors.deleteOutputPathandsassImplementationoptions have been removed from rspack executors.useLegacyTypescriptPluginhas changed tofalsefor bundling.simpleNameoption has been removed from library generators.--legacy-peer-depsbehavior is no longer forced by default (configure your package manager if needed).preserveMatchingDependencyRanges(nowtrueby default), andstrictPreidin release configuration.updateDependentsoption now defaults toalwaysinstead ofautoin release configuration.releaseTag*properties have been refactored to a nestedreleaseTagobject.init()onVersionActionshas changed (no longer accepts a second argument; validation now occurs via separatevalidate()method).nx affectedbehavior, which may result in more projects receiving version bumps.config.conventionalCommitsConfigforDefaultChangelogRendereris no longer nullable.componentTestingPreset.reportsDirectoryis now resolved against workspace root instead of project root, which may change the output location for Vitest reports (#34720)All breaking changes by upgrading yargs from version 17.7.2 to 18.1.0 (CHANGELOG)
command.^20.19.0 || ^22.12.0 || >=23.✅ 4 CVEs resolved by this upgrade
This PR will resolve the following CVEs:
nx graphHTTP server used a wildcard CORS header allowing malicious webpages to read sensitive workspace data including project structure and dependencies. Additionally, the Nx daemon auto-installed packages without verifying npm provenance, risking execution of tampered packages.nx affected,nx graph,nx format,nx release, andnx import.__proto__keys, potentially enabling arbitrary property manipulation and code execution.🤖 Remediation details
Fix security vulnerabilities in
nxandyargsShort summary
This PR remediates security vulnerabilities in two packages:
nxandyargs.nxwas updated as a direct devDependency in the rootpackage.json, along with all co-versioned@nx/*sibling packages.yargsis a transitive dependency with no viable parent-bump path to a patched version, so aresolutionsentry was added to the rootpackage.jsonto force the safe version. Theyarn.locklockfile was refreshed to reflect all changes.nx
nxwas declared as an exact-version direct devDependency (20.8.4) in the rootpackage.json, placing it squarely in the vulnerable ranges for three advisories. It was bumped to22.7.8— the minimum version satisfying all three patched-version specs — by editing the manifest directly. All seven co-versioned@nx/*packages (@nx/esbuild,@nx/eslint,@nx/eslint-plugin,@nx/jest,@nx/js,@nx/node,@nx/workspace) were updated to22.7.8in the same pass to preserve the aligned versioning the project already maintained across the NX plugin family.yargs
yargsis a transitive dependency pulled in via two paths:nx → yargsandjest → jest-cli → yargs. Analysis confirmed that no published version ofjest-cli(through the latest30.4.2) orjestresolvesyargsto18.x— every release continues to declareyargs@^17.x. Because no parent-bump path exists to reach the patched version (18.1.0), aresolutionsentry ("yargs": "18.1.0") was added to the rootpackage.jsonas a last resort, which is the only mechanism available to force the safe version across all transitive consumers.Version changes
nx20.8.422.7.8@nx/esbuild20.8.422.7.8nxparent bump@nx/eslint20.8.422.7.8nxparent bump@nx/eslint-plugin20.8.422.7.8nxparent bump@nx/jest20.8.422.7.8nxparent bump@nx/js20.8.422.7.8nxparent bump@nx/node20.8.422.7.8nxparent bump@nx/workspace20.8.422.7.8nxparent bumpyargs17.7.218.1.0