Recipe Name:
Security Misconfiguration: CORS: Avoid broad settings: CorsRegistry#exposedHeaders
Description:
Exposing all headers makes the application vulnerable
Level:
warning
Language:
- java
Tags:
- Spring
- security
- framework specific
- web
- Spring Security
Documentation
Be cautious when using a wildcard ("*") to set exposedHeaders
. Allowing CORS, in particular with overly permissive settings, can make the application vulnerable to attacks.
registry.exposedHeaders("*");After
registry.exposedHeaders();References
Recipe
id: scw:spring:security:cors:CorsRegistry#exposedHeaders version: 10 metadata: name: 'Security Misconfiguration: CORS: Avoid broad settings: CorsRegistry#exposedHeaders' shortDescription: Exposing all headers makes the application vulnerable level: warning language: java enabled: true descriptionFile: descriptions/AvoidbroadsettingsCorsRegistryexposedHeaders.html tags: Spring;security;framework specific;web;Spring Security search: methodcall: args: 1: value: stringified: '*' name: exposedHeaders type: org.springframework.web.servlet.config.annotation.CorsRegistration availableFixes: - name: Specify the exposedHeaders actions: []