Skip to content

Fix trusted inputs for /review tests - #37219

Closed
kubaflo wants to merge 18 commits into
mainfrom
copilot/fix-review-tests-trusted-context
Closed

kubaflo wants to merge 18 commits into
mainfrom
copilot/fix-review-tests-trusted-context

Conversation

@kubaflo

@kubaflo kubaflo commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Summary

  • seal the /review tests skill, canonical CI facts, gathered context, and visual merger in a fail-closed root-owned /tmp/review-tests-trusted-${GITHUB_RUN_ID} directory created directly under sticky /tmp before checking out the untrusted PR branch
  • expose the sealed files to the AWF agent only through the fixed read-only /review-tests-trusted mount, while the host visual post-step uses the protected host path and never falls back to PR-controlled workflow instructions
  • add focused Pester guards for source existence and trigger coverage, exact fail-closed sealing commands, pre-existing-path rejection, host and agent path consistency, sealed context paths, and the full read-only mount
  • peel actions/github-script@v9 to the reviewed v9.0.0 commit in the repository action lock, regenerate the gh-aw lock consistently, and document the trust boundary

Investigation

The flagged run was reported as XPIA because the generated prompt said the PR branch was checked out and then told the agent to read .github/skills/review-test-failures/SKILL.md. gh-aw restores .github from the base branch, but that trust transition was implicit and the output threat detector did not consistently recognize it.

I audited 24 /review tests outputs since August 1 across 16 PRs. This was the only threat warning. Five reports had inaccessible AzDO builds because retained build IDs now return HTTP 404; the other 19 gathered inspectable evidence, so that is a separate retention limitation rather than the command regression.

Validation

  • Invoke-Pester .github/scripts/ReviewTestsWorkflow.Tests.ps1 — 9 passed
  • repository-pinned gh-aw v0.86.2: compile copilot-review-tests --strict — 1 workflow compiled, zero warnings
  • verified the generated lock uses one peeled actions/github-script commit and mounts the sealed host directory read-only at /review-tests-trusted
  • git diff --check

