Class ClassFilter


  • public abstract class ClassFilter
    extends Object
    Restricts what classes can be received through remoting. The same filter is also applied by Jenkins core for XStream serialization.
    Since:
    2.53
    Author:
    Kohsuke Kawaguchi
    • Field Detail

      • FILE_OVERRIDE_LOCATION_PROPERTY

        @Deprecated
        public static final String FILE_OVERRIDE_LOCATION_PROPERTY
        Deprecated.
        Property to set to override the blacklist used by STANDARD with a different set. The location should point to a a file containing regular expressions (one per line) of classes to blacklist. If this property is set but the file can not be read the default blacklist will be used.
        Since:
        2.53.2
        See Also:
        Constant Field Values
      • DEFAULT

        public static final ClassFilter DEFAULT
        The currently used default. Defaults to STANDARD.
      • STANDARD

        public static final ClassFilter STANDARD
        A set of sensible default filtering rules to apply, based on a configurable blacklist.
      • NONE

        public static final ClassFilter NONE
        No filtering whatsoever.
    • Constructor Detail

      • ClassFilter

        public ClassFilter()
    • Method Detail

      • isBlacklisted

        public boolean isBlacklisted​(@NonNull
                                     String name)
        Whether a given class should be blocked, before even attempting to load that class.
        Parameters:
        name - Class.getName()
        Returns:
        false by default; override to return true to blacklist this class
      • isBlacklisted

        public boolean isBlacklisted​(@NonNull
                                     Class<?> c)
        Whether a given class should be blocked, after having loaded that class.
        Parameters:
        c - a loaded class
        Returns:
        false by default; override to return true to blacklist this class
      • setDefault

        public static void setDefault​(@NonNull
                                      ClassFilter filter)
        Changes the effective value of DEFAULT.
        Parameters:
        filter - a new default to set; may or may not delegate to STANDARD
        Since:
        3.16