Skip to content

Commit

Permalink
fix: open redirect in /logout redirect parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister committed Feb 28, 2024
1 parent 5d670e3 commit 9f8c0b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,12 @@ pub async fn login_callback_handler(

#[instrument(name = "GET /logout", skip(req), err, fields(redirect))]
pub async fn logout_handler(req: Request<Body>) -> ApiResult<Response<Body>> {
let redirect_url = req
let mut redirect_url = req
.query("redirect")
.and_then(|url| urlencoding::decode(url).map(|url| url.into_owned()).ok())
.unwrap_or("/".to_string());

redirect_url = sanitize_redirect_url(&redirect_url);
Span::current().record("redirect", &redirect_url);

Ok(
Expand Down

0 comments on commit 9f8c0b3

Please sign in to comment.