Skip to content

DIFC GraphQL filtering drops enclosing PR metadata when all nested reviews are filtered #15974

Done

Description

@lpcox

Problem

A PR Sous Chef run in github/gh-aw-firewall failed because the guarded GitHub CLI proxy returned {"data":null} for a composite GraphQL query after filtering its only nested review. The query also requested PR metadata needed by the caller, but that metadata was discarded along with the inaccessible review.

Observed run: https://github.com/github/gh-aw-firewall/actions/runs/41885328451

Run revision: 7211a1bfe4d43f78041b86c9a4b4974207287cf4

This is an observed failure, not a locally reproduced mcpg regression. The logs establish the filtering/reconstruction sequence below; the precise defect in labeling versus reconstruction still needs investigation.

Versions and configuration

  • MCP Gateway / CLI guard proxy: ghcr.io/github/gh-aw-mcpg:v0.5.0
  • AWF: v0.29.0
  • gh-aw: v1.0.1
  • GitHub-hosted Ubuntu runner; public repository
  • Workflow GitHub tooling: mode: gh-proxy, cli-proxy: true
  • Automatically selected guard policy: {"allow-only":{"repos":"public","min-integrity":"approved"}}

Query

The trusted refresh helper invoked gh api graphql with this query and variables owner=github, name=gh-aw-firewall, number=11089:

query($owner:String!,$name:String!,$number:Int!){
  repository(owner:$owner,name:$name){pullRequest(number:$number){
    number state isDraft headRefOid headRefName baseRefName headRepository{nameWithOwner} mergeable mergeStateStatus
    createdAt updatedAt author{login}
    labels(first:100){pageInfo{hasNextPage} nodes{name}}
    commits(last:1){pageInfo{hasNextPage} nodes{commit{committedDate}}}
    reviewThreads(first:100){pageInfo{hasNextPage} nodes{id isResolved
      comments(first:100){pageInfo{hasNextPage} nodes{author{login} authorAssociation body createdAt updatedAt url}}}}
    reviews(first:100){pageInfo{hasNextPage} nodes{author{login} authorAssociation state submittedAt commit{oid}}}
  }}
}

Source at the run revision: https://github.com/github/gh-aw-firewall/blob/7211a1bfe4d43f78041b86c9a4b4974207287cf4/scripts/ci/pr-sous-chef.cjs#L234-L256

Observed evidence

At approximately 2026-11-04T18:18:48–18:18:50Z, the downloaded mcp-logs/proxy.log records:

matched GraphQL → tool=pull_request_read owner=github repo=gh-aw-firewall
Guard fields already present for tool=pull_request_read, skipping injection
forwardAndReadBody: POST /api/graphql -> status=200 bodyLen=929
extractRawItems: navigating to items at path=/data/repository/pullRequest/reviews/nodes
extractRawItems: found 1 items at path=/data/repository/pullRequest/reviews/nodes
Creating labeled resource: pr:github/gh-aw-firewall#unknown
Integrity CheckFlow denied: source missing required tags=[approved:public]
Collection filtered: accessible=0, filtered=1, total=1
DIFC filtered 1/1 items for POST /api/graphql (tool=pull_request_read)
[DIFC] GraphQL response: 1/1 items filtered, reconstructing response
rebuildGraphQLResponse: all items filtered out, returning null data
JSON response body size: 13 bytes

The guard also logs a collaborator-permission lookup for copilot-pull-request-reviewer returning permission="none". Whether that review is correctly excluded is separate from the enclosing-response preservation issue.

The AWF CLI proxy access log confirms the same command completed with exitCode: 0, stdoutBytes: 13, and no stderr. The response was {"data":null} rather than the expected data.repository.pullRequest object.

Impact

The prefilter outside the agent sandbox had successfully queued PR github/gh-aw-firewall#11089. Its mandatory in-sandbox refresh then failed the PR metadata validation with:

Incomplete PR #11089 metadata

The agent emitted report_incomplete and posted no comment. All preceding jobs, including the agent process, writer validation, and safe outputs, completed successfully; the conclusion job intentionally marked the workflow failed because of that incomplete signal.

Failure step: https://github.com/github/gh-aw-firewall/actions/runs/41885328451/job/126771358719

Expected behavior / investigation

Filtering inaccessible entries from a nested review connection should not by itself discard independently authorized enclosing PR metadata or unrelated authorized fields. Preserve the GraphQL response shape and apply filtering at the appropriate path, subject to the enclosing resource's own access decision. If the enclosing PR is independently denied, that denial should remain enforced.

Please investigate the composite-query path selection, resource identity (#unknown in this run), path-label handling, and response reconstruction. The evidence suggests the nested review collection is being treated as the entire query result.

Add a regression fixture with an authorized PR and a nested review that fails the configured integrity requirement. Assert that the review remains inaccessible while independently authorized PR metadata is retained. Cover both all-reviews-filtered and partially-filtered cases, and ensure independently denied parent resources remain blocked.

Do not address this by weakening the integrity policy, bypassing the proxy, or treating missing metadata as a successful no-op.

Activity

  1. added a commit that references this issue on Nov 5, 2026
    d855b1e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions