Fix cache poisoning code scanning alerts in Python integration workflows - #11863
Conversation
Remove the workflow_dispatch trigger from python-integration.yml and external-integration.yml. Both workflows check out untrusted PR code and use caching; the workflow_dispatch trigger runs on the default branch and therefore has write access to the default-branch cache scope, which CodeQL flags as a cache poisoning risk (actions/cache-poisoning/poisonable-step). Restricting these workflows to the pull_request trigger scopes their cache to the PR branch, matching the 'Correct Usage' example in the CodeQL rule, and resolves all 36 open alerts. The azure-rest-api-specs job keeps its label-based (int:azure-specs) manual trigger. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are minimal, YAML-valid, and directly eliminate the write-capable workflow_dispatch trigger that CodeQL flags for cache poisoning risk.
Pull request overview
This PR removes workflow_dispatch from two GitHub Actions workflows to address CodeQL actions/cache-poisoning/poisonable-step alerts caused by combining untrusted PR code checkout with cache writes in a default-branch privileged trigger context.
Changes:
- Removed
workflow_dispatchtrigger frompython-integration.yml. - Removed
workflow_dispatchtrigger fromexternal-integration.yml. - Simplified the
azure-rest-api-specsjob condition by dropping the now-deadworkflow_dispatchdisjunct.
File summaries
| File | Description |
|---|---|
| .github/workflows/python-integration.yml | Removes the manual dispatch trigger so cache writes only occur under pull_request scope. |
| .github/workflows/external-integration.yml | Removes the manual dispatch trigger and updates a job-level if: condition accordingly. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
No changes needing a change description found. |
There was a problem hiding this comment.
🟢 Approval recommended
The workflow changes are minimal, YAML remains valid, and all workflow_dispatch references were cleanly removed to address the stated CodeQL alert root cause.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
You can try these changes here
|
Summary
Resolves the 36 open code scanning alerts of rule
actions/cache-poisoning/poisonable-step(Cache Poisoning via execution of untrusted code):.github/workflows/python-integration.yml(thehttp-client-pythonemitter CI).github/workflows/external-integration.ymlRoot cause
Both workflows check out untrusted PR code (they update the
coresubmodule / checkout togithub.event.pull_request.head.sha) and then run steps that use caching. Each also declared aworkflow_dispatchtrigger. Becauseworkflow_dispatchruns in the context of the default branch, it has write access to the default-branch cache scope. CodeQL flags this combination as a cache-poisoning risk: a run could write poisoned entries into a cache that privileged default-branch workflows later restore.Every flagged instance in the alerts is attributed to the
workflow_dispatchtrigger.Fix
Remove the
workflow_dispatchtrigger from both workflows so they run only onpull_request. Underpull_request, the cache is scoped to the PR branch rather than the default branch, which is exactly the "Correct Usage" pattern in the CodeQL rule's guidance.python-integration.yml: droppedworkflow_dispatch:.external-integration.yml: droppedworkflow_dispatch:, and removed the now-dead|| github.event_name == 'workflow_dispatch'disjunct from theazure-rest-api-specsjob condition. That job remains manually triggerable via the existingint:azure-specsPR label.Impact
azure-rest-api-specsjob retains its label-based manual path.