Package org.kohsuke.groovy.sandbox.impl
Class RejectEverythingInterceptor
java.lang.Object
org.kohsuke.groovy.sandbox.GroovyInterceptor
org.kohsuke.groovy.sandbox.impl.RejectEverythingInterceptor
An interceptor used by
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().
-
Nested Class Summary
Nested classes/interfaces inherited from class org.kohsuke.groovy.sandbox.GroovyInterceptor
GroovyInterceptor.Invoker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononGetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index) Intercepts an array access, like "z=foo[bar]"onGetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute) Intercepts an attribute access, like "z=foo.@bar"onGetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property) Intercepts a property access, like "z=foo.bar"onMethodCall(GroovyInterceptor.Invoker invoker, Object receiver, String method, Object... args) Intercepts an instance method call on some object of the form "foo.bar(...)"onNewInstance(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) Intercepts an object instantiation, like "new Receiver(...)"onSetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index, Object value) Intercepts an attribute assignment like "foo[bar]=z"onSetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute, Object value) Intercepts an attribute assignment like "foo.@bar=z"onSetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property, Object value) Intercepts a property assignment like "foo.bar=z"onStaticCall(GroovyInterceptor.Invoker invoker, Class receiver, String method, Object... args) Intercepts a static method call on some class, like "Class.forName(...)".onSuperCall(GroovyInterceptor.Invoker invoker, Class senderType, Object receiver, String method, Object... args) Intercepts an super method call, like "super.foo(...)"voidonSuperConstructor(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) Intercepts asuper(…)call from a constructor.Methods inherited from class org.kohsuke.groovy.sandbox.GroovyInterceptor
getApplicableInterceptors, register, unregister
-
Constructor Details
-
RejectEverythingInterceptor
public RejectEverythingInterceptor()
-
-
Method Details
-
onMethodCall
public Object onMethodCall(GroovyInterceptor.Invoker invoker, Object receiver, String method, Object... args) throws Throwable Description copied from class:GroovyInterceptorIntercepts an instance method call on some object of the form "foo.bar(...)"- Overrides:
onMethodCallin classGroovyInterceptor- Throws:
Throwable
-
onStaticCall
public Object onStaticCall(GroovyInterceptor.Invoker invoker, Class receiver, String method, Object... args) throws Throwable Description copied from class:GroovyInterceptorIntercepts a static method call on some class, like "Class.forName(...)". Note that Groovy doesn't clearly differentiate static method calls from instance method calls. If calls are determined to be static at compile-time, you get this method called, but method calls whose receivers areClasscan invoke static methods, too (that is,x=Integer.class;x.valueOf(5)results inonMethodCall(invoker,Integer.class,"valueOf",5)- Overrides:
onStaticCallin classGroovyInterceptor- Throws:
Throwable
-
onNewInstance
public Object onNewInstance(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) throws Throwable Description copied from class:GroovyInterceptorIntercepts an object instantiation, like "new Receiver(...)"- Overrides:
onNewInstancein classGroovyInterceptor- Throws:
Throwable
-
onSuperCall
public Object onSuperCall(GroovyInterceptor.Invoker invoker, Class senderType, Object receiver, String method, Object... args) throws Throwable Description copied from class:GroovyInterceptorIntercepts an super method call, like "super.foo(...)"- Overrides:
onSuperCallin classGroovyInterceptor- Throws:
Throwable
-
onSuperConstructor
public void onSuperConstructor(GroovyInterceptor.Invoker invoker, Class receiver, Object... args) throws Throwable Description copied from class:GroovyInterceptorIntercepts asuper(…)call from a constructor.- Overrides:
onSuperConstructorin classGroovyInterceptor- Throws:
Throwable
-
onGetProperty
public Object onGetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property) throws Throwable Description copied from class:GroovyInterceptorIntercepts a property access, like "z=foo.bar"- Overrides:
onGetPropertyin classGroovyInterceptorreceiver- 'foo' in the above example, the object whose property is accessed.property- 'bar' in the above example, the name of the property- Throws:
Throwable
-
onSetProperty
public Object onSetProperty(GroovyInterceptor.Invoker invoker, Object receiver, String property, Object value) throws Throwable Description copied from class:GroovyInterceptorIntercepts a property assignment like "foo.bar=z"- Overrides:
onSetPropertyin classGroovyInterceptorreceiver- '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.- Returns:
- The result of the assignment expression. Normally, you should return the same object as
value. - Throws:
Throwable
-
onGetAttribute
public Object onGetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute) throws Throwable Description copied from class:GroovyInterceptorIntercepts an attribute access, like "z=foo.@bar"- Overrides:
onGetAttributein classGroovyInterceptorreceiver- 'foo' in the above example, the object whose attribute is accessed.attribute- 'bar' in the above example, the name of the attribute- Throws:
Throwable
-
onSetAttribute
public Object onSetAttribute(GroovyInterceptor.Invoker invoker, Object receiver, String attribute, Object value) throws Throwable Description copied from class:GroovyInterceptorIntercepts an attribute assignment like "foo.@bar=z"- Overrides:
onSetAttributein classGroovyInterceptorreceiver- '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.- Returns:
- The result of the assignment expression. Normally, you should return the same object as
value. - Throws:
Throwable
-
onGetArray
public Object onGetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index) throws Throwable Description copied from class:GroovyInterceptorIntercepts an array access, like "z=foo[bar]"- Overrides:
onGetArrayin classGroovyInterceptorreceiver- 'foo' in the above example, the array-like object.index- 'bar' in the above example, the object that acts as an index.- Throws:
Throwable
-
onSetArray
public Object onSetArray(GroovyInterceptor.Invoker invoker, Object receiver, Object index, Object value) throws Throwable Description copied from class:GroovyInterceptorIntercepts an attribute assignment like "foo[bar]=z"- Overrides:
onSetArrayin classGroovyInterceptorreceiver- '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.- Returns:
- The result of the assignment expression. Normally, you should return the same object as
value. - Throws:
Throwable
-