Skip to content

Commit

Permalink
port patch for forbidden characters
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Mar 4, 2020
1 parent 147815e commit 2dcaf79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public class HttpRequestProperties implements Serializable {
*/
private boolean allowMultiValueParameters;

/**
* Characters to block in incoming requests.
* {@code none} is a special value. Separate characters by a space.
*/
private String charactersToForbid = "none";

/**
* Parameters that are only allowed and accepted during posts.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,18 @@ public FilterRegistrationBean responseHeadersSecurityFilter() {
bean.setName("responseHeadersSecurityFilter");
bean.setAsyncSupported(true);
return bean;

}

@RefreshScope
@Bean
public FilterRegistrationBean requestParameterSecurityFilter() {
final Map<String, String> initParams = new HashMap<>();
initParams.put(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK,
casProperties.getHttpWebRequest().getParamsToCheck());
initParams.put(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID, "none");
if (StringUtils.isNotBlank(casProperties.getHttpWebRequest().getParamsToCheck())) {
initParams.put(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK,
casProperties.getHttpWebRequest().getParamsToCheck());
}
initParams.put(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID,
casProperties.getHttpWebRequest().getCharactersToForbid());
initParams.put(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS,
BooleanUtils.toStringTrueFalse(casProperties.getHttpWebRequest().isAllowMultiValueParameters()));
initParams.put(RequestParameterPolicyEnforcementFilter.ONLY_POST_PARAMETERS,
Expand Down

0 comments on commit 2dcaf79

Please sign in to comment.