Skip to content

Fix @babel/traverse vulnerability (CVE-2023-45133) - #2

Merged
patrickwang1990 merged 5 commits into
mainfrom
semgrep-autofix/1779145167
Jun 8, 2026
Merged

Fix @babel/traverse vulnerability (CVE-2023-45133)#2
patrickwang1990 merged 5 commits into
mainfrom
semgrep-autofix/1779145167

Conversation

@semgrep-code-octanelending

Copy link
Copy Markdown

Upgrade @babel/traverse to fix arbitrary code execution vulnerability during Babel compilation.

Changes

  • Added overrides section to package.json to force @babel/traverse to version ^7.23.2
  • This override applies to all transitive dependencies that pull in @babel/traverse (@babel/core, @babel/helpers, @babel/helper-module-transforms)

Why

The vulnerable version (7.18.13) allows arbitrary code execution when compiling untrusted code with Babel plugins that use path.evaluate() or path.evaluateTruthy() methods. The override ensures that regardless of which package pulls in @babel/traverse, the patched version 7.23.2+ is always used. After running npm install, the lock file will be regenerated with the secure version.

Semgrep Finding Details

Affected versions of @babel/traverse and babel-traverse are vulnerable to Incomplete List of Disallowed Inputs / Incorrect Comparison. Compiling untrusted code with Babel using plugins that invoke the internal path.evaluate() or path.evaluateTruthy() methods (for example @babel/plugin-transform-runtime, @babel/preset-env with useBuiltIns, or any polyfill‐provider plugin) allows a maliciously crafted AST to execute arbitrary code on the build machine during compilation.

Semgrep generated this Autofix PR for this finding from the detection rule ssc-17eda294-146f-4ed3-91f7-5ef1b349d687.


⚠️ Review carefully before merging. This PR was generated by AI and may cause breaking changes or introduce new vulnerabilities.

Upgrade @babel/traverse to fix arbitrary code execution vulnerability during Babel compilation.

## Changes
- Added `overrides` section to package.json to force `@babel/traverse` to version `^7.23.2`
- This override applies to all transitive dependencies that pull in @babel/traverse (@babel/core, @babel/helpers, @babel/helper-module-transforms)

## Why
The vulnerable version (7.18.13) allows arbitrary code execution when compiling untrusted code with Babel plugins that use `path.evaluate()` or `path.evaluateTruthy()` methods. The override ensures that regardless of which package pulls in @babel/traverse, the patched version 7.23.2+ is always used. After running `npm install`, the lock file will be regenerated with the secure version.

## Semgrep Finding Details
Affected versions of @babel/traverse and babel-traverse are vulnerable to Incomplete List of Disallowed Inputs / Incorrect Comparison. Compiling untrusted code with Babel using plugins that invoke the internal path.evaluate() or path.evaluateTruthy() methods (for example @babel/plugin-transform-runtime, @babel/preset-env with useBuiltIns, or any polyfill‐provider plugin) allows a maliciously crafted AST to execute arbitrary code on the build machine during compilation.

Semgrep generated this Autofix PR for [this finding](https://semgrep.dev/orgs/octane_lending_poc/supply-chain/findings/683929575) from the detection rule [ssc-17eda294-146f-4ed3-91f7-5ef1b349d687](https://semgrep.dev/orgs/-/supply-chain/advisories?q=ssc-17eda294-146f-4ed3-91f7-5ef1b349d687).
Semgrep autofix added the overrides section to package.json but didn't
run npm install, leaving the lock file with the vulnerable @babel/traverse
@7.18.13 and many mismatched transitive deps, causing npm ci to fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@patrickwang1990
patrickwang1990 marked this pull request as ready for review June 8, 2026 16:48
patrickwang1990 and others added 3 commits June 8, 2026 12:55
Previous lock file was generated without npm auth, producing incorrect
resolved URLs and integrity hashes. Clean reinstall with auth produces
a valid lock file that npm ci can consume.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previous lock files pointed to octanelending.jfrog.io (local npm config),
causing E401 in CI which has no JFrog credentials. Regenerated using
--registry=https://registry.npmjs.org to match main branch convention.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@patrickwang1990 patrickwang1990 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@patrickwang1990
patrickwang1990 merged commit 6285a8f into main Jun 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant