add trusted-origins cli argument (#6319)

This commit is contained in:
Alex Thillen
2023-07-20 00:04:03 +02:00
committed by GitHub
parent 7926647058
commit 93e60f7b0e
3 changed files with 12 additions and 0 deletions

View File

@@ -355,6 +355,11 @@ export function authenticateOrigin(req: express.Request): void {
throw new Error(`unable to parse malformed origin "${originRaw}"`)
}
const trustedOrigins = req.args["trusted-origins"] || []
if (trustedOrigins.includes(origin) || trustedOrigins.includes("*")) {
return
}
const host = getHost(req)
if (typeof host === "undefined") {
// A missing host likely means the reverse proxy has not been configured to