Skip to content

fix(runtimes): replace registry-js with native reg query to remove vu…#737

Merged
aseemxs merged 1 commit intoaws:mainfrom
aseemxs:fix/remove-registry-js-ansi-regex-cve
Mar 9, 2026
Merged

fix(runtimes): replace registry-js with native reg query to remove vu…#737
aseemxs merged 1 commit intoaws:mainfrom
aseemxs:fix/remove-registry-js-ansi-regex-cve

Conversation

@aseemxs
Copy link
Contributor

@aseemxs aseemxs commented Feb 21, 2026

Remove registry-js dependency to eliminate transitive ansi-regex@2.1.1 vulnerability (CVE-2021-3807). Replace with direct calls to Windows reg query command, which reads the same registry values without requiring a native addon or its heavy dependency tree.

Problem

registry-js@1.16.1 depends on prebuild-install@^5.3.5npmloggaugestrip-ansiansi-regex@2.1.1 (CVE-2021-3807, CVSS 7.5).

The existing prebuild-install override in the root package.json only works locally — npm overrides do not propagate to downstream consumers. registry-js has not been updated in 2+ years.

This was previously fixed in v0.3.10 (PR #719) but re-introduced in v0.3.12.

Solution

Replace registry-js with the built-in Windows reg query command via child_process.spawnSync. This reads the same registry values (ProxyEnable, ProxyServer, ProxyOverride) without any external dependencies.

Changes:

  • runtimes/runtimes/util/standalone/getProxySettings/getWindowsProxySettings.ts — replaced registry-js import with native spawnSync('reg', ...) calls
  • runtimes/package.json — removed registry-js from dependencies
  • package-lock.json — regenerated (removed 30 packages)

Testing:

  • npm run compile
  • npm run test — 33/33 passing ✅
  • npm run check:formatting
  • npm list registry-js — empty ✅
  • No ansi-regex@2.x in dependency tree ✅
  • CI test-windows job will validate the reg query approach on actual Windows

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@aseemxs aseemxs requested a review from a team as a code owner February 21, 2026 00:24
…lnerable ansi-regex

Remove registry-js dependency to eliminate transitive ansi-regex@2.1.1
vulnerability (CVE-2021-3807). Replace with direct calls to Windows
reg query command, which reads the same registry values without
requiring a native addon or its heavy dependency tree.
@aseemxs aseemxs force-pushed the fix/remove-registry-js-ansi-regex-cve branch from 3275c16 to 884a2ca Compare March 3, 2026 00:29
@aseemxs aseemxs merged commit a92164a into aws:main Mar 9, 2026
4 checks passed
@aseemxs aseemxs deleted the fix/remove-registry-js-ansi-regex-cve branch March 9, 2026 20:46
chungjac pushed a commit that referenced this pull request Mar 9, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>language-server-runtimes: 0.3.15</summary>

##
[0.3.15](language-server-runtimes/v0.3.14...language-server-runtimes/v0.3.15)
(2026-03-09)


### Bug Fixes

* **runtimes:** replace mac-ca with native macOS certificate reading
([#736](#736))
([134d721](134d721))
* **runtimes:** replace registry-js with native reg query to remove vu…
([#737](#737))
([a92164a](a92164a))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants