Fix shell injection in SSH key generation via email input#16
Draft
Fix shell injection in SSH key generation via email input#16
Conversation
Co-authored-by: ChangeHow <23733347+ChangeHow@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Address feedback on migrating suitup to modular Node CLI
Fix shell injection in SSH key generation via email input
Mar 11, 2026
ChangeHow
reviewed
Mar 11, 2026
| }, | ||
| }); | ||
|
|
||
| if (p.isCancel(email)) return; |
Owner
There was a problem hiding this comment.
@copilot if you not use email variable bebind, you might need to remove it? also check the test cases that refer to the variable.
Author
There was a problem hiding this comment.
The email variable is still used — it's passed as the value of SSH_KEYGEN_EMAIL in the env object on line 46: { env: { ...process.env, SSH_KEYGEN_EMAIL: email, ... } }. The isCancel(email) guard on line 30 is also still needed to handle user cancellation. The tests likewise correctly reference email through the env assertions (e.g. expect.objectContaining({ SSH_KEYGEN_EMAIL: "test@example.com" })). Nothing needs to be removed.
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.
User-supplied email was interpolated directly into the
ssh-keygenshell command string, allowing shell metacharacters (;,$(...), backticks) to execute arbitrary commands. The passphrase was already handled safely via env var — email wasn't.Changes
src/steps/ssh.js: Pass email throughSSH_KEYGEN_EMAILenv variable instead of interpolating into the command stringtests/ssh.test.js: Updated existing assertions to verify email appears in env rather than the command string; added a dedicated injection prevention test using a malicious email value (evil@example.com; echo "injected")✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.