Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include message body in 302 responses #399

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/auth0-session/handlers/callback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ export default function callbackHandlerFactory(
res.writeHead(302, {
Location: openidState.returnTo || config.baseURL
});
res.end();
res.end(openidState.returnTo || config.baseURL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also - I think we should escape these (and the others)

It's probably overkill because modern browsers wont serve this content, but openidState.returnTo can contain reflected user input from /api/auth/login?returnTo=user-input

I also notice that express escapes the content in 302

There's a util method to escape html here https://github.com/auth0/nextjs-auth0/blob/main/src/utils/errors.ts#L26-L34

FYI @lzychowski

};
}
2 changes: 1 addition & 1 deletion src/auth0-session/handlers/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ export default function loginHandlerFactory(
res.writeHead(302, {
Location: authorizationUrl
});
res.end();
res.end(authorizationUrl);
};
}
2 changes: 1 addition & 1 deletion src/auth0-session/handlers/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ export default function logoutHandlerFactory(
res.writeHead(302, {
Location: returnURL
});
res.end();
res.end(returnURL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that you need to update lines 31 and 43

};
}