Interface UnsafeInitialContextEnvFilter

    • Method Summary

      All Methods Instance Methods Abstract 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

        java.util.Hashtable<?,​?> safeEnv​(java.util.Hashtable<?,​?> env,
                                               java.lang.Class<?> materializingClass,
                                               PropertiesConfig pcfg)
                                        throws ForbiddenInitialContextException
        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). 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.
        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.