[Aikido] Fix 2 security issues in nx, yargs - #1748
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 command injection (RCE) via unsanitized git parameters and prototype pollution vulnerabilities. This update includes breaking changes that require manual migration.
1. Removed deprecated
getJestProjects(nx 21.0.0)Where your code is affected:
jest.config.ts:1- imports and usesgetJestProjectsfrom@nx/jestImpact:
The
getJestProjects()function has been removed in nx 21.0.0. The root Jest configuration file currently relies on this function to automatically discover and configure all Jest projects in the workspace.Remediation:
Replace
getJestProjects()with manual project configuration or use the new Nx Jest plugin configuration approach. You'll need to explicitly list project paths or use glob patterns to define which projects should be included in the Jest configuration.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.✅ 2 CVEs resolved by this upgrade
This PR will resolve the following CVEs:
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 two security advisories affecting
nxandyargs.nxis a direct devDependency in the rootpackage.jsonand was bumped from20.8.4to22.7.8; all sibling@nx/*packages were updated to the same version to preserve alignment.yargsis a transitive dependency pinned exactly bynxand range-constrained byjest-cli; because no parent-chain path allowsyargs@18.x, aresolutionsentry was added to the rootpackage.jsonto force the resolved version to18.1.0. Both the rootpackage.jsonandyarn.lockwere updated.nx
nxis declared as a direct devDependency in the rootpackage.jsonat the exact version20.8.4, which falls within the vulnerable range. It was bumped to22.7.8(the minimum patched version in the22.xline) by editing the manifest and refreshing the lockfile withyarn install --mode=update-lockfile. All seven@nx/*sibling packages (@nx/esbuild,@nx/eslint,@nx/eslint-plugin,@nx/jest,@nx/js,@nx/node,@nx/workspace) were updated to22.7.8at the same time because the project keeps them at matching versions and they are co-versioned withnxin the NX release cycle.yargs
yargsis a transitive dependency pulled in by bothnx(which pins it at the exact version17.7.2) andjest-cli(which requests^17.7.2). The patched version18.1.0is a semver-major bump that neither parent range admits:nxuses an exact pin and no published version ofnxorjest-cliup to their respective latest releases widens that range to allow18.x. With no viable parent-chain path available, aresolutionsentry ("yargs": "18.1.0") was added to the rootpackage.jsonas a last resort, and the lockfile was refreshed to resolve the singleyargsinstance to18.1.0.Version changes
nx20.8.422.7.8@nx/esbuild20.8.422.7.8nxbump@nx/eslint20.8.422.7.8nxbump@nx/eslint-plugin20.8.422.7.8nxbump@nx/jest20.8.422.7.8nxbump@nx/js20.8.422.7.8nxbump@nx/node20.8.422.7.8nxbump@nx/workspace20.8.422.7.8nxbumpyargs17.7.218.1.018.x)