Skip to content

Harden review-trigger workflow: consistency and cost improvements #35431

Closed

Description

@PureWeen

Follow-up from PR #35250 review

Three low-priority hardening items identified during adversarial code review of the review-trigger workflow.

1. ⚠️ Move github.actor / github.repository to env: vars

File: .github/workflows/review-trigger.yml lines 53-54, 148, 178

${{ github.actor }} and ${{ github.repository }} are interpolated directly in shell via ${{ }}. The PR correctly hardened inputs.pr_number and comment body via env:, but missed these. Not exploitable today (GitHub usernames are [a-zA-Z0-9-]), but inconsistent with the hardening pattern.

Fix: Pass via env: block:

env:
  ACTOR: ${{ github.actor }}
  REPO: ${{ github.repository }}
run: |
  PERMISSION=$(gh api "repos/${REPO}/collaborators/${ACTOR}/permission" --jq .permission)

2. 💡 Combine OIDC + AzDO token exchange into single step

File: .github/workflows/review-trigger.yml lines 201-261

OIDC and AzDO tokens are masked but persisted to $GITHUB_OUTPUT between steps. Since the OIDC token is only needed to get the AzDO token, and the AzDO token is only needed to trigger the pipeline, all three operations could be combined into a single step — avoiding intermediate token storage.

3. ⚠️ Runner provisioned before permission check

File: .github/workflows/review-trigger.yml lines 33-59

The job-level if: checks comment body but not actor permission. Any user who comments /review spins up a runner before the permission step rejects them. Low individual cost but could be abused at scale.

Possible fix: Move permission check to a lightweight pre-job, or exit with exit 0 (not exit 1) on unauthorized users to avoid noisy failed runs.


Identified via multi-model adversarial code review (3 independent reviewers with consensus validation).

Activity

  1. added a commit that references this issue on Aug 5, 2026
    8266dc2
  2. added this to the .NET 10 SR10 milestone on Aug 5, 2026
  3. locked and limited conversation to collaborators on Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    s/triagedIssue has been reviewed

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions