Skip to content

Commit 7e58df0

Browse files
release: on branch version-2.11 (#3324)
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to version-2.11, this PR will be updated. # Releases ## @apollo/composition@2.11.4 ### Patch Changes - Automatically propagate authorization requirements from implementing type to interface in the supergraph. ([#3325](#3325)) Authorization requirements now automatically propagate from implementing types to interfaces during composition. Direct auth specifications on interfaces are no longer allowed. Interface access requires satisfying ALL implementing types' requirements (`AND` rule), with these requirements included in the supergraph for backward compatibility with older routers. - Fix transitive auth requirements on `@requires` and `@fromcontext` ([#3325](#3325)) 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 } ``` - Restrict usage of auth directives on interfaces ([#3325](#3325)) Restricts usage of `@authenticated`, `@policy` and `@requiresScopes` from being applied on interfaces, interface objects and their fields. GraphQL spec currently does not define any interface inheritance rules and developers have to explicitly redefine all interface fields on their implementations. At runtime, GraphQL servers cannot return abstract types and always return concrete output types. Due to the above, applying auth directives on the interfaces may lead to unexpected runtime behavior as they won't have any effect at runtime. - Stricter merge rules for @requiresScopes and @Policy ([#3325](#3325)) Current merge policies for `@authenticated`, `@requiresScopes` and `@policy` were inconsistent. If a shared field uses the same authorization directives across subgraphs, composition merges them using `OR` logic. However, if a shared field uses different authorization directives across subgraphs composition merges them using `AND` logic. This simplified schema evolution, but weakened security requirements. Therefore, the behavior has been changed to always apply `AND` logic to authorization directives applied to the same field across subgraphs. Since `@policy` and `@requiresScopes` values represent boolean conditions in Disjunctive Normal Form, we can merge them conjunctively to get the final auth requirements. For example: ```graphql # subgraph A type T @authenticated { # requires scopes (A1 AND A2) OR A3 secret: String @requiresScopes(scopes: [["A1", "A2"], ["A3"]]) } # subgraph B type T { # requires scopes B1 OR B2 secret: String @requiresScopes(scopes: [["B1"], ["B2"]] } # composed supergraph type T @authenticated { secret: String @requiresScopes( scopes: [ ["A1", "A2", "B1"], ["A1", "A2", "B2"], ["A3", "B1"], ["A3", "B2"] ]) } ``` This algorithm also deduplicates redundant requirements, e.g. ```graphql # subgraph A type T { # requires A1 AND A2 scopes to access secret: String @requiresScopes(scopes: [["A1", "A2"]]) } # subgraph B type T { # requires only A1 scope to access secret: String @requiresScopes(scopes: [["A1"]]) } # composed supergraph type T { # requires only A1 scope to access as A2 is redundant secret: String @requiresScopes(scopes: [["A1"]]) } ``` - Updated dependencies \[[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](d221ac0), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](7730c03), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](4bda3a4), [`f3ab499eaf62b1a1c0f08b838d2cbde5accb303a`](f3ab499), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](6adbf7e), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](2a20dc3)]: - @apollo/federation-internals@2.11.4 - @apollo/query-graphs@2.11.4 ## @apollo/gateway@2.11.4 ### Patch Changes - Updated dependencies \[[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](d221ac0), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](7730c03), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](4bda3a4), [`f3ab499eaf62b1a1c0f08b838d2cbde5accb303a`](f3ab499), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](6adbf7e), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](2a20dc3)]: - @apollo/composition@2.11.4 - @apollo/federation-internals@2.11.4 - @apollo/query-planner@2.11.4 ## @apollo/federation-internals@2.11.4 ### Patch Changes - Automatically propagate authorization requirements from implementing type to interface in the supergraph. ([#3325](#3325)) Authorization requirements now automatically propagate from implementing types to interfaces during composition. Direct auth specifications on interfaces are no longer allowed. Interface access requires satisfying ALL implementing types' requirements (`AND` rule), with these requirements included in the supergraph for backward compatibility with older routers. - Fix transitive auth requirements on `@requires` and `@fromcontext` ([#3325](#3325)) 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 } ``` - Fixed demand control validations ([#3314](#3314)) Updated `@cost`/`@listSize` validations to use correct federation spec to look them up in the schema. - Restrict usage of auth directives on interfaces ([#3325](#3325)) Restricts usage of `@authenticated`, `@policy` and `@requiresScopes` from being applied on interfaces, interface objects and their fields. GraphQL spec currently does not define any interface inheritance rules and developers have to explicitly redefine all interface fields on their implementations. At runtime, GraphQL servers cannot return abstract types and always return concrete output types. Due to the above, applying auth directives on the interfaces may lead to unexpected runtime behavior as they won't have any effect at runtime. - Stricter merge rules for @requiresScopes and @Policy ([#3325](#3325)) Current merge policies for `@authenticated`, `@requiresScopes` and `@policy` were inconsistent. If a shared field uses the same authorization directives across subgraphs, composition merges them using `OR` logic. However, if a shared field uses different authorization directives across subgraphs composition merges them using `AND` logic. This simplified schema evolution, but weakened security requirements. Therefore, the behavior has been changed to always apply `AND` logic to authorization directives applied to the same field across subgraphs. Since `@policy` and `@requiresScopes` values represent boolean conditions in Disjunctive Normal Form, we can merge them conjunctively to get the final auth requirements. For example: ```graphql # subgraph A type T @authenticated { # requires scopes (A1 AND A2) OR A3 secret: String @requiresScopes(scopes: [["A1", "A2"], ["A3"]]) } # subgraph B type T { # requires scopes B1 OR B2 secret: String @requiresScopes(scopes: [["B1"], ["B2"]] } # composed supergraph type T @authenticated { secret: String @requiresScopes( scopes: [ ["A1", "A2", "B1"], ["A1", "A2", "B2"], ["A3", "B1"], ["A3", "B2"] ]) } ``` This algorithm also deduplicates redundant requirements, e.g. ```graphql # subgraph A type T { # requires A1 AND A2 scopes to access secret: String @requiresScopes(scopes: [["A1", "A2"]]) } # subgraph B type T { # requires only A1 scope to access secret: String @requiresScopes(scopes: [["A1"]]) } # composed supergraph type T { # requires only A1 scope to access as A2 is redundant secret: String @requiresScopes(scopes: [["A1"]]) } ``` ## @apollo/query-graphs@2.11.4 ### Patch Changes - Fixes a bug where query planning may unexpectedly error due to attempting to generate a plan where a `@shareable` mutation field is called more than once across multiple subgraphs. ([#3304](#3304)) ([#3304](#3304)) - Updated dependencies \[[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](d221ac0), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](7730c03), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](4bda3a4), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](6adbf7e), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](2a20dc3)]: - @apollo/federation-internals@2.11.4 ## @apollo/query-planner@2.11.4 ### Patch Changes - Fixes a bug where query planning may unexpectedly error due to attempting to generate a plan where a `@shareable` mutation field is called more than once across multiple subgraphs. ([#3304](#3304)) ([#3304](#3304)) - Updated dependencies \[[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](d221ac0), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](7730c03), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](4bda3a4), [`f3ab499eaf62b1a1c0f08b838d2cbde5accb303a`](f3ab499), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](6adbf7e), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](2a20dc3)]: - @apollo/federation-internals@2.11.4 - @apollo/query-graphs@2.11.4 ## @apollo/subgraph@2.11.4 ### Patch Changes - Updated dependencies \[[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](d221ac0), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](7730c03), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](4bda3a4), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](6adbf7e), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](2a20dc3)]: - @apollo/federation-internals@2.11.4 ## apollo-federation-integration-testsuite@2.11.4 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent cad08d0 commit 7e58df0

File tree

21 files changed

+251
-144
lines changed

21 files changed

+251
-144
lines changed

.changeset/chilled-baboons-whisper.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

.changeset/eleven-maps-look.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

.changeset/lemon-toes-sort.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/many-rings-glow.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/rotten-trainers-taste.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.changeset/tasty-snails-invent.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

composition-js/CHANGELOG.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,96 @@
11
# CHANGELOG for `@apollo/composition`
22

3+
## 2.11.4
4+
5+
### Patch Changes
6+
7+
- Automatically propagate authorization requirements from implementing type to interface in the supergraph. ([#3325](https://github.com/apollographql/federation/pull/3325))
8+
9+
Authorization requirements now automatically propagate from implementing types to interfaces during composition. Direct auth specifications on interfaces are no longer allowed. Interface access requires satisfying ALL implementing types' requirements (`AND` rule), with these requirements included in the supergraph for backward compatibility with older routers.
10+
11+
- Fix transitive auth requirements on `@requires` and `@fromcontext` ([#3325](https://github.com/apollographql/federation/pull/3325))
12+
13+
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.
14+
15+
```graphql
16+
type T @key(fields: "id") {
17+
id: ID!
18+
extra: String @external
19+
# we need explicit `@authenticated` as it is needed to access extra
20+
requiresExtra: String @requires(fields: "extra") @authenticated
21+
}
22+
23+
type T @key(fields: "id") {
24+
id: ID!
25+
extra: String @authenticated
26+
}
27+
```
28+
29+
- Restrict usage of auth directives on interfaces ([#3325](https://github.com/apollographql/federation/pull/3325))
30+
31+
Restricts usage of `@authenticated`, `@policy` and `@requiresScopes` from being applied on interfaces, interface objects and their fields.
32+
33+
GraphQL spec currently does not define any interface inheritance rules and developers have to explicitly redefine all interface fields on their implementations. At runtime, GraphQL servers cannot return abstract types and always return concrete output types. Due to the above, applying auth directives on the interfaces may lead to unexpected runtime behavior as they won't have any effect at runtime.
34+
35+
- Stricter merge rules for @requiresScopes and @policy ([#3325](https://github.com/apollographql/federation/pull/3325))
36+
37+
Current merge policies for `@authenticated`, `@requiresScopes` and `@policy` were inconsistent.
38+
39+
If a shared field uses the same authorization directives across subgraphs, composition merges them using `OR` logic. However, if a shared field uses different authorization directives across subgraphs composition merges them using `AND` logic. This simplified schema evolution, but weakened security requirements. Therefore, the behavior has been changed to always apply `AND` logic to authorization directives applied to the same field across subgraphs.
40+
41+
Since `@policy` and `@requiresScopes` values represent boolean conditions in Disjunctive Normal Form, we can merge them conjunctively to get the final auth requirements. For example:
42+
43+
```graphql
44+
# subgraph A
45+
type T @authenticated {
46+
# requires scopes (A1 AND A2) OR A3
47+
secret: String @requiresScopes(scopes: [["A1", "A2"], ["A3"]])
48+
}
49+
50+
# subgraph B
51+
type T {
52+
# requires scopes B1 OR B2
53+
secret: String @requiresScopes(scopes: [["B1"], ["B2"]]
54+
}
55+
56+
# composed supergraph
57+
type T @authenticated {
58+
secret: String @requiresScopes(
59+
scopes: [
60+
["A1", "A2", "B1"],
61+
["A1", "A2", "B2"],
62+
["A3", "B1"],
63+
["A3", "B2"]
64+
])
65+
}
66+
```
67+
68+
This algorithm also deduplicates redundant requirements, e.g.
69+
70+
```graphql
71+
# subgraph A
72+
type T {
73+
# requires A1 AND A2 scopes to access
74+
secret: String @requiresScopes(scopes: [["A1", "A2"]])
75+
}
76+
77+
# subgraph B
78+
type T {
79+
# requires only A1 scope to access
80+
secret: String @requiresScopes(scopes: [["A1"]])
81+
}
82+
83+
# composed supergraph
84+
type T {
85+
# requires only A1 scope to access as A2 is redundant
86+
secret: String @requiresScopes(scopes: [["A1"]])
87+
}
88+
```
89+
90+
- Updated dependencies [[`d221ac04c3ee00a3c7a671d9d56e2cfa36943b49`](https://github.com/apollographql/federation/commit/d221ac04c3ee00a3c7a671d9d56e2cfa36943b49), [`7730c03e128be6754b9e40c086d5cb5c4685ac66`](https://github.com/apollographql/federation/commit/7730c03e128be6754b9e40c086d5cb5c4685ac66), [`4bda3a498eba36e187dfd9ae673eca12d3f3502c`](https://github.com/apollographql/federation/commit/4bda3a498eba36e187dfd9ae673eca12d3f3502c), [`f3ab499eaf62b1a1c0f08b838d2cbde5accb303a`](https://github.com/apollographql/federation/commit/f3ab499eaf62b1a1c0f08b838d2cbde5accb303a), [`6adbf7e86927de969aedab665b6a3a8dbf3a6095`](https://github.com/apollographql/federation/commit/6adbf7e86927de969aedab665b6a3a8dbf3a6095), [`2a20dc38dfc40e0b618d5cc826f18a19ddb91aff`](https://github.com/apollographql/federation/commit/2a20dc38dfc40e0b618d5cc826f18a19ddb91aff)]:
91+
- @apollo/federation-internals@2.11.4
92+
- @apollo/query-graphs@2.11.4
93+
394
## 2.11.3
495

596
### Patch Changes

composition-js/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apollo/composition",
3-
"version": "2.11.3",
3+
"version": "2.11.4",
44
"description": "Apollo Federation composition utilities",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
@@ -27,8 +27,8 @@
2727
"access": "public"
2828
},
2929
"dependencies": {
30-
"@apollo/federation-internals": "2.11.3",
31-
"@apollo/query-graphs": "2.11.3"
30+
"@apollo/federation-internals": "2.11.4",
31+
"@apollo/query-graphs": "2.11.4"
3232
},
3333
"peerDependencies": {
3434
"graphql": "^16.5.0"

federation-integration-testsuite-js/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CHANGELOG for `federation-integration-testsuite-js`
22

3+
## 2.11.4
4+
35
## 2.11.3
46

57
## 2.11.2

federation-integration-testsuite-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "apollo-federation-integration-testsuite",
33
"private": true,
4-
"version": "2.11.3",
4+
"version": "2.11.4",
55
"description": "Apollo Federation Integrations / Test Fixtures",
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)