Skip to content

Commit 8716392

Browse files
chore: audit Deno (#37)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 7393fdf commit 8716392

File tree

10 files changed

+337
-2
lines changed

10 files changed

+337
-2
lines changed

.github/workflows/audits.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,36 @@ jobs:
300300
README.md
301301
report.json
302302
303+
deno:
304+
runs-on: ubuntu-latest
305+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
306+
env:
307+
PORT: 4000
308+
steps:
309+
- name: Checkout
310+
uses: actions/checkout@v3
311+
- name: Set up node
312+
uses: actions/setup-node@v3
313+
with:
314+
node-version: 18
315+
cache: yarn
316+
- name: Install
317+
run: yarn install --immutable
318+
- name: Build
319+
run: yarn build:esm
320+
- name: Start
321+
run: yarn workspace deno start -d --wait
322+
# TODO: cache docker build artifacts
323+
- name: Audit
324+
run: node scripts/audit-implementation.mjs .
325+
- name: Upload report
326+
uses: actions/upload-artifact@v3
327+
with:
328+
name: deno-report
329+
path: |
330+
README.md
331+
report.json
332+
303333
report:
304334
name: Report
305335
runs-on: ubuntu-latest
@@ -316,6 +346,7 @@ jobs:
316346
hotchocolate,
317347
postgraphile,
318348
pioneer,
349+
deno,
319350
]
320351
steps:
321352
- name: Checkout
@@ -373,6 +404,11 @@ jobs:
373404
with:
374405
name: pioneer-report
375406
path: implementations/pioneer
407+
- name: Download deno report
408+
uses: actions/download-artifact@v3
409+
with:
410+
name: deno-report
411+
path: implementations/deno
376412
- name: Commit
377413
run: |
378414
git config user.name "github-actions[bot]"

