-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/se/swedenconnect/ca/cmcclient/configuration/BinderControllerAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package se.swedenconnect.ca.cmcclient.configuration; | ||
|
||
import org.springframework.core.annotation.Order; | ||
import org.springframework.web.bind.WebDataBinder; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.InitBinder; | ||
|
||
@ControllerAdvice | ||
@Order(10000) | ||
public class BinderControllerAdvice { | ||
@InitBinder | ||
public void setAllowedFields(WebDataBinder dataBinder) { | ||
// This code protects Spring Core from a "Remote Code Execution" attack (dubbed "Spring4Shell"). | ||
// By applying this mitigation, you prevent the "Class Loader Manipulation" attack vector from firing. | ||
// For more details, see this post: https://www.lunasec.io/docs/blog/spring-rce-vulnerabilities/ | ||
String[] denylist = new String[]{"class.*", "Class.*", "*.class.*", "*.Class.*"}; | ||
dataBinder.setDisallowedFields(denylist); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters