Skip to content

Harden input and output restrictions for test-quarantine workflow - #68074

Merged
wtgodbe merged 2 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/harden-test-quarantine-security
Jul 28, 2026
Merged

wtgodbe merged 2 commits into
dotnet:mainfrom
wtgodbe:wtgodbe/harden-test-quarantine-security

Conversation

@wtgodbe

@wtgodbe wtgodbe commented Jul 28, 2026 •

Copy link
Copy Markdown
Member
  • Don't rely on contributor comments when skipping previously rejected quarantine candidates - this could allow for prompt injection. Instead, rely on the new no-quarantine-for-30-days label.
  • Add allowed-files: ["src/**/*.cs"] to  create-pull-request. Explicitly restricts workflow from touching sensitive files like .yml workflows/pipelines
  • Threat detection made blocking (continue-on-error: false)

Copilot AI review requested due to automatic review settings July 28, 2026 23:15
@wtgodbe
wtgodbe requested a review from a team as a code owner July 28, 2026 23:15

Copilot AI left a comment

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.

Pull request overview

This PR tightens the test-quarantine agentic workflow’s trust boundaries by replacing comment-text-based “do not (un)quarantine” signaling with mechanically privileged signals (bot-PR closure by a non-bot human, or application of a maintainer-only label) and by hardening safe-outputs restrictions.

Changes:

  • Switches prior-attempt cutoff logic to rely on (1) privileged closure of bot-authored PRs and (2) no-quarantine-for-30-days label presence + timestamp, avoiding comment body ingestion.
  • Adds a Safe Outputs allowlist restricting PR patches to src/**/*.cs, and makes threat-detection fail closed.
  • Updates generated workflow lock artifacts and the gh-aw action pin.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/test-quarantine.md Updates the skill/workflow logic and instructions to use privileged signals + label-based suppression, and tightens safe-outputs policies.
.github/workflows/test-quarantine.lock.yml Regenerates the compiled workflow lock to reflect the updated skill/policy and newer gh-aw runtime/tooling.
.github/aw/actions-lock.json Updates pinned gh-aw setup action version used by agentic workflows.
Comments suppressed due to low confidence (2)

.github/workflows/test-quarantine.md:273

  • The labeled-PR search query is missing is:unmerged, so merged PRs that still have the no-quarantine-for-30-days label could be included. That can incorrectly set trusted_closed/cutoffs based on successful merged PRs (not prior rejections) and suppress future automation unexpectedly.
        labeled_prs = search_prs(
            f'repo:dotnet/aspnetcore is:pr author:{BOT_AUTHOR} '
            f'"test-quarantine" in:title label:{NO_QUARANTINE_LABEL}'
        )

.github/workflows/test-quarantine.lock.yml:3191

  • The labeled-PR search query does not include is:unmerged, so merged PRs with the label could be pulled into the injected data and incorrectly influence cutoffs/suppression decisions. Add is:unmerged to keep this scoped to still-open or closed-but-unmerged workflow PRs.
          labeled_prs = search_prs(
              f'repo:dotnet/aspnetcore is:pr author:{BOT_AUTHOR} '
              f'"test-quarantine" in:title label:{NO_QUARANTINE_LABEL}'
          )

Comment thread .github/workflows/test-quarantine.md Resolved
Merged PRs represent a successful outcome, not a rejected attempt, so
their close event must not seed trusted_closed/closed_at. label_added_at
still applies regardless of merge state.

Co-authored-by: Copilot <[email protected]>

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (4)

.github/workflows/test-quarantine.lock.yml:3132

  • Same issue as the source workflow: the Python step builds an Authorization header value of "******" instead of sending the actual GH_TOKEN. This will break the API calls used to compute cutoffs/suppression windows.
          token = os.environ["GH_TOKEN"]
          headers = {"Authorization": f"******", "Accept": "application/vnd.github+json"}
          since = (datetime.now(timezone.utc) - timedelta(days=30)).strftime("%Y-%m-%d")

.github/workflows/test-quarantine.md:205

  • The GitHub REST calls in this step will be unauthenticated because the Authorization header is set to a literal "******". That will cause /search/issues and /issues/{n}/events requests to fail (401/403 or severe rate limiting), preventing the workflow from fetching the cutoff/suppression signals.
        token = os.environ["GH_TOKEN"]
        headers = {"Authorization": f"******", "Accept": "application/vnd.github+json"}
        since = (datetime.now(timezone.utc) - timedelta(days=30)).strftime("%Y-%m-%d")

.github/workflows/test-quarantine.md:273

  • The labeled-PR search query has no time bounding, so it can pull in very old PRs that still carry the label, then call /issues/{n}/events for each one. Since the suppression window is only 30 days, adding an updated:>=<since> qualifier should preserve correctness (labeling updates the PR) while reducing API calls and output size.
        labeled_prs = search_prs(
            f'repo:dotnet/aspnetcore is:pr author:{BOT_AUTHOR} '
            f'"test-quarantine" in:title label:{NO_QUARANTINE_LABEL}'
        )

.github/aw/actions-lock.json:12

  • This lock file now only contains entries for gh-aw-actions/[email protected], but other generated workflows in the repo still reference gh-aw-actions/[email protected] and gh-aw-actions/[email protected] (e.g., .github/workflows/agentics-maintenance.yml). If this file is used as the authoritative lock source for gh-aw workflows, removing those entries will make the lock inconsistent with existing workflows. Either regenerate/update those workflows to v0.83.4 as part of the same change, or keep the older entries until everything is upgraded.
    "github/gh-aw-actions/[email protected]": {
      "repo": "github/gh-aw-actions/setup",
      "version": "v0.83.4",
      "sha": "e89c65e17eb281bbd5ff2ff9e9199a03e96654c7"
    }

@wtgodbe
wtgodbe merged commit b233611 into dotnet:main Jul 28, 2026
10 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Jul 29, 2026
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.

2 participants