Skip to content

Commit fa69ebc

Browse files
committed
Pass the auth token by env var, not --token
This protects the auth server further, making it inaccessible even to other processes on the same machine, which could otherwise inspect CLI args for the running process.
1 parent 84a7157 commit fa69ebc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,14 @@ if (!amMainInstance) {
310310
const serverBinPath = path.join(__dirname, '..', 'httptoolkit-server', 'bin', binName);
311311
const serverBinCommand = isWindows ? `"${serverBinPath}"` : serverBinPath;
312312

313-
server = spawn(serverBinCommand, ['start', '--token', AUTH_TOKEN], {
313+
server = spawn(serverBinCommand, ['start'], {
314314
windowsHide: true,
315315
stdio: ['inherit', 'pipe', 'pipe'],
316316
shell: isWindows, // Required to spawn a .cmd script
317317
windowsVerbatimArguments: false, // Fixes quoting in windows shells
318318
detached: !isWindows, // Detach on Linux, so we can cleanly kill as a group
319319
env: Object.assign({}, process.env, {
320+
HTK_SERVER_TOKEN: AUTH_TOKEN,
320321
NODE_OPTIONS:
321322
process.env.HTTPTOOLKIT_NODE_OPTIONS || // Allow manually configuring node options
322323
"--max-http-header-size=102400" // By default, set max header size to 100KB

0 commit comments

Comments
 (0)