Skip to content

Commit

Permalink
Remove hostname check in trustOrigin
Browse files Browse the repository at this point in the history
It seems this was added for test purposes but the current tests all pass without this, and
it looks a bit safer to remove it.
  • Loading branch information
jonathanperret committed Mar 7, 2024
1 parent 402aa97 commit 3b2a88c
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/server/lib/requestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export function trustOrigin(req: Request, resp: Response): boolean {
// Note that the request origin is undefined for non-CORS requests.
const origin = req.get('origin');
if (!origin) { return true; } // Not a CORS request.
if (process.env.GRIST_HOST && req.hostname === process.env.GRIST_HOST) { return true; }
if (!allowHost(req, new URL(origin)) && !isEnvironmentAllowedHost(new URL(origin))) { return false; }

// For a request to a custom domain, the full hostname must match.
Expand Down

0 comments on commit 3b2a88c

Please sign in to comment.