-
Notifications
You must be signed in to change notification settings - Fork 4
fix: change gcloud orb region and zone cmds #247
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,10 @@ commands: | |
| default: "" | ||
| description: The Google project ID to connect with via the gcloud CLI. | ||
| type: string | ||
| region: | ||
| default: "" | ||
| description: The Google region to use via the gcloud CLI. | ||
| type: string | ||
| zone: | ||
| default: "" | ||
| description: The Google zone to use via the gcloud CLI. | ||
|
|
@@ -37,10 +41,14 @@ commands: | |
| condition: <<parameters.project>> | ||
| steps: | ||
| - run: gcloud --quiet config set project "<<parameters.project>>" | ||
| - when: | ||
| condition: <<parameters.region>> | ||
| steps: | ||
| - run: gcloud --quiet config set compute/region "<<parameters.region>>" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is vulnerable to command injection. The - run:
name: set compute/region
command: gcloud --quiet config set compute/region "$REGION"
environment:
REGION: <<parameters.region>>References
|
||
| - when: | ||
| condition: <<parameters.zone>> | ||
| steps: | ||
| - run: gcloud --quiet config set zone "<<parameters.zone>>" | ||
| - run: gcloud --quiet config set compute/zone "<<parameters.zone>>" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Impact: An attacker could execute arbitrary commands in the CI/CD environment, potentially leading to the theft of sensitive credentials (like the GCP service key), modification of build artifacts, or unauthorized deployments. Remediation: Use environment variables to pass parameter values to shell commands. This prevents the shell from interpreting the parameter value as part of the command structure. - run:
name: set compute/zone
command: gcloud --quiet config set compute/zone "$ZONE"
environment:
ZONE: <<parameters.zone>> |
||
|
|
||
| configure-docker: | ||
| description: > | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of the
regionparameter is a great improvement. However, please note that the existing jobs in this orb (such asdeploy-cloud-functionanddeploy-gke) do not currently expose aregionparameter or pass it to thisauthcommand. Furthermore, even the existingzoneparameter is not passed toauthin those jobs. To make these features fully functional for users of those jobs, they should be updated to accept and pass these parameters to theauthcommand.