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
2121 // resolving to localhost and never hitting the network).
2222 / ^ h t t p s ? : \/ \/ l o c a l h o s t ( : \d + ) ? $ / ,
2323 / ^ 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+ ] ;
2633
2734// The range of ports that should be used by invisible ephemeral services, such as Firefox's
2835// 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';
1010import { HttpToolkitServerApi } from './api-server' ;
1111import { checkBrowserConfig } from './browsers' ;
1212import { reportError } from './error-tracking' ;
13- import { ALLOWED_ORIGINS } from './constants' ;
13+ import { MOCKTTP_ALLOWED_ORIGINS } from './constants' ;
1414
1515import { delay } from './util/promise' ;
1616import { isErrorLike } from './util/error' ;
@@ -121,7 +121,7 @@ export async function runHTK(options: {
121121 } ,
122122 corsOptions : {
123123 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
125125 maxAge : 86400 , // Cache CORS responses for as long as possible
126126 allowPrivateNetworkAccess : true // Allow access from non-local domains in Chrome 102+
127127 } ,
You can’t perform that action at this time.
0 commit comments