Skip to content

Potential fix for code scanning alert no. 15: Shell command built from environment values#37

Open
Tanker187 wants to merge 58 commits intomainfrom
alert-autofix-15
Open

Potential fix for code scanning alert no. 15: Shell command built from environment values#37
Tanker187 wants to merge 58 commits intomainfrom
alert-autofix-15

Conversation

@Tanker187
Copy link
Owner

Potential fix for https://github.com/Tanker187/vite/security/code-scanning/15

In general, this type of issue is fixed by avoiding shell interpretation of dynamically constructed commands: instead of building a single command string, call the executable directly and pass arguments as an array. For execa/execaCommand, this means using execa with shell: false (the default) and giving the program and its arguments separately. This prevents spaces or metacharacters in viteBinPath or other arguments from altering the command structure.

Concretely here, we should:

  • Replace the string-based buildCommand and serverCommand with argument arrays.
  • Use execa instead of execaCommand so that the first parameter is the executable (here viteBinPath) and the second is the array of CLI arguments.
  • Keep viteBinPath unchanged; only change how it is invoked.
  • Adjust error messages that currently print "${buildCommand}" / "${serverCommand}" to use a safe, readable representation of the command (for example, by joining [viteBinPath, ...args] with spaces for logging only).

These changes are all confined to playground/cli-module/__tests__/serve.ts. We need to:

  • Add an execa import without removing execaCommand if it’s still referenced elsewhere in the file (outside the shown snippet we cannot touch).
  • Update the build section to call execa(viteBinPath, ['build'], ...).
  • Update the server section to call execa(viteBinPath, viteServerArgs, ...).
  • Update the logging in the catch block and in the close helper to reflect the new representation.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

Tanker187 and others added 30 commits December 12, 2025 17:26
This workflow runs tests and publishes a Node.js package to GitHub Packages upon release creation.
This workflow installs Deno, runs linting, and executes tests on push and pull request events to the main branch.
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…m environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…in path expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…in path expression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ing or encoding

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ripting

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Tanker187 and others added 26 commits February 11, 2026 01:48
Potential fix for code scanning alert no. 6: Missing rate limiting
Potential fix for code scanning alert no. 1: Workflow does not contain permissions
Potential fix for code scanning alert no. 12: Shell command built from environment values
…ression

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Potential fix for code scanning alert no. 52: Inefficient regular expression
Create npm-publish-github-packages.yml
Create google-cloudrun-source.yml
Create google-cloudrun-docker.yml
Potential fix for code scanning alert no. 32: Bad HTML filtering regexp
Potential fix for code scanning alert no. 28: Uncontrolled data used in path expression
Potential fix for code scanning alert no. 30: Uncontrolled data used in path expression
Potential fix for code scanning alert no. 34: Incomplete string escaping or encoding
Potential fix for code scanning alert no. 4: Incorrect suffix check
Potential fix for code scanning alert no. 51: Inefficient regular expression
Potential fix for code scanning alert no. 5: Missing rate limiting
Potential fix for code scanning alert no. 16: Reflected cross-site scripting
…m environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Repository owner locked and limited conversation to collaborators Feb 11, 2026
@Tanker187 Tanker187 self-assigned this Feb 11, 2026
@Tanker187 Tanker187 marked this pull request as ready for review February 11, 2026 15:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant