-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Spring4Shell (CVE-2022-22965) workaround fix
https://spring.io/blog/2022/03/31/spring-framework-rce-early-announcement (cherry picked from commit 3637c8d)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
model/rest-impl/src/main/java/com/evolveum/midpoint/rest/impl/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,26 @@ | ||
/* | ||
* Copyright (C) 2010-2022 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
package com.evolveum.midpoint.rest.impl; | ||
|
||
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 | ||
public class BinderControllerAdvice { | ||
|
||
/** | ||
* Should prevent Spring4Shell vulnerability (but we believe midPoint does not allow it anyway). | ||
* See https://spring.io/blog/2022/03/31/spring-framework-rce-early-announcement[this] for more info. | ||
*/ | ||
@InitBinder | ||
public void setAllowedFields(WebDataBinder dataBinder) { | ||
dataBinder.setDisallowedFields("class.*", "Class.*", "*.class.*", "*.Class.*"); | ||
} | ||
} |