implementations/apollo-server/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ Status code 400 is not 200
165165
```
166166
26. SHOULD not contain the data entry on JSON parsing failure when accepting application/graphql-response+json<br />
167167
```
168-
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...
168+
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:204: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...
169169
```
170170

implementations/deno/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM denoland/deno:1.29.2
2+
3+
# curl is necessary for healthchecks
4+
RUN apt update && apt install curl -y
5+
6+
COPY index.ts .
7+
RUN deno cache index.ts

implementations/deno/README.md

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
_* This report was auto-generated by graphql-http_
2+
3+
# GraphQL over HTTP audit report
4+
5+
- **79** audits in total
6+
-**32** pass
7+
- ⚠️ **44** warnings (optional)
8+
-**3** errors (required)
9+
10+
## Passing
11+
1. MUST accept application/json and match the content-type
12+
2. SHOULD accept \*/\* and use application/json for the content-type
13+
3. SHOULD assume application/json content-type when accept is missing
14+
4. MUST accept POST requests
15+
5. MAY accept application/x-www-form-urlencoded formatted GET requests
16+
6. MAY NOT allow executing mutations on GET requests
17+
7. SHOULD respond with 4xx status code if content-type is not supplied on POST requests
18+
8. MUST accept application/json POST requests
19+
9. MUST require a request body on POST
20+
10. SHOULD use 200 status code with errors field on missing {query} parameter when accepting application/json
21+
11. SHOULD use 200 status code with errors field on object {query} parameter when accepting application/json
22+
12. SHOULD use 200 status code with errors field on number {query} parameter when accepting application/json
23+
13. SHOULD use 200 status code with errors field on boolean {query} parameter when accepting application/json
24+
14. SHOULD use 200 status code with errors field on array {query} parameter when accepting application/json
25+
15. MUST allow string {query} parameter when accepting application/json
26+
16. SHOULD use 200 status code with errors field on object {operationName} parameter when accepting application/json
27+
17. SHOULD use 200 status code with errors field on number {operationName} parameter when accepting application/json
28+
18. SHOULD use 200 status code with errors field on boolean {operationName} parameter when accepting application/json
29+
19. SHOULD use 200 status code with errors field on array {operationName} parameter when accepting application/json
30+
20. MUST allow string {operationName} parameter when accepting application/json
31+
21. MUST allow null {variables} parameter when accepting application/json
32+
22. MUST allow null {operationName} parameter when accepting application/json
33+
23. MUST allow null {extensions} parameter when accepting application/json
34+
24. MUST allow map {variables} parameter when accepting application/json
35+
25. MUST allow map {extensions} parameter when accepting application/json
36+
26. SHOULD use 200 status code if parameters are invalid when accepting application/json
37+
27. SHOULD use 200 status code on document parsing failure when accepting application/json
38+
28. SHOULD use 200 status code on document validation failure when accepting application/json
39+
29. SHOULD use 4xx or 5xx status codes on JSON parsing failure when accepting application/graphql-response+json
40+
30. SHOULD use 4xx or 5xx status codes if parameters are invalid when accepting application/graphql-response+json
41+
31. SHOULD use 4xx or 5xx status codes on document parsing failure when accepting application/graphql-response+json
42+
32. SHOULD use 4xx or 5xx status codes on document validation failure when accepting application/graphql-response+json
43+
44+
## Warnings
45+
The server _SHOULD_ support these, but is not required.
46+
1. SHOULD accept application/graphql-response+json and match the content-type<br />
47+
```
48+
Status code 406 is not 200
49+
```
50+
2. SHOULD use 400 status code on missing {query} parameter when accepting application/graphql-response+json<br />
51+
```
52+
Status code 406 is not 400
53+
```
54+
3. SHOULD use 400 status code on object {query} parameter when accepting application/graphql-response+json<br />
55+
```
56+
Status code 406 is not 400
57+
```
58+
4. SHOULD use 400 status code on number {query} parameter when accepting application/graphql-response+json<br />
59+
```
60+
Status code 406 is not 400
61+
```
62+
5. SHOULD use 400 status code on boolean {query} parameter when accepting application/graphql-response+json<br />
63+
```
64+
Status code 406 is not 400
65+
```
66+
6. SHOULD use 400 status code on array {query} parameter when accepting application/graphql-response+json<br />
67+
```
68+
Status code 406 is not 400
69+
```
70+
7. SHOULD allow string {query} parameter when accepting application/graphql-response+json<br />
71+
```
72+
Status code 406 is not 200
73+
```
74+
8. SHOULD use 400 status code on object {operationName} parameter when accepting application/graphql-response+json<br />
75+
```
76+
Status code 406 is not 400
77+
```
78+
9. SHOULD use 400 status code on number {operationName} parameter when accepting application/graphql-response+json<br />
79+
```
80+
Status code 406 is not 400
81+
```
82+
10. SHOULD use 400 status code on boolean {operationName} parameter when accepting application/graphql-response+json<br />
83+
```
84+
Status code 406 is not 400
85+
```
86+
11. SHOULD use 400 status code on array {operationName} parameter when accepting application/graphql-response+json<br />
87+
```
88+
Status code 406 is not 400
89+
```
90+
12. SHOULD allow string {operationName} parameter when accepting application/graphql-response+json<br />
91+
```
92+
Status code 406 is not 200
93+
```
94+
13. SHOULD allow null {variables} parameter when accepting application/graphql-response+json<br />
95+
```
96+
Status code 406 is not 200
97+
```
98+
14. SHOULD allow null {operationName} parameter when accepting application/graphql-response+json<br />
99+
```
100+
Status code 406 is not 200
101+
```
102+
15. SHOULD allow null {extensions} parameter when accepting application/graphql-response+json<br />
103+
```
104+
Status code 406 is not 200
105+
```
106+
16. SHOULD use 400 status code on string {variables} parameter when accepting application/graphql-response+json<br />
107+
```
108+
Status code 406 is not 400
109+
```
110+
17. SHOULD use 400 status code on number {variables} parameter when accepting application/graphql-response+json<br />
111+
```
112+
Status code 406 is not 400
113+
```
114+
18. SHOULD use 400 status code on boolean {variables} parameter when accepting application/graphql-response+json<br />
115+
```
116+
Status code 406 is not 400
117+
```
118+
19. SHOULD use 400 status code on array {variables} parameter when accepting application/graphql-response+json<br />
119+
```
120+
Status code 406 is not 400
121+
```
122+
20. SHOULD use 200 status code with errors field on string {variables} parameter when accepting application/json<br />
123+
```
124+
Status code 400 is not 200
125+
```
126+
21. SHOULD use 200 status code with errors field on number {variables} parameter when accepting application/json<br />
127+
```
128+
Status code 400 is not 200
129+
```
130+
22. SHOULD use 200 status code with errors field on boolean {variables} parameter when accepting application/json<br />
131+
```
132+
Status code 400 is not 200
133+
```
134+
23. SHOULD use 200 status code with errors field on array {variables} parameter when accepting application/json<br />
135+
```
136+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
137+
```
138+
24. SHOULD allow map {variables} parameter when accepting application/graphql-response+json<br />
139+
```
140+
Status code 406 is not 200
141+
```
142+
25. MAY allow URL-encoded JSON string {variables} parameter in GETs when accepting application/graphql-response+json<br />
143+
```
144+
Status code 406 is not 200
145+
```
146+
26. MAY allow URL-encoded JSON string {variables} parameter in GETs when accepting application/json<br />
147+
```
148+
Execution result {"errors":[{"message":"Variable \"$name\" of required type \"String!\" was not provided.","locations":[{"line":1,"column":12}]}]} does have a property 'errors'
149+
```
150+
27. SHOULD use 400 status code on string {extensions} parameter when accepting application/graphql-response+json<br />
151+
```
152+
Status code 406 is not 400
153+
```
154+
28. SHOULD use 400 status code on number {extensions} parameter when accepting application/graphql-response+json<br />
155+
```
156+
Status code 406 is not 400
157+
```
158+
29. SHOULD use 400 status code on boolean {extensions} parameter when accepting application/graphql-response+json<br />
159+
```
160+
Status code 406 is not 400
161+
```
162+
30. SHOULD use 400 status code on array {extensions} parameter when accepting application/graphql-response+json<br />
163+
```
164+
Status code 406 is not 400
165+
```
166+
31. SHOULD use 200 status code with errors field on string {extensions} parameter when accepting application/json<br />
167+
```
168+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
169+
```
170+
32. SHOULD use 200 status code with errors field on number {extensions} parameter when accepting application/json<br />
171+
```
172+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
173+
```
174+
33. SHOULD use 200 status code with errors field on boolean {extensions} parameter when accepting application/json<br />
175+
```
176+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
177+
```
178+
34. SHOULD use 200 status code with errors field on array {extensions} parameter when accepting application/json<br />
179+
```
180+
Execution result {"data":{"__typename":"Query"}} does not have a property 'errors'
181+
```
182+
35. SHOULD allow map {extensions} parameter when accepting application/graphql-response+json<br />
183+
```
184+
Status code 406 is not 200
185+
```
186+
36. SHOULD use 200 status code on JSON parsing failure when accepting application/json<br />
187+
```
188+
Status code 400 is not 200
189+
```
190+
37. SHOULD use 400 status code on JSON parsing failure when accepting application/graphql-response+json<br />
191+
```
192+
Status code 406 is not 400
193+
```
194+
38. SHOULD not contain the data entry on JSON parsing failure when accepting application/graphql-response+json<br />
195+
```
196+
Response body is not valid JSON. Got "Not Acceptable"
197+
```
198+
39. SHOULD use 400 status code if parameters are invalid when accepting application/graphql-response+json<br />
199+
```
200+
Status code 406 is not 400
201+
```
202+
40. SHOULD not contain the data entry if parameters are invalid when accepting application/graphql-response+json<br />
203+
```
204+
Response body is not valid JSON. Got "Not Acceptable"
205+
```
206+
41. SHOULD use 400 status code on document parsing failure when accepting application/graphql-response+json<br />
207+
```
208+
Status code 406 is not 400
209+
```
210+
42. SHOULD not contain the data entry on document parsing failure when accepting application/graphql-response+json<br />
211+
```
212+
Response body is not valid JSON. Got "Not Acceptable"
213+
```
214+
43. SHOULD use 400 status code on document validation failure when accepting application/graphql-response+json<br />
215+
```
216+
Status code 406 is not 400
217+
```
218+
44. SHOULD not contain the data entry on document validation failure when accepting application/graphql-response+json<br />
219+
```
220+
Response body is not valid JSON. Got "Not Acceptable"
221+
```
222+
223+
## Errors
224+
The server _MUST_ support these.
225+
1. MUST use utf-8 encoding when responding<br />
226+
```
227+
Body is not UTF-8 encoded
228+
```
229+
2. MUST accept utf-8 encoding<br />
230+
```
231+
Content-Type header "application/json" does not contain "utf-8"
232+
```
233+
3. MUST assume utf-8 if encoding is unspecified<br />
234+
```
235+
Content-Type header "application/json" does not contain "utf-8"
236+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
server:
3+
build: .
4+
environment:
5+
- PORT=${PORT}
6+
ports:
7+
- ${PORT}:${PORT}
8+
entrypoint: [deno, run, --allow-env, --allow-net, index.ts]
9+
healthcheck:
10+
test: curl -f http://localhost:$$PORT/graphql?query=%7B__typename%7D || exit 1
11+
interval: 3s
12+
timeout: 1s

