MCPcopy Index your code
hub / github.com/coder/code-server / ensureOrigin

Function ensureOrigin

src/node/http.ts:342–352  ·  view source on GitHub ↗
(req: express.Request, _?: express.Response, next?: express.NextFunction)

Source from the content-addressed store, hash-verified

340 * Throw a forbidden error if origin checks fail. Call `next` if provided.
341 */
342export function ensureOrigin(req: express.Request, _?: express.Response, next?: express.NextFunction): void {
343 try {
344 authenticateOrigin(req)
345 if (next) {
346 next()
347 }
348 } catch (error) {
349 logger.debug(`${error instanceof Error ? error.message : error}; blocking request to ${req.originalUrl}`)
350 throw new HttpError("Forbidden", HttpCode.Forbidden)
351 }
352}
353
354/**
355 * Return true if the origin matches any trusted origin. Entries are matched

Callers 2

domainProxy.tsFile · 0.90
wsProxyFunction · 0.90

Calls 1

authenticateOriginFunction · 0.85

Tested by

no test coverage detected