Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions apps/mesh/src/api/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,13 @@ const oauthProxyHandler: MiddlewareHandler<Env> = async (c) => {
const redirectUrl = new URL(redirectUri);
const allowedOriginObj = new URL(allowedOrigin);

// Check if redirect_uri origin matches the allowed origin
// Check if redirect_uri origin matches the allowed origin.
// Localhost is only allowed in local mode — in production, an attacker
// could set redirect_uri=http://localhost:8080/steal to intercept
// OAuth authorization codes on shared hosts or cloud environments.
const isAllowed =
redirectUrl.origin === allowedOriginObj.origin ||
// Allow localhost for development
redirectUrl.hostname === "localhost";
(getSettings().localMode && redirectUrl.hostname === "localhost");

if (!isAllowed) {
return c.json(
Expand Down
Loading