An isolated gh-aw trial was blocked before execution because the copilot-pat-pool environment permits only main, net1*.0, and release/* branches.

Seal the review skill, CI facts, and gathered context before checking out untrusted PR content, then direct the agent only to those immutable copies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a2e7a622-045a-4843-8b48-61532a5466d7
Copilot AI lite review requested due to automatic review settings August 8, 2026 22:16
@kubaflo
kubaflo temporarily deployed to copilot-pat-pool August 8, 2026 22:17 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37219

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37219"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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 trust boundary for /review tests by sealing the skill instructions, CI facts, and gathered context into a root-owned directory under /opt/gh-aw-trusted before the untrusted PR branch is checked out, and updates docs/lockfile accordingly.

Changes:

  • Seal the review skill (SKILL.md), canonical CI facts, merge script, and gathered context into /opt/gh-aw-trusted/... prior to PR checkout.
  • Update the activation prompt to instruct the agent to read only the sealed, trusted copies (and treat PR worktree as evidence-only).
  • Regenerate the gh-aw lock file and document the trust boundary in repo docs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/copilot-review-tests.md Seals trusted inputs in /opt/gh-aw-trusted and updates the agent prompt to avoid PR-controlled instructions.
.github/workflows/copilot-review-tests.lock.yml Regenerated lockfile reflecting the updated workflow steps and pinned action SHAs.
.github/docs/pr-review-workflow.md Documents the /review tests trust boundary and sealing behavior.

@kubaflo kubaflo added the area-ai-agents Copilot CLI agents, agent skills, AI-assisted development label Aug 9, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
Copilot AI review requested due to automatic review settings August 10, 2026 15:06
@kubaflo

kubaflo commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@copilot addressed the latest feedback in caf0fa39089: missing sealed context is now an explicit, non-aborting failure-report path, with no PR-controlled fallback. The gh-aw lock was regenerated and validated. This is ready for re-review — thanks!

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.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review outcome

❌ Logic — The sealed /opt/gh-aw-trusted inputs are not mounted into the AWF agent container, so every /review tests invocation follows the setup-failure path instead of analyzing results. 3/3 reviewers agreed after validating the generated mount commands.

What looks right: the trusted sealing step itself runs from the base checkout before the PR branch is checked out, and the previous missing-context control-flow concern is addressed.

Test coverage: No runtime scenario verifies that the sandboxed agent can read the relocated inputs; compile-time lock validation cannot establish that container mount.

Prior feedback: The earlier missing-context comment is resolved in the current head; this is a distinct container-visibility regression.

Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist.

Seal review-test inputs inside the runner-temp gh-aw subtree that the AWF agent container mounts read-only, and keep the post-step and prompt on the same trusted path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
Copilot AI review requested due to automatic review settings August 12, 2026 09:44
@kubaflo

kubaflo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@PureWeen addressed the AWF container-visibility regression in 388380bd159: trusted inputs are now sealed under the read-only ${RUNNER_TEMP}/gh-aw mount used by the agent container, with prompt and post-step references kept in sync. The v0.85.4 lock was regenerated successfully. Ready for re-review.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review\n\n⚠️ Testing — See the inline finding.\n\nWhat looks right: the sealed inputs are created before the PR checkout and mounted read-only at the fixed agent path.\n\nMethod: 3 independent reviewers with adversarial consensus + repository domain specialist.\n\nTest coverage: The added Pester suite covers the core ordering and mount invariants, but its optional-context guard needs the inline strengthening.\n\nPrior review status: Existing feedback was checked and resolved items were not repeated.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
Copilot AI review requested due to automatic review settings August 19, 2026 02:34
@kubaflo

kubaflo commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@PureWeen strengthened the optional-context regression guard in b3b5abe728: each install must remain inside its matching if -f block, and unguarded duplicates are rejected. The focused suite passes 9/9. This is ready for re-review — thanks!

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 6 out of 6 changed files in this pull request and generated no new comments.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review

No actionable findings at b3b5abe72835e5b2fbbb0ae864d104214be2497e.

Independent reviewer consensus: Three independent reviewers reviewed the remote PR snapshot with adversarial reconciliation, plus a MAUI domain specialist. The only disputed cleanup-path concern was rejected by both follow-up reviewers because untrusted code cannot create the proposed path before sealing on this pre-checkout, ephemeral runner flow.

What looks right: Mandatory trusted inputs are sealed before PR checkout, exposed to the agent only through the fixed read-only mount, and verified by a focused Pester regression suite; the generated lock and peeled actions/github-script@v9.0.0 pin are consistent with the source.

Test coverage: The added Pester guard covers mandatory and optional sealed inputs, cleanup, mount mode, generated action pin consistency, and trigger coverage for the workflow inputs it protects.

Prior review status: 23 existing review threads were checked; all are resolved, and their concerns were not duplicated at this head.

Method: 3 independent reviewers with adversarial consensus + repo domain specialist.

Regenerate copilot-review-tests.lock.yml with the current main-pinned gh-aw v0.86.2 compiler in strict mode.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
Copilot AI review requested due to automatic review settings August 20, 2026 16:47
@kubaflo

kubaflo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Resolved the current main conflict with a normal merge commit (27d15c86cd). The only conflict was the generated copilot-review-tests.lock.yml; I restored actions-lock.json from current main and regenerated the lock with the dynamically pinned gh-aw v0.86.2 compiler in strict validation mode. Targeted Pester validation passes (9/9), and GitHub now reports this PR MERGEABLE.

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 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

.github/workflows/copilot-review-tests.md:309

  • The trusted directory is created with sudo mkdir and then permissions are applied in a follow-up chmod. This relies on root’s current umask and introduces an avoidable window where the directory permissions may be more permissive than intended (before the explicit chmod 0755). Since this directory is part of the workflow’s trust boundary, it’s safer to create it with the desired mode atomically (e.g., sudo mkdir -m 0755 -- "${trusted}") and drop the redundant chown/chmod 0755 (root will own it by default). Note: changing this requires regenerating copilot-review-tests.lock.yml and updating the Pester expectations in ReviewTestsWorkflow.Tests.ps1.
      trusted="/tmp/review-tests-trusted-${GITHUB_RUN_ID}"
      test "$(stat -c '%u' /tmp)" = "0"
      test -k /tmp
      sudo mkdir -- "${trusted}"
      sudo chown root:root "${trusted}"
      sudo chmod 0755 "${trusted}"

.github/workflows/copilot-review-tests.lock.yml:3

  • The PR description states validation with “repository-pinned gh-aw v0.85.4”, but this compiled lock file indicates it was generated with gh-aw v0.86.2 (see compiler_version here and the “automatically generated by gh-aw (v0.86.2)” header). Please reconcile the PR description with the actual pinned/used gh-aw version to avoid future confusion when reproducing/regenerating the lock.
# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"dcd4b865804087cbf222f65999fe7282a18961009f696a97d7083c30524961c3","body_hash":"577e074b833b84fc467ea7b8767890debb33e93eb5b0bc589a80fb2d0d684a36","compiler_version":"v0.86.2","strict":true,"agent_id":"copilot","agent_model":"gpt-5.6-sol","engine_versions":{"copilot":"1.0.79"}}
# gh-aw-manifest: {"version":1,"secrets":["COPILOT_PAT_0","COPILOT_PAT_1","COPILOT_PAT_2","COPILOT_PAT_3","COPILOT_PAT_4","COPILOT_PAT_5","COPILOT_PAT_6","COPILOT_PAT_7","COPILOT_PAT_8","COPILOT_PAT_9","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/cache/save","sha":"55cc8345863c7cc4c66a329aec7e433d2d1c52a9","version":"v6.1.0"},{"repo":"actions/checkout","sha":"3d3c42e5aac5ba805825da76410c181273ba90b1","version":"v7.0.1"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"820762786026740c76f36085b0efc47a31fe5020","version":"v7.0.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"},{"repo":"github/gh-aw-actions/setup","sha":"6aab9e5b5c91c615506061f09bedd81a23babe3c","version":"v0.86.2"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44","digest":"sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.44@sha256:0d727725c737b58c7bdf51f640cffb928385ec46517e0917c7f1a02f1bada8b4"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44","digest":"sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.44@sha256:b50fbadba138f6e9aba94aca09711335c489bb3b15861220cb66f6092e042dc7"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44","digest":"sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.44@sha256:83e48bbe12c634be8c228a576832fe45f66c529ac3659db92bddbcf2eeb6d627"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.4.9","digest":"sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.4.9@sha256:e5a1569aeaf41820fa7bdee3e94468cae448133cdbf00119ad24f5b74db1ab9f"},{"image":"ghcr.io/github/gh-aw-node","digest":"sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196","pinned_image":"ghcr.io/github/gh-aw-node@sha256:0d9f1fb5fd6610c0ac1f5194a38e45a8a1e81f8a390d5142d8e4e6f26a4b3196"},{"image":"ghcr.io/github/github-mcp-server:v1.9.0","digest":"sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e","pinned_image":"ghcr.io/github/github-mcp-server:v1.9.0@sha256:881b53d6f75f69bdbc1b5b10fc2f1361717c19054143b3a8529fb5c32061a50e"}]}
# This file was automatically generated by gh-aw (v0.86.2). DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md

Set the root-owned directory mode at creation time, update the trust-boundary regression, and regenerate the gh-aw lock with the current pinned compiler.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
Copilot AI review requested due to automatic review settings August 20, 2026 17:10
@kubaflo

kubaflo commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot-pull-request-reviewer addressed the suppressed review notes in e18e08025b: the trusted directory is now created with mode 0755 atomically, the regression expectations and generated lock are updated, and the PR validation section now reflects gh-aw v0.86.2 plus Pester 9/9. This is ready for re-review — thanks!

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 5 out of 5 changed files in this pull request and generated no new comments.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated adversarial review by an independent reviewer: no actionable issues found.

The review confirmed the sealed inputs are created before untrusted checkout, supplied only through the fixed read-only mount, and have no PR-worktree fallback. The generated lock remains consistent with the source workflow, and the shared action pin resolves consistently for its consumers.

Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist. The specialist’s context-content observation was discarded after two reviewers confirmed the trusted skill already classifies log text as untrusted evidence, the exposure predates this PR, and the workflow’s output is limited to one deterministically capped advisory comment.

Test coverage: the added focused Pester suite exercises the trust-boundary invariants and the PowerShell workflow now triggers for every protected input.

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated adversarial review by an independent reviewer: no actionable issues found at e18e080. The completed assessment confirmed the trusted pre-checkout input seal, fixed read-only mount, generated workflow consistency, and regression coverage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-ai-agents Copilot CLI agents, agent skills, AI-assisted development s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants