[Security] Add command safety check to execCommand#7462
Conversation
Ensure that execCommand validates that the binary is not located in the current working directory, preventing PATH hijacking. Added security-focused comments and unit tests.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
WHY are these changes introduced?
execCommandwas missing a security check that other command execution utilities in@shopify/cli-kithad. Specifically, it didn't verify if the binary was located in the current working directory, which could lead to PATH hijacking vulnerabilities.WHAT is this pull request doing?
execCommandinpackages/cli-kit/src/public/node/system.tsto callcheckCommandSafety.parseCommandto extract the binary name from the command string.packages/cli-kit/src/public/node/system.test.tsto verify the fix.checkCommandSafety.How to test your changes?
Run the unit tests for
cli-kit:pnpm --filter @shopify/cli-kit vitest run src/public/node/system.test.tsChecklist
pnpm changeset addPR created automatically by Jules for task 8108638445474048430 started by @gonzaloriestra