fix(ci): use GraphQL variables for fork-sourced report content#40973
Conversation
…erpolation The Publish Test Results workflow runs on workflow_run with checks: write, pull-requests: write, statuses: write. It merges blob reports produced by fork PR runs (untrusted) and posts a markdown comment back via the GraphQL API. The report text was interpolated directly into a """...""" block string inside the addComment mutation, so a fork could craft report content containing """ to escape the block string and inject arbitrary mutations in the privileged context. Switch the three call sites in ghaMarkdownReporter.ts (collapse query, minimize mutations, addComment) to parameterized GraphQL with $variables, which routes user input through octokit's typed variable channel and removes the injection surface entirely. Related: MSRC 117222
Test results for "MCP"7181 passed, 1113 skipped Merge workflow run. |
Test results for "tests 1"129 failed 4 flaky43778 passed, 861 skipped Merge workflow run. |
Summary
ghaMarkdownReporterposts the merged blob-report markdown back to the PR via a GraphQL mutation. The report body was interpolated into a"""..."""block string, so untrusted content (the report from a fork PR) could close the block and inject arbitrary GraphQL.$variablesso octokit routes user input through the typed variable channel.