Skip to content

Commit

Permalink
Spring4Shell (CVE-2022-22965) workaround fix
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Mar 31, 2022
1 parent 57790b9 commit 9702d79
Showing 1 changed file with 26 additions and 0 deletions.
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.*");
}
}

0 comments on commit 9702d79

Please sign in to comment.