Exploit databaseDownload repository ZIP
GH-bd9a554ae6618e15d9a0299f4d30e13e
agilevatester/springsecurityv1
Sources for CVE-2013-4152
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
agilevatester/springsecurityv1Revision 07f1b855e944
- ↑..Parent directory
- CompositeEnvironmentBeanFactoryPostProcessor.java
- CompositeUtils.java
- ConditionalOnMissingSearchPathLocator.java
- ConditionalOnSearchPathLocator.java
- OnSearchPathLocatorPresent.java
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2019-3799/src/main/java/org/springframework/cloud/config/server/composite/CompositeUtils.java
Java · 3,957 bytes/*
* Copyright 2018 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 org.springframework.cloud.config.server.composite;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.cloud.config.server.environment.EnvironmentRepositoryFactory;
import org.springframework.core.env.Environment;
import org.springframework.core.type.MethodMetadata;
/**
* @author Dylan Roberts
*/
public class CompositeUtils {
/**
* Returns list of values of the `type` field from the `spring.cloud.config.server.composite` collection.
*/
public static List<String> getCompositeTypeList(Environment environment) {
return Binder.get(environment)
.bind("spring.cloud.config.server", CompositeConfig.class)
.get().getComposite().stream()
.map(map -> (String)map.get("type"))
.collect(Collectors.toList());
}
static class CompositeConfig {
List<Map<String, Object>> composite;
public List<Map<String, Object>> getComposite() {
return composite;
}
public void setComposite(List<Map<String, Object>> composite) {
this.composite = composite;
}
}
/**
* Given a type of EnvironmentRepository (git, svn, native, etc...) returns the name of the factory bean.
* See {@link #getCompositeTypeList(Environment)}
*/
public static String getFactoryName(String type, ConfigurableListableBeanFactory beanFactory) {
String[] factoryNames = BeanFactoryUtils
.beanNamesForTypeIncludingAncestors(beanFactory, EnvironmentRepositoryFactory.class, true, false);
return Arrays.stream(factoryNames).filter(n -> n.startsWith(type)).findFirst().orElse(null);
}
/**
* Given a Factory Name return the generic type parameters of the factory (The actual repository class, and its properties class)o
*/
public static Type[] getEnvironmentRepositoryFactoryTypeParams(ConfigurableListableBeanFactory beanFactory, String factoryName) {
MethodMetadata methodMetadata = (MethodMetadata) beanFactory.getBeanDefinition(factoryName).getSource();
Class<?> factoryClass = null;
try {
factoryClass = Class.forName(methodMetadata.getReturnTypeName());
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
Optional<AnnotatedType> annotatedFactoryType = Arrays.stream(factoryClass.getAnnotatedInterfaces())
.filter(i -> {
ParameterizedType parameterizedType = (ParameterizedType) i.getType();
return parameterizedType.getRawType().equals(EnvironmentRepositoryFactory.class);
}).findFirst();
ParameterizedType factoryParameterizedType = (ParameterizedType) annotatedFactoryType
.orElse(factoryClass.getAnnotatedSuperclass()).getType();
return factoryParameterizedType.getActualTypeArguments();
}
}