Rust Insecure Samesite Cookie Attribute
Description
This detector identifies Rust Actix web applications that configure cookies with SameSite=None attribute without proper security considerations. The SameSite=None setting allows cookies to be sent in cross-site requests, which can expose applications to Cross-Site Request Forgery (CSRF) attacks and other security vulnerabilities if not properly secured.
Detection Strategy
• The detector scans Rust source code for Actix web framework cookie configurations
• It identifies cookie setup code that uses the 'cookie_same_site' method or similar cookie configuration functions
• The detector flags instances where cookies are explicitly set with SameSite=None attribute through method calls or configuration chains
• It triggers a vulnerability report when SameSite=None is detected in cookie configurations, as this setting removes CSRF protection unless additional security measures are implemented
Vulnerable code example
use actix_web::cookie::{Cookie, SameSite};
use actix_web::{HttpResponse, Responder};
async fn vulnerable_cookie(token: String) -> impl Responder {
// VULNERABLE: SameSite::None allows cross-site cookie transmission
HttpResponse::Ok()
.cookie(Cookie::build("session_id", token).same_site(SameSite::None).finish())
.finish()...✅ Secure code example
use actix_web::cookie::{Cookie, SameSite};
use actix_web::{HttpResponse, Responder};
async fn secure_cookie(token: String) -> impl Responder {
// SECURE: SameSite::Strict prevents cross-site cookie transmission
HttpResponse::Ok()
.cookie(Cookie::build("session_id", token).same_site(SameSite::Strict).finish())
.finish()...Search for vulnerabilities in your apps for free with Fluid Attacks' automated security testing! Start your 21-day free trial and discover the benefits of the Continuous Hacking Essential plan. If you prefer the Advanced plan, which includes the expertise of Fluid Attacks' hacking team, fill out this contact form.