Recipe Name:
Security Misconfiguration: StrictHttpFirewall: Rule configuration: HTTP method validation
Description:
Not allowing just any HTTP method is more secure
Level:
warning
Language:
  • java
Tags:
  • Spring
  • security
  • framework specific
  • Spring Security
  • web
Documentation

Not allowing any validation on the HTTP methods can make the application vulnerable to HTTP Verb tampering and Cross-Site Tracing Software (XST) attacks. Spring Security by default sets StrictHttpFirewall#setUnsafeAllowAnyHttpMethod to false.

Before
firewall.setUnsafeAllowAnyHttpMethod(true);
After
firewall.setUnsafeAllowAnyHttpMethod(false);
References
Recipe
id: scw:spring:security:stricthttpfirewall-any-http-method
version: 10
metadata:
  name: 'Security Misconfiguration: StrictHttpFirewall: Rule configuration: HTTP method validation'
  shortDescription: Not allowing just any HTTP method is more secure
  level: warning
  language: java
  enabled: true
  descriptionFile: descriptions/HTTPmethodvalidation.html
  tags: Spring;security;framework specific;Spring Security;web
search:
  methodcall:
    args:
      1:
        type: boolean
        value:
          stringified: "true"
    name: setUnsafeAllowAnyHttpMethod
    type: org.springframework.security.web.firewall.StrictHttpFirewall
availableFixes:
- name: Set setUnsafeAllowAnyHttpMethod to false
  actions:
  - modifyArguments:
      rewrite:
        1: "false"