File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,15 @@ export const ALLOWED_ORIGINS = IS_PROD_BUILD
21
21
// resolving to localhost and never hitting the network).
22
22
/ ^ h t t p s ? : \/ \/ l o c a l h o s t ( : \d + ) ? $ / ,
23
23
/ ^ h t t p : \/ \/ l o c a l \. h t t p t o o l k i t \. t e c h ( : \d + ) ? $ / ,
24
- / ^ h t t p s : \/ \/ a p p \. h t t p t o o l k i t \. t e c h $ /
25
- ]
24
+ / ^ h t t p s : \/ \/ a p p \. h t t p t o o l k i t \. t e c h $ / ,
25
+ ] ;
26
+
27
+ export const MOCKTTP_ALLOWED_ORIGINS = [
28
+ ...ALLOWED_ORIGINS ,
29
+ // The Chromium webextension is allowed to make requests from the
30
+ // browser directly into the Mockttp admin API (but not into our API server).
31
+ 'chrome-extension://jggocihfdfgogbofcmdlfbakdkgdkdoe'
32
+ ] ;
26
33
27
34
// The range of ports that should be used by invisible ephemeral services, such as Firefox's
28
35
// certificate check server and Chrome's "hide warning" server. These ports are extra likely
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import updateCommand from '@oclif/plugin-update/lib/commands/update';
10
10
import { HttpToolkitServerApi } from './api-server' ;
11
11
import { checkBrowserConfig } from './browsers' ;
12
12
import { reportError } from './error-tracking' ;
13
- import { ALLOWED_ORIGINS } from './constants' ;
13
+ import { MOCKTTP_ALLOWED_ORIGINS } from './constants' ;
14
14
15
15
import { delay } from './util/promise' ;
16
16
import { isErrorLike } from './util/error' ;
@@ -121,7 +121,7 @@ export async function runHTK(options: {
121
121
} ,
122
122
corsOptions : {
123
123
strict : true , // For the standalone admin API, require valid CORS headers
124
- origin : ALLOWED_ORIGINS , // Only allow requests from our origins, to avoid XSRF
124
+ origin : MOCKTTP_ALLOWED_ORIGINS , // Only allow mock admin control from our origins
125
125
maxAge : 86400 , // Cache CORS responses for as long as possible
126
126
allowPrivateNetworkAccess : true // Allow access from non-local domains in Chrome 102+
127
127
} ,
You can’t perform that action at this time.
0 commit comments