Skip to content

Align direct-file integrity with PR content restrictions - #15654

Merged
lpcox merged 3 commits into
mainfrom
copilot/fix-pr-review-workflow-issue
Oct 28, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/fix-pr-review-workflow-issue

Conversation

Copilot AI commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

PR diffs and file lists are denied at min-integrity: approved, while direct reads of the same head revision could succeed without content endorsement. This change closes that inconsistency without promoting patch trust from PR metadata.

  • Consistent provenance enforcement

    • Share revision-integrity logic across resource, item, and path labels.
    • Assign none to non-empty sha and non-default ref reads; sha takes precedence over ref.
    • Preserve existing default-branch behavior.
  • Explicit review boundary

    • Document that arbitrary PR patch review at approved remains unsupported without revision-bound endorsement.
    • Distinguish retaining approved and reporting incomplete coverage from explicitly accepting untrusted input in an isolated reviewer.
  • Regression coverage

    • Cover SHA/ref precedence, tool aliases, response shapes, and compiled-guard filtering.
    • Verify trusted PR metadata does not authorize diff or file-list content.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PR reviews blocked by diff/file-list integrity labels Align direct-file integrity with PR content restrictions Oct 28, 2026
Copilot AI requested a review from lpcox October 28, 2026 03:09
@lpcox
lpcox marked this pull request as ready for review October 28, 2026 03:44
Copilot AI max review requested due to automatic review settings October 28, 2026 03:44

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.

🟡 Changes recommended

Critical labeling gaps still allow arbitrary revision content to receive approved integrity through resource-bearing responses and proxy paths that discard revision provenance.

4 open issues
What changed in this PR

Centralizes revision-integrity handling in the GitHub guard to align direct-file reads with the PR-content restrictions described in #15653.

Changes:

  • Shares SHA/ref integrity rules across resource, item, and path labels, with SHA taking precedence.
  • Adds regression coverage for revision reads, response shapes, and PR metadata trust boundaries.
  • Documents limitations of reviews at approved integrity and policy options for isolated reviewers.
File Description
internal/​proxy/​pr_content_guard_test.go Adds compiled-guard filtering regressions.
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Applies shared integrity rules to file resources.
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Aligns file path labels and updates expectations.
guards/​github-guard/​rust-guard/​src/​labels/​response_items.rs Applies shared integrity rules to file items.
guards/​github-guard/​rust-guard/​src/​labels/​mod.rs Tests revision consistency and metadata/content separation.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Introduces the shared revision-integrity helper.
guards/​github-guard/​docs/​LABELING.md Explains file and PR-content labeling boundaries.
docs/​CONFIGURATION.md Documents review limitations and explicit policy choices.

Review effort: Max

}
}
match tool_args.get("ref") {
None => merged_integrity(repo_full_name, ctx),
} else {
writer_integrity(&repo_full_name, ctx)
};
let file_integrity = file_content_integrity(tool_args, &repo_full_name, ctx);
Comment on lines +2048 to +2050
Some(Value::String(branch_ref)) if is_default_branch_ref(branch_ref) => {
merged_integrity(repo_full_name, ctx)
}
Some(Value::String(branch_ref)) if is_default_branch_ref(branch_ref) => {
merged_integrity(repo_full_name, ctx)
}
_ => none_integrity(repo_full_name, ctx),
@lpcox

lpcox commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed the review feedback in b4c6bc7.

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.

PR reviews blocked by diff/file-list integrity labels while direct file reads succeed

3 participants