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 Object implements GroovyCodeVisitor
This visitor directly implements theGroovyCodeVisitor
interface instead of using theCodeVisitorSupport
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
-
-
-
-
Method Detail
-
assertStatementAuthorized
protected void assertStatementAuthorized(Statement statement) throws SecurityException
Checks that a given statement is either in the whitelist or not in the blacklist.- Parameters:
statement
- the statement to be checked- Throws:
SecurityException
- if usage of this statement class is forbidden
-
assertExpressionAuthorized
protected void assertExpressionAuthorized(Expression expression) throws SecurityException
Checks that a given expression is either in the whitelist or not in the blacklist.- Parameters:
expression
- the expression to be checked- Throws:
SecurityException
- if usage of this expression class is forbidden
-
assertTokenAuthorized
protected void assertTokenAuthorized(Token token) throws SecurityException
Checks that a given token is either in the whitelist or not in the blacklist.- Parameters:
token
- the token to be checked- Throws:
SecurityException
- if usage of this token is forbidden
-
visitBlockStatement
public void visitBlockStatement(BlockStatement block)
- Specified by:
visitBlockStatement
in interfaceGroovyCodeVisitor
-
visitForLoop
public void visitForLoop(ForStatement forLoop)
- Specified by:
visitForLoop
in interfaceGroovyCodeVisitor
-
visitWhileLoop
public void visitWhileLoop(WhileStatement loop)
- Specified by:
visitWhileLoop
in interfaceGroovyCodeVisitor
-
visitDoWhileLoop
public void visitDoWhileLoop(DoWhileStatement loop)
- Specified by:
visitDoWhileLoop
in interfaceGroovyCodeVisitor
-
visitIfElse
public void visitIfElse(IfStatement ifElse)
- Specified by:
visitIfElse
in interfaceGroovyCodeVisitor
-
visitExpressionStatement
public void visitExpressionStatement(ExpressionStatement statement)
- Specified by:
visitExpressionStatement
in interfaceGroovyCodeVisitor
-
visitReturnStatement
public void visitReturnStatement(ReturnStatement statement)
- Specified by:
visitReturnStatement
in interfaceGroovyCodeVisitor
-
visitAssertStatement
public void visitAssertStatement(AssertStatement statement)
- Specified by:
visitAssertStatement
in interfaceGroovyCodeVisitor
-
visitTryCatchFinally
public void visitTryCatchFinally(TryCatchStatement statement)
- Specified by:
visitTryCatchFinally
in interfaceGroovyCodeVisitor
-
visitEmptyStatement
public void visitEmptyStatement(EmptyStatement statement)
- Specified by:
visitEmptyStatement
in interfaceGroovyCodeVisitor
-
visitSwitch
public void visitSwitch(SwitchStatement statement)
- Specified by:
visitSwitch
in interfaceGroovyCodeVisitor
-
visitCaseStatement
public void visitCaseStatement(CaseStatement statement)
- Specified by:
visitCaseStatement
in interfaceGroovyCodeVisitor
-
visitBreakStatement
public void visitBreakStatement(BreakStatement statement)
- Specified by:
visitBreakStatement
in interfaceGroovyCodeVisitor
-
visitContinueStatement
public void visitContinueStatement(ContinueStatement statement)
- Specified by:
visitContinueStatement
in interfaceGroovyCodeVisitor
-
visitThrowStatement
public void visitThrowStatement(ThrowStatement statement)
- Specified by:
visitThrowStatement
in interfaceGroovyCodeVisitor
-
visitSynchronizedStatement
public void visitSynchronizedStatement(SynchronizedStatement statement)
- Specified by:
visitSynchronizedStatement
in interfaceGroovyCodeVisitor
-
visitCatchStatement
public void visitCatchStatement(CatchStatement statement)
- Specified by:
visitCatchStatement
in interfaceGroovyCodeVisitor
-
visitMethodCallExpression
public void visitMethodCallExpression(MethodCallExpression call)
- Specified by:
visitMethodCallExpression
in interfaceGroovyCodeVisitor
-
visitStaticMethodCallExpression
public void visitStaticMethodCallExpression(StaticMethodCallExpression call)
- Specified by:
visitStaticMethodCallExpression
in interfaceGroovyCodeVisitor
-
visitConstructorCallExpression
public void visitConstructorCallExpression(ConstructorCallExpression call)
- Specified by:
visitConstructorCallExpression
in interfaceGroovyCodeVisitor
-
visitTernaryExpression
public void visitTernaryExpression(TernaryExpression expression)
- Specified by:
visitTernaryExpression
in interfaceGroovyCodeVisitor
-
visitShortTernaryExpression
public void visitShortTernaryExpression(ElvisOperatorExpression expression)
- Specified by:
visitShortTernaryExpression
in interfaceGroovyCodeVisitor
-
visitBinaryExpression
public void visitBinaryExpression(BinaryExpression expression)
- Specified by:
visitBinaryExpression
in interfaceGroovyCodeVisitor
-
visitPrefixExpression
public void visitPrefixExpression(PrefixExpression expression)
- Specified by:
visitPrefixExpression
in interfaceGroovyCodeVisitor
-
visitPostfixExpression
public void visitPostfixExpression(PostfixExpression expression)
- Specified by:
visitPostfixExpression
in interfaceGroovyCodeVisitor
-
visitBooleanExpression
public void visitBooleanExpression(BooleanExpression expression)
- Specified by:
visitBooleanExpression
in interfaceGroovyCodeVisitor
-
visitClosureExpression
public void visitClosureExpression(ClosureExpression expression)
- Specified by:
visitClosureExpression
in interfaceGroovyCodeVisitor
-
visitLambdaExpression
public void visitLambdaExpression(LambdaExpression expression)
- Specified by:
visitLambdaExpression
in interfaceGroovyCodeVisitor
-
visitTupleExpression
public void visitTupleExpression(TupleExpression expression)
- Specified by:
visitTupleExpression
in interfaceGroovyCodeVisitor
-
visitMapExpression
public void visitMapExpression(MapExpression expression)
- Specified by:
visitMapExpression
in interfaceGroovyCodeVisitor
-
visitMapEntryExpression
public void visitMapEntryExpression(MapEntryExpression expression)
- Specified by:
visitMapEntryExpression
in interfaceGroovyCodeVisitor
-
visitListExpression
public void visitListExpression(ListExpression expression)
- Specified by:
visitListExpression
in interfaceGroovyCodeVisitor
-
visitRangeExpression
public void visitRangeExpression(RangeExpression expression)
- Specified by:
visitRangeExpression
in interfaceGroovyCodeVisitor
-
visitPropertyExpression
public void visitPropertyExpression(PropertyExpression expression)
- Specified by:
visitPropertyExpression
in interfaceGroovyCodeVisitor
-
visitAttributeExpression
public void visitAttributeExpression(AttributeExpression expression)
- Specified by:
visitAttributeExpression
in interfaceGroovyCodeVisitor
-
visitFieldExpression
public void visitFieldExpression(FieldExpression expression)
- Specified by:
visitFieldExpression
in interfaceGroovyCodeVisitor
-
visitMethodPointerExpression
public void visitMethodPointerExpression(MethodPointerExpression expression)
- Specified by:
visitMethodPointerExpression
in interfaceGroovyCodeVisitor
-
visitMethodReferenceExpression
public void visitMethodReferenceExpression(MethodReferenceExpression expression)
- Specified by:
visitMethodReferenceExpression
in interfaceGroovyCodeVisitor
-
visitConstantExpression
public void visitConstantExpression(ConstantExpression expression)
- Specified by:
visitConstantExpression
in interfaceGroovyCodeVisitor
-
visitClassExpression
public void visitClassExpression(ClassExpression expression)
- Specified by:
visitClassExpression
in interfaceGroovyCodeVisitor
-
visitVariableExpression
public void visitVariableExpression(VariableExpression expression)
- Specified by:
visitVariableExpression
in interfaceGroovyCodeVisitor
-
visitDeclarationExpression
public void visitDeclarationExpression(DeclarationExpression expression)
- Specified by:
visitDeclarationExpression
in interfaceGroovyCodeVisitor
-
visitGStringExpression
public void visitGStringExpression(GStringExpression expression)
- Specified by:
visitGStringExpression
in interfaceGroovyCodeVisitor
-
visitArrayExpression
public void visitArrayExpression(ArrayExpression expression)
- Specified by:
visitArrayExpression
in interfaceGroovyCodeVisitor
-
visitSpreadExpression
public void visitSpreadExpression(SpreadExpression expression)
- Specified by:
visitSpreadExpression
in interfaceGroovyCodeVisitor
-
visitSpreadMapExpression
public void visitSpreadMapExpression(SpreadMapExpression expression)
- Specified by:
visitSpreadMapExpression
in interfaceGroovyCodeVisitor
-
visitNotExpression
public void visitNotExpression(NotExpression expression)
- Specified by:
visitNotExpression
in interfaceGroovyCodeVisitor
-
visitUnaryMinusExpression
public void visitUnaryMinusExpression(UnaryMinusExpression expression)
- Specified by:
visitUnaryMinusExpression
in interfaceGroovyCodeVisitor
-
visitUnaryPlusExpression
public void visitUnaryPlusExpression(UnaryPlusExpression expression)
- Specified by:
visitUnaryPlusExpression
in interfaceGroovyCodeVisitor
-
visitBitwiseNegationExpression
public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)
- Specified by:
visitBitwiseNegationExpression
in interfaceGroovyCodeVisitor
-
visitCastExpression
public void visitCastExpression(CastExpression expression)
- Specified by:
visitCastExpression
in interfaceGroovyCodeVisitor
-
visitArgumentlistExpression
public void visitArgumentlistExpression(ArgumentListExpression expression)
- Specified by:
visitArgumentlistExpression
in interfaceGroovyCodeVisitor
-
visitClosureListExpression
public void visitClosureListExpression(ClosureListExpression closureListExpression)
- Specified by:
visitClosureListExpression
in interfaceGroovyCodeVisitor
-
visitBytecodeExpression
public void visitBytecodeExpression(BytecodeExpression expression)
- Specified by:
visitBytecodeExpression
in interfaceGroovyCodeVisitor
-
-