Skip to content

Commit 0ba208c

Browse files
committed
gateway: introduce content-security-policy for all responses
Signed-off-by: Younes Khoudli <[email protected]>
1 parent b80777a commit 0ba208c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gateway/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,13 @@ async fn main() -> std::io::Result<()> {
8686
actix_cors::Cors::default()
8787
};
8888

89+
let default_headers = actix_web::middleware::DefaultHeaders::new().add((
90+
"Content-Security-Policy",
91+
"default-src 'self'; connect-src 'self' https://icons.app.sbb.ch; frame-ancestors 'self'; form-action 'self'; img-src 'self' data:; font-src 'self' https://cdn.app.sbb.ch/fonts/ data:; style-src 'self' 'unsafe-inline';",
92+
));
93+
8994
let mut app = App::new()
95+
.wrap(default_headers)
9096
.wrap(cors)
9197
.wrap(RequestTracing::new())
9298
.wrap(Compress::default()) // enable compress

0 commit comments

Comments
 (0)