Skip to content

Commit bad5366

Browse files
committed
chore: audit @apollo/server
1 parent 9cd816a commit bad5366

File tree

10 files changed

+416
-21
lines changed

10 files changed

+416
-21
lines changed

.github/workflows/audits.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
name: express-graphql-report
3838
path: README.md
3939

40-
apollo-server:
40+
apollo-server_v4:
4141
runs-on: ubuntu-latest
4242
if: "!contains(github.event.head_commit.message, '[skip ci]')"
4343
env:
@@ -55,13 +55,40 @@ jobs:
5555
- name: Build
5656
run: yarn build:esm
5757
- name: Start
58-
run: yarn workspace apollo-server start &
58+
run: yarn workspace apollo-server_v4 start &
5959
- name: Audit
6060
run: node scripts/audit-implementation.mjs README.md
6161
- name: Upload report
6262
uses: actions/upload-artifact@v3
6363
with:
64-
name: apollo-server-report
64+
name: apollo-server_v4-report
65+
path: README.md
66+
67+
apollo-server_v3:
68+
runs-on: ubuntu-latest
69+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
70+
env:
71+
PORT: 4000
72+
steps:
73+
- name: Checkout
74+
uses: actions/checkout@v3
75+
- name: Set up node
76+
uses: actions/setup-node@v3
77+
with:
78+
node-version: 18
79+
cache: yarn
80+
- name: Install
81+
run: yarn install --immutable
82+
- name: Build
83+
run: yarn build:esm
84+
- name: Start
85+
run: yarn workspace apollo-server_v3 start &
86+
- name: Audit
87+
run: node scripts/audit-implementation.mjs README.md
88+
- name: Upload report
89+
uses: actions/upload-artifact@v3
90+
with:
91+
name: apollo-server_v3-report
6592
path: README.md
6693

