Skip to content

Commit

Permalink
Add fallback redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Mubelotix committed Aug 29, 2024
1 parent 739d669 commit 430d25e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@ impl<'r, 'o: 'r> Responder<'r, 'o> for JwtToken {
let mut response = Response::build();
let response = response.status(Status::Ok)
.header(Header::new("Set-Cookie", value));
if let Some(next) = self.next {
// This could be a nice open-redirect vulnerability here but it actually can't be exploited
response.status(Status::SeeOther);
response.header(Header::new("Location", next));
}

// This could be a nice open-redirect vulnerability here but it actually can't be exploited
let next = self.next.unwrap_or_else(|| "/login".to_string());
response.status(Status::SeeOther);
response.header(Header::new("Location", next));

Ok(response.finalize())
}
}
Expand Down

0 comments on commit 430d25e

Please sign in to comment.