implementations/deno/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { makeExecutableSchema } from 'https://deno.land/x/[email protected]/mod.ts';
2+
import { gql } from 'https://deno.land/x/[email protected]/mod.ts';
3+
import { Server } from 'https://deno.land/[email protected]/http/server.ts';
4+
import { GraphQLHTTP } from 'https://deno.land/x/[email protected]/mod.ts';
5+
6+
const schema = makeExecutableSchema({
7+
typeDefs: gql`
8+
type Query {
9+
hello: String
10+
}
11+
`,
12+
resolvers: {
13+
Query: {
14+
hello: () => 'world',
15+
},
16+
},
17+
});
18+
19+
const server = new Server({
20+
handler: GraphQLHTTP({ schema }),
21+
port: Deno.env.get('PORT'),
22+
});
23+
24+
server.listenAndServe();

implementations/deno/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"private": true,
3+
"name": "deno",
4+
"packageManager": "[email protected]",
5+
"scripts": {
6+
"start": "docker compose up --build"
7+
}
8+
}

implementations/deno/report.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"total": 79,
3+
"ok": 32,
4+
"warn": 44,
5+
"error": 3
6+
}

implementations/graphql-helix/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Status code 400 is not 200
176176
```
177177
30. SHOULD not contain the data entry on JSON parsing failure when accepting application/graphql-response+json<br />
178178
```
179-
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...
179+
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:204: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...
180180
```
181181

182182
## Errors

yarn.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5893,6 +5893,12 @@ __metadata:
58935893
languageName: node
58945894
linkType: hard
58955895

5896+
"deno@workspace:implementations/deno":
5897+
version: 0.0.0-use.local
5898+
resolution: "deno@workspace:implementations/deno"
5899+
languageName: unknown
5900+
linkType: soft
5901+
58965902
"depd@npm:2.0.0, depd@npm:^2.0.0, depd@npm:~2.0.0":
58975903
version: 2.0.0
58985904
resolution: "depd@npm:2.0.0"

0 commit comments

Comments
 (0)