Class SecureASTCustomizer.SecuringCodeVisitor
java.lang.Object
org.codehaus.groovy.control.customizers.SecureASTCustomizer.SecuringCodeVisitor
- All Implemented Interfaces:
GroovyCodeVisitor
- Enclosing class:
- SecureASTCustomizer
protected class SecureASTCustomizer.SecuringCodeVisitor extends java.lang.Object implements GroovyCodeVisitor
This visitor directly implements the
GroovyCodeVisitor
interface instead of using the CodeVisitorSupport
class to make sure that future features of the language gets managed by this visitor. Thus,
adding a new feature would result in a compilation error if this visitor is not updated.-
Constructor Summary
Constructors Modifier Constructor Description protected
SecuringCodeVisitor()
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor
visitEmptyExpression, visitListOfExpressions
-
Constructor Details
-
SecuringCodeVisitor
protected SecuringCodeVisitor()
-
-
Method Details
-
assertStatementAuthorized
Checks that a given statement is either in the allowed list or not in the disallowed list.- Parameters:
statement
- the statement to be checked- Throws:
java.lang.SecurityException
- if usage of this statement class is forbidden
-
assertExpressionAuthorized
protected void assertExpressionAuthorized(Expression expression) throws java.lang.SecurityExceptionChecks that a given expression is either in the allowed list or not in the disallowed list.- Parameters:
expression
- the expression to be checked- Throws:
java.lang.SecurityException
- if usage of this expression class is forbidden
-
getExpressionType
-
assertTokenAuthorized
Checks that a given token is either in the allowed list or not in the disallowed list.- Parameters:
token
- the token to be checked- Throws:
java.lang.SecurityException
- if usage of this token is forbidden
-
visitBlockStatement
- Specified by:
visitBlockStatement
in interfaceGroovyCodeVisitor
-
visitForLoop
- Specified by:
visitForLoop
in interfaceGroovyCodeVisitor
-
visitWhileLoop
- Specified by:
visitWhileLoop
in interfaceGroovyCodeVisitor
-
visitDoWhileLoop
- Specified by:
visitDoWhileLoop
in interfaceGroovyCodeVisitor
-
visitIfElse
- Specified by:
visitIfElse
in interfaceGroovyCodeVisitor
-
visitExpressionStatement
- Specified by:
visitExpressionStatement
in interfaceGroovyCodeVisitor
-
visitReturnStatement
- Specified by:
visitReturnStatement
in interfaceGroovyCodeVisitor
-
visitAssertStatement
- Specified by:
visitAssertStatement
in interfaceGroovyCodeVisitor
-
visitTryCatchFinally
- Specified by:
visitTryCatchFinally
in interfaceGroovyCodeVisitor
-
visitEmptyStatement
- Specified by:
visitEmptyStatement
in interfaceGroovyCodeVisitor
-
visitSwitch
- Specified by:
visitSwitch
in interfaceGroovyCodeVisitor
-
visitCaseStatement
- Specified by:
visitCaseStatement
in interfaceGroovyCodeVisitor
-
visitBreakStatement
- Specified by:
visitBreakStatement
in interfaceGroovyCodeVisitor
-
visitContinueStatement
- Specified by:
visitContinueStatement
in interfaceGroovyCodeVisitor
-
visitThrowStatement
- Specified by:
visitThrowStatement
in interfaceGroovyCodeVisitor
-
visitSynchronizedStatement
- Specified by:
visitSynchronizedStatement
in interfaceGroovyCodeVisitor
-
visitCatchStatement
- Specified by:
visitCatchStatement
in interfaceGroovyCodeVisitor
-
visitMethodCallExpression
- Specified by:
visitMethodCallExpression
in interfaceGroovyCodeVisitor
-
visitStaticMethodCallExpression
- Specified by:
visitStaticMethodCallExpression
in interfaceGroovyCodeVisitor
-
visitConstructorCallExpression
- Specified by:
visitConstructorCallExpression
in interfaceGroovyCodeVisitor
-
visitTernaryExpression
- Specified by:
visitTernaryExpression
in interfaceGroovyCodeVisitor
-
visitShortTernaryExpression
- Specified by:
visitShortTernaryExpression
in interfaceGroovyCodeVisitor
-
visitBinaryExpression
- Specified by:
visitBinaryExpression
in interfaceGroovyCodeVisitor
-
visitPrefixExpression
- Specified by:
visitPrefixExpression
in interfaceGroovyCodeVisitor
-
visitPostfixExpression
- Specified by:
visitPostfixExpression
in interfaceGroovyCodeVisitor
-
visitBooleanExpression
- Specified by:
visitBooleanExpression
in interfaceGroovyCodeVisitor
-
visitClosureExpression
- Specified by:
visitClosureExpression
in interfaceGroovyCodeVisitor
-
visitLambdaExpression
- Specified by:
visitLambdaExpression
in interfaceGroovyCodeVisitor
-
visitTupleExpression
- Specified by:
visitTupleExpression
in interfaceGroovyCodeVisitor
-
visitMapExpression
- Specified by:
visitMapExpression
in interfaceGroovyCodeVisitor
-
visitMapEntryExpression
- Specified by:
visitMapEntryExpression
in interfaceGroovyCodeVisitor
-
visitListExpression
- Specified by:
visitListExpression
in interfaceGroovyCodeVisitor
-
visitRangeExpression
- Specified by:
visitRangeExpression
in interfaceGroovyCodeVisitor
-
visitPropertyExpression
- Specified by:
visitPropertyExpression
in interfaceGroovyCodeVisitor
-
visitAttributeExpression
- Specified by:
visitAttributeExpression
in interfaceGroovyCodeVisitor
-
visitFieldExpression
- Specified by:
visitFieldExpression
in interfaceGroovyCodeVisitor
-
visitMethodPointerExpression
- Specified by:
visitMethodPointerExpression
in interfaceGroovyCodeVisitor
-
visitMethodReferenceExpression
- Specified by:
visitMethodReferenceExpression
in interfaceGroovyCodeVisitor
-
visitConstantExpression
- Specified by:
visitConstantExpression
in interfaceGroovyCodeVisitor
-
visitClassExpression
- Specified by:
visitClassExpression
in interfaceGroovyCodeVisitor
-
visitVariableExpression
- Specified by:
visitVariableExpression
in interfaceGroovyCodeVisitor
-
visitDeclarationExpression
- Specified by:
visitDeclarationExpression
in interfaceGroovyCodeVisitor
-
visitGStringExpression
- Specified by:
visitGStringExpression
in interfaceGroovyCodeVisitor
-
visitArrayExpression
- Specified by:
visitArrayExpression
in interfaceGroovyCodeVisitor
-
visitSpreadExpression
- Specified by:
visitSpreadExpression
in interfaceGroovyCodeVisitor
-
visitSpreadMapExpression
- Specified by:
visitSpreadMapExpression
in interfaceGroovyCodeVisitor
-
visitNotExpression
- Specified by:
visitNotExpression
in interfaceGroovyCodeVisitor
-
visitUnaryMinusExpression
- Specified by:
visitUnaryMinusExpression
in interfaceGroovyCodeVisitor
-
visitUnaryPlusExpression
- Specified by:
visitUnaryPlusExpression
in interfaceGroovyCodeVisitor
-
visitBitwiseNegationExpression
- Specified by:
visitBitwiseNegationExpression
in interfaceGroovyCodeVisitor
-
visitCastExpression
- Specified by:
visitCastExpression
in interfaceGroovyCodeVisitor
-
visitArgumentlistExpression
- Specified by:
visitArgumentlistExpression
in interfaceGroovyCodeVisitor
-
visitClosureListExpression
- Specified by:
visitClosureListExpression
in interfaceGroovyCodeVisitor
-
visitBytecodeExpression
- Specified by:
visitBytecodeExpression
in interfaceGroovyCodeVisitor
-