Skip to content

Conversation

@Morgy93
Copy link
Contributor

@Morgy93 Morgy93 commented Dec 27, 2025

This pull request refactors how DDEV commands are executed in the DdevUtils class to improve consistency, reliability, and security. The main change is the introduction of a centralized execDdev method that wraps commands in a bash shell, disables XDEBUG, and properly escapes single quotes. All direct usages of execSync for DDEV commands are replaced with this wrapper, and the corresponding tests are updated to verify the new behavior and edge cases.

Refactoring command execution:

  • All direct execSync calls for DDEV commands in DdevUtils methods are replaced with the new execDdev wrapper, ensuring consistent command execution and proper escaping. [1] [2] [3]

  • The execDdev method now wraps commands in bash -c 'XDEBUG_MODE=off ...' and escapes single quotes to prevent shell injection issues.

Testing improvements:

  • Unit tests for DdevUtils are updated to verify that the new wrapper is used, including checks for proper command formatting and escaping. [1] [2] [3] [4]

  • Error handling in tests is improved to simulate realistic error scenarios and verify that user-facing error messages are accurate and informative.

@Morgy93 Morgy93 merged commit ee70fb2 into main Dec 27, 2025
6 checks passed
@Morgy93 Morgy93 deleted the task/fix-xdebug branch December 27, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants