mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-16 05:36:50 +00:00
web::login: add form-data CSP rules for localhost
This commit is contained in:
1 parent
769db9b818
commit
ddae8af99f
1 file changed
+5
-3
@@ -24,10 +24,12 @@ pub struct OidcResponse {
|
|||||||
|
|
||||||
impl IntoResponse for OidcResponse {
|
impl IntoResponse for OidcResponse {
|
||||||
fn into_response(self) -> Response<Body> {
|
fn into_response(self) -> Response<Body> {
|
||||||
let content_csp = match self.nonce {
|
let csp_src = match self.nonce {
|
||||||
| Some(nonce) => &format!("default-src 'nonce-{nonce}'; form-action 'self';"),
|
| Some(nonce) => &format!("default-src 'nonce-{nonce}';"),
|
||||||
| None => "default-src 'none'; form-action 'self';",
|
| None => "default-src 'none';",
|
||||||
};
|
};
|
||||||
|
let csp_form_action = "form-action 'self' http://localhost http://127.0.0.1 http://[::1];";
|
||||||
|
let content_csp = format!("{csp_src} {csp_form_action}");
|
||||||
let content_type = match self.body {
|
let content_type = match self.body {
|
||||||
| Some(OAuthRequestBody::Json(_)) => "application/json",
|
| Some(OAuthRequestBody::Json(_)) => "application/json",
|
||||||
| _ => "text/html",
|
| _ => "text/html",
|
||||||
|
|||||||
Reference in new issue
Block a user