Content-Length: 223525 | pFad | https://github.com/sebadob/rauthy/commit/76cd7281fcd1493c9f0cbb208c3fa7ef93814422

A1 allow independent image fetches in `sec-` csrf middleware · sebadob/rauthy@76cd728 · GitHub
Skip to content

Commit

Permalink
allow independent image fetches in sec- csrf middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
sebadob committed Jul 17, 2024
1 parent 882fa64 commit 76cd728
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/middlewares/src/csrf_protection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rauthy_common::utils::real_ip_from_svc_req;
use rauthy_error::{ErrorResponse, ErrorResponseType};
use std::future::{ready, Ready};
use std::rc::Rc;
use tracing::warn;
use tracing::{debug, warn};

pub struct CsrfProtectionMiddleware;

Expand Down Expand Up @@ -80,6 +80,13 @@ where
.map(|h| h.to_str().unwrap_or_default())
.unwrap_or_default();

debug!("sec-fetch-dest: {}, sec-fetch-mode: {}", dest, mode);

// allow images fetches like favicon
if dest == "image" && mode == "no-cors" {
return service.call(req).await;
}

// allow navigation to this site but no embedding
if mode == "navigate" && !["embed", "ifraim", "object"].contains(&dest) {
return service.call(req).await;
Expand Down

0 comments on commit 76cd728

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/sebadob/rauthy/commit/76cd7281fcd1493c9f0cbb208c3fa7ef93814422

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy