public class RejectEverythingInterceptor extends GroovyInterceptor
GroovyInterceptor.Invoker to reject any sandbox-transformed code that is executed when
GroovyInterceptor.getApplicableInterceptors() is empty, under the assumption that there is no legitimate
reason to run sandbox-transformed code outside of the sandbox.
Parameters of overridden methods with type Object are assumed to be unsafe and must be handled carefully to
avoid security vulnerabilities. Safe operations include casting these objects to known-safe final classes such as
String, or calling known-safe final methods such as Object.getClass().
GroovyInterceptor.Invoker| Constructor and Description |
|---|
RejectEverythingInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
Object |
onGetArray(GroovyInterceptor.Invoker invoker,
Object receiver,
Object index)
Intercepts an array access, like "z=foo[bar]"
|
Object |
onGetAttribute(GroovyInterceptor.Invoker invoker,
Object receiver,
String attribute)
Intercepts an attribute access, like "z=foo.@bar"
|
Object |
onGetProperty(GroovyInterceptor.Invoker invoker,
Object receiver,
String property)
Intercepts a property access, like "z=foo.bar"
|
Object |
onMethodCall(GroovyInterceptor.Invoker invoker,
Object receiver,
String method,
Object... args)
Intercepts an instance method call on some object of the form "foo.bar(...)"
|
Object |
onNewInstance(GroovyInterceptor.Invoker invoker,
Class receiver,
Object... args)
Intercepts an object instantiation, like "new Receiver(...)"
|
Object |
onSetArray(GroovyInterceptor.Invoker invoker,
Object receiver,
Object index,
Object value)
Intercepts an attribute assignment like "foo[bar]=z"
|
Object |
onSetAttribute(GroovyInterceptor.Invoker invoker,
Object receiver,
String attribute,
Object value)
Intercepts an attribute assignment like "foo.@bar=z"
|
Object |
onSetProperty(GroovyInterceptor.Invoker invoker,
Object receiver,
String property,
Object value)
Intercepts a property assignment like "foo.bar=z"
|
Object |
onStaticCall(GroovyInterceptor.Invoker invoker,
Class receiver,
String method,
Object... args)
Intercepts a static method call on some class, like "Class.forName(...)".
|
Object |
onSuperCall(GroovyInterceptor.Invoker invoker,
Class senderType,
Object receiver,
String method,
Object... args)
Intercepts an super method call, like "super.foo(...)"
|
void |
onSuperConstructor(GroovyInterceptor.Invoker invoker,
Class receiver,
Object... args)
Intercepts a
super(…) call from a constructor. |
getApplicableInterceptors, register, unregisterpublic Object onMethodCall(GroovyInterceptor.Invoker invoker, Object receiver, String method, Object... args) throws Throwable
GroovyInterceptoronMethodCall in class GroovyInterceptorThrowablepublic Object onStaticCall(GroovyInterceptor.Invoker invoker, Class receiver, String method, Object... args) throws Throwable
GroovyInterceptorClass can invoke static methods, too
(that is, x=Integer.class;x.valueOf(5) results in onMethodCall(invoker,Integer.class,"valueOf",5)onStaticCall in class GroovyInterceptorThrowablepublic Object onNewInstance(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) throws Throwable
GroovyInterceptoronNewInstance in class GroovyInterceptorThrowablepublic Object onSuperCall(GroovyInterceptor.Invoker invoker, Class senderType, Object receiver, String method, Object... args) throws Throwable
GroovyInterceptoronSuperCall in class GroovyInterceptorThrowablepublic void onSuperConstructor(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) throws Throwable
GroovyInterceptorsuper(…) call from a constructor.onSuperConstructor in class GroovyInterceptorThrowablepublic Object onGetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property) throws Throwable
GroovyInterceptoronGetProperty in class GroovyInterceptorreceiver - 'foo' in the above example, the object whose property is accessed.property - 'bar' in the above example, the name of the propertyThrowablepublic Object onSetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property, Object value) throws Throwable
GroovyInterceptoronSetProperty in class GroovyInterceptorreceiver - 'foo' in the above example, the object whose property is accessed.property - 'bar' in the above example, the name of the propertyvalue - The value to be assigned.value.Throwablepublic Object onGetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute) throws Throwable
GroovyInterceptoronGetAttribute in class GroovyInterceptorreceiver - 'foo' in the above example, the object whose attribute is accessed.attribute - 'bar' in the above example, the name of the attributeThrowablepublic Object onSetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute, Object value) throws Throwable
GroovyInterceptoronSetAttribute in class GroovyInterceptorreceiver - 'foo' in the above example, the object whose attribute is accessed.attribute - 'bar' in the above example, the name of the attributevalue - The value to be assigned.value.Throwablepublic Object onGetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index) throws Throwable
GroovyInterceptoronGetArray in class GroovyInterceptorreceiver - 'foo' in the above example, the array-like object.index - 'bar' in the above example, the object that acts as an index.Throwablepublic Object onSetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index, Object value) throws Throwable
GroovyInterceptoronSetArray in class GroovyInterceptorreceiver - 'foo' in the above example, the array-like object.index - 'bar' in the above example, the object that acts as an index.value - The value to be assigned.value.ThrowableCopyright © 2016–2022. All rights reserved.