refactor: migrate all subprocess call sites to the shared subprocess module - #1849
Draft
iankhou wants to merge 4 commits into
Draft
refactor: migrate all subprocess call sites to the shared subprocess module#1849iankhou wants to merge 4 commits into
iankhou wants to merge 4 commits into
Conversation
…tions # Conflicts: # yarn.lock
Contributor
Dependency ReviewThe following issues were found:
License Issuespackages/@aws-cdk/cdk-assets-lib/package.json
packages/@aws-cdk/toolkit-lib/package.json
OpenSSF Scorecard
Scanned Files
|
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.
Note
This re-submits #1758, which was merged and then reverted in #1774 because it wasn't ready yet. The branch has been updated with the latest
main.Summary
Follow-up to #1763, which adds the
@aws-cdk/private-tools/lib/subprocessmodule.This PR migrates every
child_processcall site in the shipped packages onto the shared module, so that no code path both escapes and executes:init/os.ts,init/init.tsspawn(argv, {shell: true})+ broken hand-rolled escapingrun()— no shell,inherit-stderrkeeps npm/pip progress barstelemetry/library-version.tsexec()stringrun()argvec2-detection.tsexecSyncwith2>nulrunSync(), stderr discarded via stdiocloud-assembly/exec.ts(synthapp)spawn(str, {shell: true})+ split2runUserCommandLine(), line-buffered,collect: falsecommands/docs.ts(--browser)exec()runUserCommandLine()shell.tsrun(); spawn failures rethrow the OS error so docker's ENOENT → 'please install docker' guidance is preservedenvironment.tsquoteSpaces()(space-only quoting)quoteShellPart()The deleted
windowsEscapehelpers carried an escaping bug (shellMeta.has(x)instead ofhas(c)) that made Windows escaping a silent no-op — this PR removes the pattern rather than fixing it.grep -rn runUserCommandLinenow returns exactly the two sinks where a shell is the documented contract (synthapp,--browser) — the complete trust-model surface.Drops
split2from toolkit-lib (replaced by the module's line buffering).Not in scope (follow-ups):
cdk-build-tools/integ-runner/cli-integmigration, the eslintno-restricted-importsban onchild_process, and a Windows CI leg for the module.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license