Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/defguard_core/tests/integration/api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ pub struct RecoveryCodes {
codes: Option<Vec<String>>,
}

#[sqlx::test]
async fn dg25_19_clickjacking_vulnerability(_: PgPoolOptions, options: PgConnectOptions) {
let pool = setup_pool(options).await;

let client = make_client(pool).await;

let response = client.get("/").send().await;
let headers = response.headers();
let csp_header = headers.get("content-security-policy").unwrap();
let csp_value = csp_header.to_str().unwrap();
assert!(
csp_value.contains("frame-ancestors 'none'"),
"CSP header should block all iframes with 'none' directive"
);
}

#[sqlx::test]
async fn test_logout(_: PgPoolOptions, options: PgConnectOptions) {
let pool = setup_pool(options).await;
Expand Down