Rust Actix Cors Permissive Policy
Description
This vulnerability detects permissive Cross-Origin Resource Sharing (CORS) configurations in Rust Actix web applications that allow unrestricted cross-origin access. Overly permissive CORS policies can expose the application to cross-origin attacks, allowing malicious websites to access sensitive resources and data.
Detection Strategy
• Scans Rust source code files that import the actix_web library
• Identifies CORS configuration patterns that set overly permissive access policies
• Reports violations when CORS headers are configured to allow all origins (*) or when actix_cors crate builder methods create unrestricted access policies
• Triggers alerts on method calls and header configurations that bypass same-origin policy protections
Vulnerable code example
use actix_cors::Cors;
use actix_web::middleware::DefaultHeaders;
use actix_web::{middleware, App, HttpResponse};
// Vulnerable - Cors::permissive() allows all origins/methods/headers
fn app_vulnerable() -> App<()> {
App::new().wrap(Cors::permissive())
}...✅ Secure code example
use actix_cors::Cors;
use actix_web::middleware::DefaultHeaders;
use actix_web::{middleware, App, HttpResponse};
// Safe - Specify allowed origins explicitly instead of permissive wildcard
fn app_safe() -> App<()> {
App::new().wrap(
Cors::default()...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.