Exploit databaseDownload repository ZIP
GH-e1c0cf823e5eb992b65e398b6c242700
shoucheng3/codecentric__spring-boot-admin_cve-2022-46166_2-6-9
Sources for CVE-2022-46166
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files10
shoucheng3/codecentric__spring-boot-admin_cve-2022-46166_2-6-9Revision 446f1d3c1a2d
- ↑..Parent directory
- client/
- reactive/
- servlet/
- AdminController.java
- ApplicationsController.java
- HttpHeaderFilter.java
- InstanceWebProxy.java
- InstancesController.java
- PathUtils.java
- package-info.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/server/web/HttpHeaderFilter.java
Java · 1,966 bytes/*
* Copyright 2014-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.codecentric.boot.admin.server.web;
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.http.HttpHeaders;
import static java.util.stream.Collectors.toMap;
/**
* Returns a new HttpHeaders from the given one but omits the hop-by-hop headers and
* specified headers.
*
* @author Johannes Edmeier
*/
public class HttpHeaderFilter {
private static final String[] HOP_BY_HOP_HEADERS = new String[] { "Host", "Connection", "Keep-Alive",
"Proxy-Authenticate", "Proxy-Authorization", "TE", "Trailer", "Transfer-Encoding", "Upgrade",
"X-Application-Context" };
private final Set<String> ignoredHeaders;
public HttpHeaderFilter(Set<String> ignoredHeaders) {
this.ignoredHeaders = Stream.concat(ignoredHeaders.stream(), Arrays.stream(HOP_BY_HOP_HEADERS))
.map(String::toLowerCase).collect(Collectors.toSet());
}
public HttpHeaders filterHeaders(HttpHeaders headers) {
HttpHeaders filtered = new HttpHeaders();
filtered.putAll(headers.entrySet().stream().filter((e) -> this.includeHeader(e.getKey()))
.collect(toMap(Map.Entry::getKey, Map.Entry::getValue)));
return filtered;
}
private boolean includeHeader(String header) {
return !this.ignoredHeaders.contains(header.toLowerCase());
}
}