6794
mercurius:
@@ -204,7 +231,8 @@ jobs:
204231
needs:
205232
[
206233
express-graphql,
207-
apollo-server,
234+
apollo-server_v4,
235+
apollo-server_v3,
208236
mercurius,
209237
graphql-yoga,
210238
graphql-helix,
@@ -221,11 +249,16 @@ jobs:
221249
with:
222250
name: express-graphql-report
223251
path: implementations/express-graphql
224-
- name: Download apollo-server report
252+
- name: Download apollo-server_v3 report
253+
uses: actions/download-artifact@v3
254+
with:
255+
name: apollo-server_v3-report
256+
path: implementations/apollo-server_v3
257+
- name: Download apollo-server_v4 report
225258
uses: actions/download-artifact@v3
226259
with:
227-
name: apollo-server-report
228-
path: implementations/apollo-server
260+
name: 'apollo-server_v4-report'
261+
path: implementations/apollo-server_v4
229262
- name: Download mercurius report
230263
uses: actions/download-artifact@v3
231264
with:

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -729,12 +729,13 @@ Having said this, graphql-http is mostly aimed for library authors and simple se
729729

730730
If you want a feature-full server with bleeding edge technologies, you're recommended to use one of the following.
731731

732-
| Name | Audit |
733-
| -------------------------------------------------------------- | ------------------------------------------------------------------ |
734-
| [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Fully compliant](/implementations/graphql-yoga/README.md) |
735-
| [apollo-server](https://www.the-guild.dev/graphql/yoga-server) | [✅ Partially compliant](/implementations/apollo-server/README.md) |
736-
| [mercurius](https://mercurius.dev) | [✅ Partially compliant](/implementations/mercurius/README.md) |
737-
| [graphql-helix](https://www.graphql-helix.com/) | [✅ Partially compliant](/implementations/graphql-helix/README.md) |
732+
| Name | Audit |
733+
| ----------------------------------------------------------------------- | --------------------------------------------------------------------- |
734+
| [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Fully compliant](/implementations/graphql-yoga/README.md) |
735+
| [apollo-server_v3](https://www.apollographql.com/docs/apollo-server/v3) | [✅ Partially compliant](/implementations/apollo-server_v3/README.md) |
736+
| [mercurius](https://mercurius.dev) | [✅ Partially compliant](/implementations/mercurius/README.md) |
737+
| [graphql-helix](https://www.graphql-helix.com/) | [✅ Partially compliant](/implementations/graphql-helix/README.md) |
738+
| [apollo-server_v4](https://www.apollographql.com/docs/apollo-server/) | [⚠️ Not compliant](/implementations/apollo-server_v4/README.md) |
738739

739740
## [Documentation](docs/)
740741

File renamed without changes.

implementations/apollo-server/package.json renamed to implementations/apollo-server_v3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"name": "apollo-server",
3+
"name": "apollo-server_v3",
44
"packageManager": "[email protected]",
55
"main": "index.mjs",
66
"scripts": {
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
_* This report was auto-generated by graphql-http_
2+
3+
# GraphQL over HTTP audit report
4+
5+
- **73** audits in total
6+
-**44** pass
7+
- ⚠️ **29** warnings (optional)
8+
9+
## Passing
10+
1. MUST accept application/json and match the content-type
11+
2. MUST use utf-8 encoding when responding
12+
3. MUST accept utf-8 encoding
13+
4. MUST assume utf-8 if encoding is unspecified
14+
5. MUST accept POST requests
15+
6. MAY accept application/x-www-form-urlencoded formatted GET requests
16+
7. MUST NOT allow executing mutations on GET requests
17+
8. SHOULD respond with 4xx status code if content-type is not supplied on POST requests
18+
9. MUST accept application/json POST requests
19+
10. MUST require a request body on POST
20+
11. SHOULD use 400 status code on missing {query} parameter when accepting application/graphql-response+json
21+
12. SHOULD use 400 status code on object {query} parameter when accepting application/graphql-response+json
22+
13. SHOULD use 400 status code on number {query} parameter when accepting application/graphql-response+json
23+
14. SHOULD use 400 status code on boolean {query} parameter when accepting application/graphql-response+json
24+
15. SHOULD use 400 status code on array {query} parameter when accepting application/graphql-response+json
25+
16. SHOULD allow string {query} parameter when accepting application/graphql-response+json
26+
17. MUST allow string {query} parameter when accepting application/json
27+
18. SHOULD use 400 status code on object {operationName} parameter when accepting application/graphql-response+json
28+
19. SHOULD use 400 status code on number {operationName} parameter when accepting application/graphql-response+json
29+
20. SHOULD use 400 status code on boolean {operationName} parameter when accepting application/graphql-response+json
30+
21. SHOULD use 400 status code on array {operationName} parameter when accepting application/graphql-response+json
31+
22. SHOULD allow string {operationName} parameter when accepting application/graphql-response+json
32+
23. MUST allow string {operationName} parameter when accepting application/json
33+
24. SHOULD use 400 status code on string {variables} parameter when accepting application/graphql-response+json
34+
25. SHOULD use 400 status code on number {variables} parameter when accepting application/graphql-response+json
35+
26. SHOULD use 400 status code on boolean {variables} parameter when accepting application/graphql-response+json
36+
27. SHOULD allow map {variables} parameter when accepting application/graphql-response+json
37+
28. MUST allow map {variables} parameter when accepting application/json
38+
29. SHOULD allow URL-encoded JSON string {variables} parameter in GETs when accepting application/graphql-response+json
39+
30. MUST allow URL-encoded JSON string {variables} parameter in GETs when accepting application/json
40+
31. SHOULD use 400 status code on string {extensions} parameter when accepting application/graphql-response+json
41+
32. SHOULD allow map {extensions} parameter when accepting application/graphql-response+json
42+
33. MUST allow map {extensions} parameter when accepting application/json
43+
34. SHOULD use 4xx or 5xx status codes on JSON parsing failure when accepting application/graphql-response+json
44+
35. SHOULD use 400 status code on JSON parsing failure when accepting application/graphql-response+json
45+
36. SHOULD use 4xx or 5xx status codes if parameters are invalid when accepting application/graphql-response+json
46+
37. SHOULD use 400 status code if parameters are invalid when accepting application/graphql-response+json
47+
38. SHOULD not contain the data entry if parameters are invalid when accepting application/graphql-response+json
48+
39. SHOULD use 4xx or 5xx status codes on document parsing failure when accepting application/graphql-response+json
49+
40. SHOULD use 400 status code on document parsing failure when accepting application/graphql-response+json
50+
41. SHOULD not contain the data entry on document parsing failure when accepting application/graphql-response+json
51+
42. SHOULD use 4xx or 5xx status codes on document validation failure when accepting application/graphql-response+json
52+
43. SHOULD use 400 status code on document validation failure when accepting application/graphql-response+json
53+
44. SHOULD not contain the data entry on document validation failure when accepting application/graphql-response+json
54+
55+
## Warnings
56+
The server _SHOULD_ support these, but is not required.
57+
1. SHOULD accept application/graphql-response+json and match the content-type<br />
58+
```
59+
Content-Type header "application/json; charset=utf-8" does not contain "application/graphql-response+json"
60+
```
61+
2. SHOULD accept \*/\* and use application/graphql-response+json for the content-type<br />
62+
```
63+
Content-Type header "application/json; charset=utf-8" does not contain "application/graphql-response+json"
64+
```
65+
3. SHOULD assume application/graphql-response+json content-type when accept is missing<br />
66+
```
67+
Content-Type header "application/json; charset=utf-8" does not contain "application/graphql-response+json"
68+
```
69+
4. SHOULD use 200 status code with errors field on missing {query} parameter when accepting application/json<br />
70+
```
71+
Status code 400 is not 200
72+
```
73+
5. SHOULD use 200 status code with errors field on object {query} parameter when accepting application/json<br />
74+
```
75+
Status code 400 is not 200
76+
```
77+
6. SHOULD use 200 status code with errors field on number {query} parameter when accepting application/json<br />
78+
```
79+
Status code 400 is not 200
80+
```
81+
7. SHOULD use 200 status code with errors field on boolean {query} parameter when accepting application/json<br />
82+
```
83+
Status code 400 is not 200
84+
```
85+
8. SHOULD use 200 status code with errors field on array {query} parameter when accepting application/json<br />
86+
```
87+
Status code 400 is not 200
88+
```
89+
9. SHOULD use 200 status code with errors field on object {operationName} parameter when accepting application/json<br />
90+
```
91+
Status code 400 is not 200
92+
```
93+
10. SHOULD use 200 status code with errors field on number {operationName} parameter when accepting application/json<br />
94+
```
95+
Status code 400 is not 200
96+
```
97+
11. SHOULD use 200 status code with errors field on boolean {operationName} parameter when accepting application/json<br />
98+
```
99+
Status code 400 is not 200
100+
```
101+
12. SHOULD use 200 status code with errors field on array {operationName} parameter when accepting application/json<br />
102+
```
103+
Status code 400 is not 200
104+
```
105+
13. SHOULD use 400 status code on array {variables} parameter when accepting application/graphql-response+json<br />
106+
```
107+
Status code 200 is not 400
108+
```
109+
14. SHOULD use 200 status code with errors field on string {variables} parameter when accepting application/json<br />
110+
```
111+
Status code 400 is not 200
112+
```
113+
15. SHOULD use 200 status code with errors field on number {variables} parameter when accepting application/json<br />
114+
```
115+
Status code 400 is not 200
116+
```
117+
16. SHOULD use 200 status code with errors field on boolean {variables} parameter when accepting application/json<br />
118+
```
119+
Status code 400 is not 200
120+
```
121+
17. SHOULD use 200 status code with errors field on array {variables} parameter when accepting application/json<br />
122+
```
123+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
124+
```
125+
18. SHOULD use 400 status code on number {extensions} parameter when accepting application/graphql-response+json<br />
126+
```
127+
Status code 200 is not 400
128+
```
129+
19. SHOULD use 400 status code on boolean {extensions} parameter when accepting application/graphql-response+json<br />
130+
```
131+
Status code 200 is not 400
132+
```
133+
20. SHOULD use 400 status code on array {extensions} parameter when accepting application/graphql-response+json<br />
134+
```
135+
Status code 200 is not 400
136+
```
137+
21. SHOULD use 200 status code with errors field on string {extensions} parameter when accepting application/json<br />
138+
```
139+
Status code 400 is not 200
140+
```
141+
22. SHOULD use 200 status code with errors field on number {extensions} parameter when accepting application/json<br />
142+
```
143+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
144+
```
145+
23. SHOULD use 200 status code with errors field on boolean {extensions} parameter when accepting application/json<br />
146+
```
147+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
148+
```
149+
24. SHOULD use 200 status code with errors field on array {extensions} parameter when accepting application/json<br />
150+
```
151+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
152+
```
153+
25. SHOULD use 200 status code on JSON parsing failure when accepting application/json<br />
154+
```
155+
Status code 400 is not 200
156+
```
157+
26. SHOULD use 200 status code if parameters are invalid when accepting application/json<br />
158+
```
159+
Status code 400 is not 200
160+
```
161+
27. SHOULD use 200 status code on document parsing failure when accepting application/json<br />
162+
```
163+
Status code 400 is not 200
164+
```
165+
28. SHOULD use 200 status code on document validation failure when accepting application/json<br />
166+
```
167+
Status code 400 is not 200
168+
```
169+
29. SHOULD not contain the data entry on JSON parsing failure when accepting application/graphql-response+json<br />
170+
```
171+
Response body is not valid JSON. Got "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>SyntaxError: Unexpected end of JSON input<br> &nbsp; &nbsp;at JSON.parse (&lt;anonymous&gt;)<br> &nbsp; &nbsp;at parse (/home/runner/work/graphql-http/graphql-http/node_modules/body-parser/lib/types/json.js:89:19)<br> &nbsp; &nbsp;at /home/runner/work/graphql-http/graphql-http/node_modules/body-parser/lib/read.js:128:18<br> &nbsp; &nbsp;at AsyncResource.runInAsyncScope (node:async_hooks:203:9)<br> &nbsp; &nbsp;at invokeCallback (/home/runner/work/graphql-http/graphql-http/node_modules/raw-body/index.js:231:16)<br> &nbsp; &nbsp;at done (/home/runner/work/graphql-http/graphql-http/node_modules/raw-body/index.js:220:7)<br> &nbsp; &nbsp;at IncomingMessage.onEnd (/home/runner/work/graphql-http/graphql-http/node_modules/raw-body/index.js:280:7)<br> &nbsp; &nbsp;at IncomingMessage.emit (node:events:513:28)<br> &nbsp; &nbsp;at endReadableNT (node:internal/streams/rea...
172+
```
173+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// @ts-check
2+
3+
import { GraphQLSchema, GraphQLString, GraphQLObjectType } from 'graphql';
4+
import { ApolloServer } from '@apollo/server';
5+
import { startStandaloneServer } from '@apollo/server/standalone';
6+
7+
const schema = new GraphQLSchema({
8+
query: new GraphQLObjectType({
9+
name: 'Query',
10+
fields: {
11+
_: {
12+
type: GraphQLString,
13+
resolve: () => '_',
14+
},
15+
},
16+
}),
17+
});
18+
19+
const server = new ApolloServer({ schema });
20+
21+
startStandaloneServer(server, {
22+
listen: { port: parseInt(process.env.PORT || '0') },
23+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"private": true,
3+
"name": "apollo-server_v4",
4+
"packageManager": "[email protected]",
5+
"main": "index.mjs",
6+
"scripts": {
7+
"start": "node ."
8+
},
9+
"dependencies": {
10+
"@apollo/server": "^4.1.1",
11+
"graphql": "^16.6.0"
12+
}
13+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"release": "semantic-release"
8383
},
8484
"workspaces": [
85-
"implementations/*"
85+
"implementations/**/*"
8686
],
8787
"peerDependencies": {
8888
"graphql": ">=0.11 <=16"

0 commit comments

Comments
 (0)