public class SandboxInterceptor extends ValueFilterInterceptor
| Constructor and Description |
|---|
SandboxInterceptor(SandboxRules rules) |
SandboxInterceptor(SandboxRules rules,
ILoadPaths loadPaths) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
filter(java.lang.Object obj) |
protected java.lang.Object |
filterAccessor(java.lang.Object o,
java.lang.String accessor) |
protected ReturnValue |
filterReturnValue(ReturnValue returnValue) |
java.lang.Integer |
getMaxExecutionTimeSeconds() |
java.lang.Integer |
getMaxFutureThreadPoolSize() |
SandboxRules |
getRules() |
ReturnValue |
onGetBeanProperty(IInvoker invoker,
java.lang.Object receiver,
java.lang.String property)
Gets a Java Bean property
|
ReturnValue |
onGetInstanceField(IInvoker invoker,
java.lang.Object receiver,
java.lang.Class<?> receiverFormalType,
java.lang.String fieldName)
Get an instance field's value
|
ReturnValue |
onGetStaticField(IInvoker invoker,
java.lang.Class<?> receiver,
java.lang.String fieldName)
Get a static field's value
|
ReturnValue |
onInvokeConstructor(IInvoker invoker,
java.lang.Class<?> receiver,
java.lang.Object... args)
Invokes a constructor
|
ReturnValue |
onInvokeInstanceMethod(IInvoker invoker,
java.lang.Object receiver,
java.lang.Class<?> receiverFormalType,
java.lang.String method,
java.lang.Object... args)
Invokes an instance method
|
ReturnValue |
onInvokeStaticMethod(IInvoker invoker,
java.lang.Class<?> receiver,
java.lang.String method,
java.lang.Object... args)
Invokes a static method
|
byte[] |
onLoadClassPathResource(java.lang.String resourceName)
Loads a classpath resource
|
java.lang.String |
onReadSystemEnv(java.lang.String name)
Reads a Java environment variable
|
java.lang.String |
onReadSystemProperty(java.lang.String propertyName)
Reads a Java system property
|
void |
onSetBeanProperty(IInvoker invoker,
java.lang.Object receiver,
java.lang.String property,
java.lang.Object value)
Sets a Java Bean property
|
void |
validateFileRead(java.io.File file)
Validates that the file can be read
|
void |
validateFileWrite(java.io.File file)
Validates that the file can be written
|
void |
validateLoadModule(java.lang.String moduleName)
Validates the load of a module
|
void |
validateMaxExecutionTime()
Validates the execution time
|
void |
validateVeniceFunction(java.lang.String funcName)
Validates the invocation of a Venice function.
|
filterArgumentgetLoadPathspublic SandboxInterceptor(SandboxRules rules)
public SandboxInterceptor(SandboxRules rules, ILoadPaths loadPaths)
public SandboxRules getRules()
public ReturnValue onInvokeInstanceMethod(IInvoker invoker, java.lang.Object receiver, java.lang.Class<?> receiverFormalType, java.lang.String method, java.lang.Object... args) throws SecurityException
IInterceptoronInvokeInstanceMethod in interface IInterceptoronInvokeInstanceMethod in class ValueFilterInterceptorinvoker - the invokerreceiver - an objectreceiverFormalType - the formal type of the receiver (e.g a superclass)method - a methodargs - a list of argumentsSecurityException - if the instance method is not whitelistedpublic ReturnValue onInvokeStaticMethod(IInvoker invoker, java.lang.Class<?> receiver, java.lang.String method, java.lang.Object... args) throws SecurityException
IInterceptoronInvokeStaticMethod in interface IInterceptoronInvokeStaticMethod in class ValueFilterInterceptorinvoker - the invokerreceiver - a classmethod - a methodargs - a list of argumentsSecurityException - if the static method is not whitelistedpublic ReturnValue onInvokeConstructor(IInvoker invoker, java.lang.Class<?> receiver, java.lang.Object... args) throws SecurityException
IInterceptoronInvokeConstructor in interface IInterceptoronInvokeConstructor in class ValueFilterInterceptorinvoker - the invokerreceiver - a classargs - a list of argumentsSecurityException - if the constructor is not whitelistedpublic ReturnValue onGetBeanProperty(IInvoker invoker, java.lang.Object receiver, java.lang.String property) throws SecurityException
IInterceptoronGetBeanProperty in interface IInterceptoronGetBeanProperty in class ValueFilterInterceptorinvoker - the invokerreceiver - an objectproperty - a property nameSecurityException - if the bean property (instance method) is not whitelistedpublic void onSetBeanProperty(IInvoker invoker, java.lang.Object receiver, java.lang.String property, java.lang.Object value) throws SecurityException
IInterceptoronSetBeanProperty in interface IInterceptoronSetBeanProperty in class ValueFilterInterceptorinvoker - the invokerreceiver - an objectproperty - a property namevalue - a property valueSecurityException - if the bean property (instance method) is not whitelistedpublic ReturnValue onGetStaticField(IInvoker invoker, java.lang.Class<?> receiver, java.lang.String fieldName) throws SecurityException
IInterceptoronGetStaticField in interface IInterceptoronGetStaticField in class ValueFilterInterceptorinvoker - the invokerreceiver - a classfieldName - a field nameSecurityException - if the static field is not whitelistedpublic ReturnValue onGetInstanceField(IInvoker invoker, java.lang.Object receiver, java.lang.Class<?> receiverFormalType, java.lang.String fieldName) throws SecurityException
IInterceptoronGetInstanceField in interface IInterceptoronGetInstanceField in class ValueFilterInterceptorinvoker - the invokerreceiver - an objectreceiverFormalType - the formal type of the receiver (e.g a superclass)fieldName - a field nameSecurityException - if the instance field is not whitelistedpublic byte[] onLoadClassPathResource(java.lang.String resourceName)
throws SecurityException
IInterceptoronLoadClassPathResource in interface IInterceptoronLoadClassPathResource in class InterceptorresourceName - a resource name (e.g.: /foo/org/image.png)SecurityException - if the classpath resource is not whitelistedpublic java.lang.String onReadSystemProperty(java.lang.String propertyName)
throws SecurityException
IInterceptoronReadSystemProperty in interface IInterceptoronReadSystemProperty in class InterceptorpropertyName - a property name (e.g: user.home)SecurityException - if the property is not whitelistedpublic java.lang.String onReadSystemEnv(java.lang.String name)
throws SecurityException
IInterceptoronReadSystemEnv in interface IInterceptoronReadSystemEnv in class Interceptorname - a variable name (e.g: USER)SecurityException - if the variable is not whitelistedpublic void validateVeniceFunction(java.lang.String funcName)
throws SecurityException
IInterceptorvalidateVeniceFunction in interface IInterceptorvalidateVeniceFunction in class InterceptorfuncName - A venice function nameSecurityException - if the function is blacklisted and not
allowed to be invoked.public void validateLoadModule(java.lang.String moduleName)
throws SecurityException
IInterceptorvalidateLoadModule in interface IInterceptorvalidateLoadModule in class InterceptormoduleName - the module nameSecurityException - if the module is blacklistedpublic void validateMaxExecutionTime()
throws SecurityException
IInterceptorvalidateMaxExecutionTime in interface IInterceptorvalidateMaxExecutionTime in class InterceptorSecurityException - if the execution time exceeds the configured limit.public void validateFileRead(java.io.File file)
throws SecurityException
IInterceptorvalidateFileRead in interface IInterceptorvalidateFileRead in class Interceptorfile - A fileSecurityException - if the file can not be read.public void validateFileWrite(java.io.File file)
throws SecurityException
IInterceptorvalidateFileWrite in interface IInterceptorvalidateFileWrite in class Interceptorfile - A fileSecurityException - if the file can not be written.public java.lang.Integer getMaxExecutionTimeSeconds()
getMaxExecutionTimeSeconds in interface IInterceptorgetMaxExecutionTimeSeconds in class InterceptorSandbox is allowed to run.public java.lang.Integer getMaxFutureThreadPoolSize()
getMaxFutureThreadPoolSize in interface IInterceptorgetMaxFutureThreadPoolSize in class InterceptorSandbox is allowed to use.protected ReturnValue filterReturnValue(ReturnValue returnValue)
filterReturnValue in class ValueFilterInterceptorprotected java.lang.Object filter(java.lang.Object obj)
filter in class ValueFilterInterceptorprotected java.lang.Object filterAccessor(java.lang.Object o,
java.lang.String accessor)
filterAccessor in class ValueFilterInterceptor