Package com.mchange.v2.naming
Class AlwaysReplaceWithDefaultUnsafeInitialContextEnvFilter
- java.lang.Object
-
- com.mchange.v2.naming.AlwaysReplaceWithDefaultUnsafeInitialContextEnvFilter
-
- All Implemented Interfaces:
UnsafeInitialContextEnvFilter
public class AlwaysReplaceWithDefaultUnsafeInitialContextEnvFilter extends java.lang.Object implements UnsafeInitialContextEnvFilter
-
-
Constructor Summary
Constructors Constructor Description AlwaysReplaceWithDefaultUnsafeInitialContextEnvFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Hashtable<?,?>safeEnv(java.util.Hashtable<?,?> env, java.lang.Class<?> materializingClass, PropertiesConfig pcfg)The filter should be executed once per InitialContext construction, when the constructor of the InitialContext would take an untrusted, potentially unsafe environment (usually because it is derived from deserializing or dereferencing, the source bytes of which might be tampered with).
-
-
-
Method Detail
-
safeEnv
public java.util.Hashtable<?,?> safeEnv(java.util.Hashtable<?,?> env, java.lang.Class<?> materializingClass, PropertiesConfig pcfg) throws ForbiddenInitialContextExceptionDescription copied from interface:UnsafeInitialContextEnvFilterThe filter should be executed once per InitialContext construction, when the constructor of the InitialContext would take an untrusted, potentially unsafe environment (usually because it is derived from deserializing or dereferencing, the source bytes of which might be tampered with). It is not necessarily called once per lookup, as InitialContext instances may be retained for many lookups. Note: the returned environment must replace the original everywhere downstream, not only in the InitialContext constructor. applications that inadvertantly use a leaked reference to the unsanitized environment are subject to compromise by the unsanitized environment.- Specified by:
safeEnvin interfaceUnsafeInitialContextEnvFilter- Parameters:
env- the untrusted environment, as it arrived on the materializing object.materializingClass- the class that materializes an unsafe InitialContext environment and so must sanitize it before any lookup, or passing references to outside contexts.pcfg- can be null, a configuration source.- Returns:
- the environment to use: env itself to accept it as-is, a filtered copy to accept
part of it, or null to discard it entirely and use the JVM's default
environment, as
new InitialContext()would. - Throws:
ForbiddenInitialContextException- to refuse the lookup altogether. Note the difference from returning null: null proceeds against the default environment, this does not proceed at all.
-
-