MCPcopy Create free account
hub / github.com/CommE2E/comm / assertSecureRequest

Function assertSecureRequest

keyserver/src/utils/security-utils.js:7–20  ·  view source on GitHub ↗
(req: $Request)

Source from the content-addressed store, hash-verified

5import { getAppURLFactsFromRequestURL } from './urls.js';
6
7function assertSecureRequest(req: $Request) {
8 const { https, proxy } = getAppURLFactsFromRequestURL(req.originalUrl);
9
10 if (!https) {
11 return;
12 }
13 if (
14 (proxy === 'none' && req.protocol !== 'https') ||
15 (proxy === 'apache' && req.get('X-Forwarded-SSL') !== 'on') ||
16 (proxy === 'aws' && req.get('X-Forwarded-Proto') !== 'https')
17 ) {
18 throw new Error('insecure request');
19 }
20}
21
22export { assertSecureRequest };

Callers 3

fetchViewerForSocketFunction · 0.90
onConnectionFunction · 0.90

Calls 2

getMethod · 0.65

Tested by

no test coverage detected