Skip to content

[Fusion] Fail composition when a field reads protected fields without their authorization requirements - #30

Merged
michaelstaib merged 3 commits into
mst/policy-v2from
mst/auth-transitive-require-check
Oct 6, 2026
Merged

michaelstaib merged 3 commits into
mst/policy-v2from
mst/auth-transitive-require-check

Conversation

@michaelstaib

Copy link
Copy Markdown
Owner

Ticket: hc-fork-2-hdw.4 (Transitive require access check)

Stacked on #29. This PR's diff is against mst/auth-interface-inheritance.

New post-merge rule AuthorizationTransitiveRequirementsRule. It is a hard composition error that blocks data leaking through dependencies (the class of Apollo advisory GHSA-m8jr-fxqx-8xx6).

What counts as a dependency, walked with the FieldSelectionMap parser:

  • @require selections, on fields and on arguments, including nested selections, fragments, choices and object construction.
  • Lookup keys.

How coverage is checked:

The error message names the requiring coordinate, the uncovered dependency, the coordinate it was reached through, and the schema. The new code is documented in composition.md.

Needs a planner ruling (comment 271), which could change behavior. The ticket counts lookup keys as dependencies but excludes @is, and a lookup's key comes from its @is argument. The implementer chose this:

  • Lookup keys are dependencies of every field the lookup's schema serves on the entity.
  • They count only for key fields that another schema also serves.
  • @is selections are not walked as a dependency of the lookup field itself.

The reviewer also flagged a risk. Under the #29 rule, protecting id on one Node type also protects Node.id. Combined with node(id:) @lookup, that may require every field served by any schema with a Node lookup to carry that protection. This was not exercised.

Verified:

  • dotnet build src/All.slnx: 0 errors.
  • Fusion.Composition.Tests: 3624/3624.
  • Fusion.Composition.ApolloFederation.Tests: 240/240.
  • FusionAuthorizationDirectiveTests: 20/20.
  • Nitro CLI Fusion command tests: 1928/1928.

These ran before I rebased onto the docs-only #29 commit 2c04c80. The rebase was clean.

Minor review notes, not fixed:

  • The @is exclusion test passes under either interpretation.
  • There is no passing (covered) test for a @require choice or fragment.
  • Choice expansion inside object selections grows exponentially with the number of choice fields in one map.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from f7de989 to 91ce75b Compare October 6, 2026 04:01
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from 91ce75b to 1e6c958 Compare October 6, 2026 05:29
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from 1e6c958 to 977176e Compare October 6, 2026 17:05
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from 977176e to d6636fc Compare October 6, 2026 17:09
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from d6636fc to e784b21 Compare October 6, 2026 17:10
@michaelstaib
michaelstaib added this pull request to stack #34 October 6, 2026 17:37
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from e784b21 to 97a15be Compare October 6, 2026 17:38
Base automatically changed from mst/auth-interface-inheritance to mst/policy-v2 October 6, 2026 17:38
@michaelstaib
michaelstaib force-pushed the mst/auth-transitive-require-check branch from 97a15be to 521a00a Compare October 6, 2026 17:38
@michaelstaib
michaelstaib merged commit 3220244 into mst/policy-v2 Oct 6, 2026
1 check passed
@michaelstaib
michaelstaib deleted the mst/auth-transitive-require-check branch October 6, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants