-
Notifications
You must be signed in to change notification settings - Fork 0
(not for commit) Use blacksmith for docker #132
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
base: main
Are you sure you want to change the base?
Conversation
|
This comment ensures that the correct Slack channel is notified after the team/project label See this comment for details. |
|
|
||
| - if: ${{ env.use_deprecated_ssh_var == 'false' }} | ||
| name: Set up SSH | ||
| uses: webfactory/ssh-agent@v0.9.0 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
|
|
||
| - if: ${{ env.use_deprecated_ssh_var == 'true' }} | ||
| name: Set up SSH | ||
| uses: webfactory/ssh-agent@v0.9.0 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
| ${{ inputs.gen-cache-path}} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: useblacksmith/setup-docker-builder@v1 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
| - if: ${{ env.use_workload_identity == 'false' }} | ||
| name: Authenticate with Google Cloud (Service Account Key) | ||
| id: auth | ||
| uses: google-github-actions/auth@v2 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: auth
| if: ${{ env.use_workload_identity == 'false' }} | ||
| run: | | ||
| docker login -u _json_key \ | ||
| --password-stdin ${{ inputs.registry }} < ${{ steps.auth.outputs.credentials_file_path }} |
Check warning
Code scanning / CodeQL
Code injection Medium
${ inputs.registry }
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 4 months ago
To fix this problem, we should avoid direct use of ${{ inputs.registry }} inside the shell script. Instead, declare an environment variable (e.g., REGISTRY) set to ${{ inputs.registry }} in the workflow step, then reference $REGISTRY inside the shell script using native shell syntax (double quotes). This is best-practice for preventing code injection because it removes the risk of parsing user input as shell code. Only edit the affected step(s), leaving other functionality untouched.
Specifically, edit the step at original line 231, modifying its declaration to add the environment variable and reference it natively as $REGISTRY in the script. No additional dependencies or imports are required.
-
Copy modified lines R231-R232 -
Copy modified line R235
| @@ -228,9 +228,11 @@ | ||
|
|
||
| - name: Docker login (Google Crediential file) | ||
| if: ${{ env.use_workload_identity == 'false' }} | ||
| env: | ||
| REGISTRY: ${{ inputs.registry }} | ||
| run: | | ||
| docker login -u _json_key \ | ||
| --password-stdin ${{ inputs.registry }} < ${{ steps.auth.outputs.credentials_file_path }} | ||
| --password-stdin "$REGISTRY" < ${{ steps.auth.outputs.credentials_file_path }} | ||
|
|
||
| # Auth with workload-identity | ||
| # to become defacto |
| - id: auth_with_workload_identity | ||
| name: Authenticate with Google Cloud (Workload Identity) | ||
| if: ${{ env.use_workload_identity == 'true' }} | ||
| uses: google-github-actions/auth@v2 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: auth_with_workload_identity
| workload_identity_provider: ${{ inputs.workload-identity-provider }} | ||
| service_account: ${{ inputs.service-account }} | ||
|
|
||
| - uses: docker/login-action@v3 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step: meta
| ${{ inputs.tag }} | ||
|
|
||
| - name: Build (and push) Docker image | ||
| uses: useblacksmith/build-push-action@v2 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Uses Step
| ssh: default | ||
| # We use Blacksmith's implicit cache | ||
|
|
||
| - uses: remerge/action-slack-deploy-pipeline@v2.0.0-remerge |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
Copy of
dockerwith changes to ease referring to the file (instead hashes in path etc). Either dropped or renamed back todocker.yml.Ticket: https://remerge.atlassian.net/browse/CORE-1502