fix: drop cpx and child-process-promise to clear vulnerable transitive deps - #37
Open
varzager wants to merge 1 commit into
Open
fix: drop cpx and child-process-promise to clear vulnerable transitive deps#37varzager wants to merge 1 commit into
varzager wants to merge 1 commit into
Conversation
…e deps Both packages were only used by build/test tooling but pulled vulnerable transitive dependencies into the published package's runtime tree, which Dependabot flags for consumers: - cpx@1 -> chokidar@2 -> micromatch@3 -> braces@1.x/2.x (GHSA-grv7-fg5c-xmjg, no patch on the 1.x/2.x line) - child-process-promise@2 -> cross-spawn@4.0.2 (GHSA-3xgq-45jj-v275) Replace them with Node built-ins so both advisories are resolved at the source with zero new dependencies: - copy-templates: swap `cpx` for scripts/copy-templates.js, a small fs-based recursive copy of src/**/*.template.* into dist/. - generateReadme.ts / tests/driver.ts: swap child-process-promise for the built-in child_process module (util.promisify(exec) and a small spawn->Promise wrapper). - Remove cpx, child-process-promise, and @types/child-process-promise from package.json and regenerate yarn.lock. The only remaining braces/cross-spawn copies now come exclusively from devDependencies (eslint, lint-staged), are already patched (braces@3.0.3, cross-spawn@7.0.3), and are never installed by consumers of the published package. Surfaced by Dependabot in a downstream project consuming this package. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
varzager
force-pushed
the
fix/drop-vulnerable-build-deps
branch
from
July 9, 2026 12:11
807f2be to
95bcc33
Compare
eliranhWix
approved these changes
Jul 9, 2026
eliranhWix
approved these changes
Jul 9, 2026
|
#skipreview |
|
skipreview by eliranhWix is not available in org wix-incubator. |
There was a problem hiding this comment.
Pull request overview
This PR removes two runtime dependencies (cpx and child-process-promise) that are only used for build/test tooling, replacing them with Node.js built-ins to eliminate vulnerable transitive dependencies from the published dependency tree.
Changes:
- Replace
cpxwith a smallfs-based recursive template copy script. - Replace
child-process-promiseusage with built-inchild_process(exec+spawnwrapper). - Remove the unused deps from
package.jsonand regenerateyarn.lock.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/copy-templates.js |
Adds a dependency-free template copier to replace cpx. |
package.json |
Removes cpx / child-process-promise from runtime deps and updates the copy script. |
scripts/generateReadme.ts |
Switches to child_process.exec (promisified) instead of child-process-promise. |
tests/driver.ts |
Replaces child-process-promise spawn with a small Promise-wrapped child_process.spawn. |
.eslintignore |
Excludes the new script file (though lint targets TS/TSX only). |
yarn.lock |
Lockfile update reflecting dependency removals and transitive changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| const SRC_DIR = path.resolve(__dirname, '..', 'src'); | ||
| const DIST_DIR = path.resolve(__dirname, '..', 'dist'); | ||
| const TEMPLATE_RE = /\.template\.[^.]+$/; |
Comment on lines
+24
to
+30
| child.on('close', (code) => { | ||
| if (code === 0) { | ||
| resolve(); | ||
| } else { | ||
| reject(new Error(`${command} exited with code ${code ?? 'null'}`)); | ||
| } | ||
| }); |
Comment on lines
18
to
22
| "dependencies": { | ||
| "@types/flat": "^5.0.2", | ||
| "child-process-promise": "^2.2.1", | ||
| "cosmiconfig": "^7.0.1", | ||
| "cpx": "^1.5.0", | ||
| "flat": "^5.0.2", | ||
| "format-message-parse": "^6.2.4", |
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.
Summary
cpx@1andchild-process-promise@2are listed as runtime dependencies but are only used by build/test tooling. Both drag vulnerable transitive packages into the published tree, which Dependabot flags for consumers:cpx@^1.5.0→chokidar@2→micromatch@3→braces@1.x/2.x— GHSA-grv7-fg5c-xmjg (no patch on the 1.x/2.x line)child-process-promise@^2.2.1→cross-spawn@4.0.2— GHSA-3xgq-45jj-v275This PR removes both and replaces them with Node built-ins, so both advisories are fixed at the source with zero new dependencies.
Changes
copy-templates: replacedcpx 'src/**/*.template.*' dist/withscripts/copy-templates.js— a small, dependency-freefs-based recursive copy that preserves thesrc/-relative structure intodist/.scripts/generateReadme.ts/tests/driver.ts: replacedchild-process-promisewith the built-inchild_processmodule —util.promisify(exec)for the readme script and a tinyspawn→Promisewrapper for the test driver.cpx,child-process-promise, and@types/child-process-promisefrompackage.json; regeneratedyarn.lock.scripts/copy-templates.jsto.eslintignore(the repo'slintscript only targets.ts/.tsx).Result
cpx,child-process-promise,cross-spawn@4, and thechokidar@2 → micromatch@3 → braces@2chain are gone from the tree entirely. The only remainingbraces/cross-spawncopies now come exclusively from devDependencies (eslint,lint-staged), are already patched (braces@3.0.3,cross-spawn@7.0.3), and are never installed by consumers of the published package.Verification
yarn test(clean-generated → generate-for-type-tests → lint → typecheck → build → jest) passes locally: 31/31 tests, 7/7 snapshots, and the build confirms the template is copied todist/proxyEngine/proxyEngine.template.ts.Surfaced by Dependabot in a downstream project consuming this package. Thanks for maintaining this! 🙏
🤖 Generated with Claude Code