Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added commit hash to git clone command #2

Merged
merged 4 commits into from
Aug 21, 2023
Merged

Conversation

vermakhushboo
Copy link
Member

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.

3 participants