Skip to content

Commit c7733a9

Browse files
committed
Update Mockttp to tighten up CSRF protections there too
1 parent 466ae7f commit c7733a9

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"graphql": "^14.0.2",
4646
"graphql-yoga": "^1.18.1",
4747
"lodash": "^4.17.13",
48-
"mockttp": "^0.19.1",
48+
"mockttp": "^0.19.2",
4949
"node-forge": "^0.9.0",
5050
"node-gsettings-wrapper": "^0.5.0",
5151
"portfinder": "^1.0.25",

src/httptoolkit-server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as os from 'os';
33
import * as events from 'events';
44
import corsGate = require('cors-gate');
55
import { GraphQLServer } from 'graphql-yoga';
6-
import * as Express from 'express';
76
import { GraphQLScalarType } from 'graphql';
87

98
import { HtkConfig } from './config';

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export async function runHTK(options: {
8686
https: httpsConfig
8787
},
8888
corsOptions: {
89+
strict: true,
8990
origin: ALLOWED_ORIGINS,
9091
maxAge: 86400 // Cache this result for as long as possible
9192
}

test/integration-test.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ describe('Integration test', function () {
9292
});
9393

9494
it('starts a Mockttp server', async () => {
95-
const mockttp = getRemote();
95+
const mockttp = getRemote({
96+
client: {
97+
// Pretend to be a browser on the real site:
98+
headers: { origin: 'https://app.httptoolkit.tech' }
99+
}
100+
});
96101
await mockttp.start();
97102
await mockttp.get('https://google.com').thenReply(200, 'Mock response');
98103

0 commit comments

Comments
 (0)