Package hudson.remoting
Class ClassFilter
java.lang.Object
hudson.remoting.ClassFilter
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
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClassFilterThe currently used default.static final StringDeprecated.usesetDefault(hudson.remoting.ClassFilter)as neededstatic final ClassFilterNo filtering whatsoever.static final ClassFilterA set of sensible default filtering rules to apply, based on a configurable blacklist. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendDefaultFilter(Pattern filter) Deprecated.usesetDefault(hudson.remoting.ClassFilter)as neededfinal Class<?>API version ofisBlacklisted(Class)SPI.final StringAPI version ofisBlacklisted(String)SPI.booleanisBlacklisted(Class<?> c) Whether a given class should be blocked, after having loaded that class.booleanisBlacklisted(String name) Whether a given class should be blocked, before even attempting to load that class.static voidsetDefault(ClassFilter filter) Changes the effective value ofDEFAULT.
-
Field Details
-
FILE_OVERRIDE_LOCATION_PROPERTY
Deprecated.usesetDefault(hudson.remoting.ClassFilter)as neededProperty to set to override the blacklist used bySTANDARDwith 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:
-
DEFAULT
The currently used default. Defaults toSTANDARD. -
STANDARD
A set of sensible default filtering rules to apply, based on a configurable blacklist. -
NONE
No filtering whatsoever.
-
-
Constructor Details
-
ClassFilter
public ClassFilter()
-
-
Method Details
-
isBlacklisted
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
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
-
check
API version ofisBlacklisted(String)SPI.- Returns:
- the same
name - Throws:
SecurityException- if it is blacklisted
-
check
API version ofisBlacklisted(Class)SPI.- Returns:
- the same
c - Throws:
SecurityException- if it is blacklisted
-
setDefault
Changes the effective value ofDEFAULT.- Parameters:
filter- a new default to set; may or may not delegate toSTANDARD- Since:
- 3.16
-
appendDefaultFilter
@Deprecated public static void appendDefaultFilter(Pattern filter) throws ClassFilter.ClassFilterException Deprecated.usesetDefault(hudson.remoting.ClassFilter)as neededAdds an additional exclusion toSTANDARD. Does nothing if the default list has already been customized viaFILE_OVERRIDE_LOCATION_PROPERTY. This API is not supposed to be used anywhere outside Jenkins core, calls for other sources may be rejected later.- Parameters:
filter- a regular expression forClass.getName()which, if matched according toMatcher.matches(), will blacklist the class- Throws:
ClassFilter.ClassFilterException- Filter pattern cannot be applied. It means either unexpected processing error or rejection by the internal logic.- Since:
- 3.11
-
appendDefaultFilter(java.util.regex.Pattern).