Skip to content

Commit 99f2da2

Browse files
committed
fix: transitive auth requirements on @requires and @fromcontext
Adds new `postMergeValidation` check to ensure that all fields that depends on data from other parts of the supergraph through `@requires` and/or `@fromContext` directives explicitly specify matching `@authenticated`, `@requiresScopes` and/or `@policy` auth requirements, e.g. ```graphql type T @key(fields: "id") { id: ID! extra: String @external # we need explicit @authenticated as it is needed to access extra requiresExtra: String @requires(fields: "extra") @authenticated } type T @key(fields: "id") { id: ID! extra: String @authenticated } ```
1 parent faea2d1 commit 99f2da2

File tree

6 files changed

+1106
-3
lines changed

6 files changed

+1106
-3
lines changed

.changeset/eleven-maps-look.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
"@apollo/composition": patch
3+
"@apollo/federation-internals": patch
4+
---
5+
6+
Fix transitive auth requirements on `@requires` and `@fromcontext`
7+
8+
Adds new `postMergeValidation` check to ensure that all fields that depends on data from other parts of the supergraph through `@requires` and/or `@fromContext` directives explicitly specify matching `@authenticated`, `@requiresScopes` and/or `@policy` auth requirements, e.g.
9+
10+
```graphql
11+
type T @key(fields: "id") {
12+
id: ID!
13+
extra: String @external
14+
# we need explicit `@authenticated` as it is needed to access extra
15+
requiresExtra: String @requires(fields: "extra") @authenticated
16+
}
17+
18+
type T @key(fields: "id") {
19+
id: ID!
20+
extra: String @authenticated
21+
}
22+
```

0 commit comments

Comments
 (0)