Skip to content

Conversation

@vermakhushboo
Copy link
Contributor

No description provided.

if (empty($commitHash)) {
$commands[] = "if git ls-remote --exit-code --heads origin {$branchName}; then git pull origin {$branchName} && git checkout {$branchName}; else git checkout -b {$branchName}; fi";
} else {
$commands[] = "git pull origin {$commitHash}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to escape every variable that we attach to an execute command to prevent a shell injection:
You can use escapeshellarg like we do with other variables. See more here: https://owasp.org/www-community/attacks/Command_Injection

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.

4 participants