Repository navigation
ci: fix artifact-injection RCE in workflow_run privileged consumer - #48
Merged
GirishKadirisani merged 1 commit intoSep 22, 2026
Merged
Conversation
Hasibur Rahman Mohammed (hasiburr-qti)
requested review from
NaveenCherukuri (CherukuriNaveenQC) and
GirishKadirisani
as code owners
September 22, 2026 10:10
Hasibur Rahman Mohammed (hasiburr-qti)
force-pushed
the
fix-workflow-rce-vulnerability
branch
from
September 22, 2026 10:17
71b1a2f to
ac62ee1
Compare
…nsumer
The IMSDK_UAT_Compilation_PR workflow was vulnerable to remote code
execution via artifact injection (same class of issue reported against
qimsdk, validated by AppSec as High Risk).
Attack path (now closed):
- An attacker forks the repo and injects a malicious build script
- The fork's pull_request triggers the producer, which uploads a
pr-context artifact containing the fork's HEAD SHA
- The privileged consumer (workflow_run, has secrets) downloaded that
artifact, trusted the SHA from it, checked out the fork commit, and
ran the build script with S3_WEBAPP_TOKEN injected as an env var
Fixes applied:
1. Fork gate with PRODUCTION environment approval
Two new mutually-exclusive gate jobs replace the single unguarded
init condition:
- approve-fork: fork PRs pause here; a PRODUCTION environment
reviewer must inspect and approve before any privileged work runs
- approve-internal: same-repo PRs proceed immediately
2. Stop trusting the artifact SHA
pr-sha output now reads from github.event.workflow_run.head_sha
(set by GitHub, not by the artifact). The artifact now carries
only the PR number, which is harmless.
3. Fix template-injection findings (zizmor)
- approve-fork echo: value moved to env: block, referenced as
${HEAD_REPO} in the shell body — never via ${{ }} in run:
- Report pending status: replaced "${{ steps.pr.outputs.sha }}"
string literal with context.payload.workflow_run.head_sha
- Report final status: pr-sha and build result moved to env: vars
and read via process.env inside the script body
4. Suppress dangerous-triggers warning (zizmor)
Added inline # zizmor: ignore[dangerous-triggers] annotation on
the on: line. A block comment above documents the three mitigations
that make this specific use of workflow_run safe.
5. Guard report-status against spurious runs
Added needs.init.result != 'skipped' so no empty-SHA status API
calls are made when the consumer correctly skips non-PR or
fork-denied events.
The PRODUCTION environment must have required reviewers configured.
Maintainers should inspect the fork diff before approving.
Signed-off-by: Hasibur Rahman Mohammed <hasiburr@qti.qualcomm.com>
Hasibur Rahman Mohammed (hasiburr-qti)
force-pushed
the
fix-workflow-rce-vulnerability
branch
from
September 22, 2026 10:21
ac62ee1 to
66124fb
Compare
Hasibur Rahman Mohammed (hasiburr-qti)
deleted the
fix-workflow-rce-vulnerability
branch
September 22, 2026 11:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security fix — High Risk (AppSec)
This PR closes the artifact-injection RCE reported against the
IMSDK_UAT_Compilation_PRworkflow. The same vulnerability class was independently identified across qimsdk, camera-service, and gst-plugins-imsdk.Attack path (now closed)
ci/build.shpull_requestevent triggersIMSDK_UAT_Compilation(the producer), which uploads apr-contextartifact containing the fork's HEAD SHAworkflow_run, secrets available) downloaded that artifact, trusted the SHA from it, checked out the fork commit, and ranci/build.shwithS3_WEBAPP_TOKENinjected as an environment variableFixes applied
1. Fork gate with PRODUCTION environment approval
Two mutually exclusive gate jobs now precede all privileged work:
approve-fork: fork PRs pause here; a PRODUCTION-environment reviewer must inspect the fork diff and approve beforeinitrunsapprove-internal: same-repo PRs proceed immediately (no approval required)2. Stop trusting the artifact SHA
pr-shaoutput now reads fromgithub.event.workflow_run.head_sha— set by GitHub, not by the artifact. The artifact now carries only the PR number, which is harmless even if tampered.3. Fix template-injection findings (zizmor)
approve-forkecho: HEAD_REPO passed viaenv:, referenced as${HEAD_REPO}in the shell bodycontext.payload.workflow_run.head_sha(parsed event object) instead of a${{ }}string literalenv:block and read viaprocess.envinside the script body4. Suppress dangerous-triggers warning
Added inline
# zizmor: ignore[dangerous-triggers]on theon:line (zizmor requires the annotation on the same line as the finding). A block comment above the trigger documents all three active mitigations.5. Guard report-status against spurious runs
Added
needs.init.result != 'skipped'so no empty-SHA status API calls occur when the consumer correctly skips non-PR or fork-denied events.Required follow-up actions (repo maintainers)
PRODUCTIONenvironment in repo Settings → Environments with required reviewers (the maintainers who should vet fork diffs)S3_WEBAPP_TOKEN— treat it as compromised if any fork PRs ran against the old workflowQUALCOMM_LINUX_PAT— same reason🤖 Generated with Claude Code