Skip to content

Refactor builddrivers.py for safety and error handling#1552

Merged
jahnvi480 merged 6 commits intomicrosoft:devfrom
SajanGhimire1:patch-2
Feb 10, 2026
Merged

Refactor builddrivers.py for safety and error handling#1552
jahnvi480 merged 6 commits intomicrosoft:devfrom
SajanGhimire1:patch-2

Conversation

@SajanGhimire1
Copy link
Contributor

  • Replace all os.system() calls with safe alternatives to prevent command injection
  • Fix bare except: clause that could catch KeyboardInterrupt and SystemExit
  • Add path sanitization to prevent shell injection attacks
  • Fix PHP version validation with proper regex instead of flawed string comparison
  • Replace hardcoded backslashes with os.sep for cross-platform compatibility
  • Add proper error handling for os.chdir() operations
  • Fix variable reference bugs (self.repo vs repo, self.branch vs branch)
  • Prevent infinite loops in get_local_source() with proper empty path validation
  • Add comprehensive source folder validation before copying
  • Improve error messages and log file display on build failure
  • Fix interactive mode input validation and retry logic

- Replace all os.system() calls with safe alternatives to prevent command injection
- Fix bare except: clause that could catch KeyboardInterrupt and SystemExit
- Add path sanitization to prevent shell injection attacks
- Fix PHP version validation with proper regex instead of flawed string comparison
- Replace hardcoded backslashes with os.sep for cross-platform compatibility
- Add proper error handling for os.chdir() operations
- Fix variable reference bugs (self.repo vs repo, self.branch vs branch)
- Prevent infinite loops in get_local_source() with proper empty path validation
- Add comprehensive source folder validation before copying
- Improve error messages and log file display on build failure
- Fix interactive mode input validation and retry logic
@jahnvi480
Copy link
Contributor

@SajanGhimire1 Thanks for raising the PR for this fix, I would like you to please resolve the conflicts in this PR since now we will also be supporting PHP8.4 there are few changes in build script.
Please fix the issue post which I can review and run the Pipeline on your branch.

@SajanGhimire1
Copy link
Contributor Author

@SajanGhimire1 Thanks for raising the PR for this fix, I would like you to please resolve the conflicts in this PR since now we will also be supporting PHP8.4 there are few changes in build script. Please fix the issue post which I can review and run the Pipeline on your branch.

Hi @jahnvi480,
I’ve updated the buildtools.py script with the required changes for PHP 8.4 support and resolved the conflicts. The script now includes input validation, safe command execution, proper removal of old builds, & updated debug/build flags.

@jahnvi480
Copy link
Contributor

@SajanGhimire1 I still see there are 3 conflicts in this file, can you please check.

SajanGhimire1 and others added 5 commits January 20, 2026 07:39
Updated shebang to use env for portability and corrected import path for BuildUtil.
Add root directory setting for build scripts based on OS
Simplified root directory assignment for builds.
@jahnvi480
Copy link
Contributor

jahnvi480 commented Feb 10, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@microsoft microsoft deleted a comment from azure-pipelines bot Feb 10, 2026
@jahnvi480 jahnvi480 merged commit dfa5dfb into microsoft:dev Feb 10, 2026
5 checks passed
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.

3 participants