Harden serve-client-library Vite plugin: path traversal fix, proper content types, and build error output#3303
Closed
Copilot wants to merge 1 commit intodevex_improvement_using_dynamic_clientfrom
Closed
Conversation
Copilot
AI
changed the title
[WIP] Serve client on 127.0.0.1:5400/client/index.js for dev
Harden Feb 24, 2026
serve-client-library Vite plugin: path traversal fix, proper content types, and build error output
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.
Addresses security and correctness issues in the
serve-client-libraryVite dev plugin introduced for serving@wp-playground/clientat/client/.Changes
req.urlvianew URL()to strip query strings before building the filesystem path, then usepath.relative()+isAbsolute()to assert the resolved path stays withinclientDistDir— returns 403 otherwise.application/javascriptwith an extension map covering.js,.cjs,.json, and.map; falls back toapplication/octet-stream.child_processimport: Replaced the inlinerequire('child_process')call with a top-levelimport { exec } from 'node:child_process', improving type safety and ESM compatibility.execcallback now capturesstderrand forwards it to the Vite logger so build failures surface actionable output instead of a generic message.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.