Skip to content

ci: fix template injection warnings#1810

Merged
ricardosalveti merged 1 commit into
qualcomm-linux:masterfrom
anujm1:template
Mar 25, 2026
Merged

ci: fix template injection warnings#1810
ricardosalveti merged 1 commit into
qualcomm-linux:masterfrom
anujm1:template

Conversation

@anujm1
Copy link
Copy Markdown
Contributor

@anujm1 anujm1 commented Mar 25, 2026

The template in delimiters ${{ ... }} is expanded before workflow execution and can, in case of some events, lead to code injection by the user that triggered the event [1][2].

Use an intermediate environment variable that is set to these values to remediate for all instances flagged by zizmor.

[1] https://securitylab.github.com/resources/github-actions-untrusted-input/
[2] https://docs.zizmor.sh/audits/#template-injection

The template in delimiters ${{ ... }} is expanded before workflow
execution and can, in case of some events, lead to code injection by the
user that triggered the event [1][2].

Use an intermediate environment variable that is set to these values to
remediate for all instances flagged by zizmor.

[1] https://securitylab.github.com/resources/github-actions-untrusted-input/
[2] https://docs.zizmor.sh/audits/#template-injection

Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
@anujm1 anujm1 requested review from mwasilew and quaresmajose March 25, 2026 08:25
@anujm1
Copy link
Copy Markdown
Contributor Author

anujm1 commented Mar 25, 2026

I thought I was adding reviewers. It seems I changed them instead :(

Copy link
Copy Markdown
Contributor

@koenkooi koenkooi left a comment

Choose a reason for hiding this comment

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

Huge diff, but it looks good to me.

id: pr_comment_prep
run: |
echo "## Test run [workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" > pr-comment.txt
echo "## Test jobs for commit ${{ github.event.workflow_run.head_sha }}" >> pr-comment.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can head_sha be considered unsecure? It's not mentioned in https://securitylab.github.com/resources/github-actions-untrusted-input/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

May be not with the way this is used here. But, I think there's no disadvantage to replacing it, if this works. We would otherwise need to evaluate and ignore the warning etc.

@ndechesne
Copy link
Copy Markdown
Contributor

do we / can we have zizmor checker integrated in our CI/PR?

@anujm1
Copy link
Copy Markdown
Contributor Author

anujm1 commented Mar 25, 2026

do we / can we have zizmor checker integrated in our CI/PR?

I'm planning to propose it once we fix all the current warnings. I think we are down to 10 now from 100 something.

Copy link
Copy Markdown
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

This looks OK. Let me run it through next just to be sure.

@ndechesne
Copy link
Copy Markdown
Contributor

do we / can we have zizmor checker integrated in our CI/PR?

I'm planning to propose it once we fix all the current warnings. I think we are down to 10 now from 100 something.

thank you, this is nice!

@lumag
Copy link
Copy Markdown
Contributor

lumag commented Mar 25, 2026

do we / can we have zizmor checker integrated in our CI/PR?

I'm planning to propose it once we fix all the current warnings. I think we are down to 10 now from 100 something.

Enable it now, let it fail? At least this way we will see all the failures. Also, there is meta-qcom-distro ;-)

@anujm1
Copy link
Copy Markdown
Contributor Author

anujm1 commented Mar 25, 2026

Enable it now, let it fail? At least this way we will see all the failures. Also, there is meta-qcom-distro ;-)

This should work: #1813

Copy link
Copy Markdown
Contributor

@mwasilew mwasilew left a comment

Choose a reason for hiding this comment

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

All good in next branch:
https://github.com/qualcomm-linux/meta-qcom/actions/runs/23539197060
We can't verify the test-pr workflow, but I'm confident it will work OK.

@ricardosalveti ricardosalveti merged commit a66f95f into qualcomm-linux:master Mar 25, 2026
7 of 39 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.

7 participants