Class Whitelist
java.lang.Object
org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist
- Direct Known Subclasses:
ClassLoaderWhitelist,EnumeratingWhitelist,PermitAllWhitelist
Determines which methods and similar members which scripts may call.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisAllowedGetEnvSystemMethod(Method m, Object[] args) Return true if the given method is allowed System.getEnv()abstract booleanpermitsConstructor(Constructor<?> constructor, Object[] args) abstract booleanpermitsFieldGet(Field field, Object receiver) abstract booleanpermitsFieldSet(Field field, Object receiver, Object value) abstract booleanpermitsMethod(Method method, Object receiver, Object[] args) Checks whether a given virtual method may be invoked.abstract booleanpermitsStaticFieldGet(Field field) abstract booleanpermitsStaticFieldSet(Field field, Object value) abstract booleanpermitsStaticMethod(Method method, Object[] args) voidsetGetEnvWhitelistRegex(List<String> getEnvWhitelistRegex) Set a list of regex of environment variables name that is allowed to be called
-
Constructor Details
-
Whitelist
public Whitelist()
-
-
Method Details
-
setGetEnvWhitelistRegex
Set a list of regex of environment variables name that is allowed to be called- Parameters:
getEnvWhitelistRegex- the regex list
-
isAllowedGetEnvSystemMethod
Return true if the given method is allowed System.getEnv()- Parameters:
m- the methodargs- the method arguments- Returns:
- true if allowed, false otherwise
-
permitsMethod
public abstract boolean permitsMethod(@Nonnull Method method, @Nonnull Object receiver, @Nonnull Object[] args) Checks whether a given virtual method may be invoked.Note that
methodshould not be implementing or overriding a method in a supertype; in such a case the caller must pass that supertype method instead. In other words, call site selection is the responsibility of the caller (such asGroovySandbox), not the whitelist.- Parameters:
method- a method defined in the JVMreceiver-this, the receiver of the method callargs- zero or more arguments- Returns:
- true to allow the method to be called, false to reject it
-
permitsConstructor
public abstract boolean permitsConstructor(@Nonnull Constructor<?> constructor, @Nonnull Object[] args) -
permitsStaticMethod
-
permitsFieldGet
-
permitsFieldSet
-
permitsStaticFieldGet
-
permitsStaticFieldSet
-