Class SecureASTCustomizer.SecuringCodeVisitor
java.lang.Object
org.codehaus.groovy.control.customizers.SecureASTCustomizer.SecuringCodeVisitor
- All Implemented Interfaces:
- GroovyCodeVisitor
- Enclosing class:
- SecureASTCustomizer
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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidassertExpressionAuthorized(Expression expression) Checks that a given expression is either in the allowed list or not in the disallowed list.protected voidassertStatementAuthorized(Statement statement) Checks that a given statement is either in the allowed list or not in the disallowed list.protected voidassertTokenAuthorized(Token token) Checks that a given token is either in the allowed list or not in the disallowed list.protected ClassNodegetExpressionType(ClassNode objectExpressionType) voidvisitArgumentlistExpression(ArgumentListExpression expression) voidvisitArrayExpression(ArrayExpression expression) voidvisitAssertStatement(AssertStatement statement) voidvisitAttributeExpression(AttributeExpression expression) voidvisitBinaryExpression(BinaryExpression expression) voidvoidvoidvisitBooleanExpression(BooleanExpression expression) voidvisitBreakStatement(BreakStatement statement) voidvisitBytecodeExpression(BytecodeExpression expression) voidvisitCaseStatement(CaseStatement statement) voidvisitCastExpression(CastExpression expression) voidvisitCatchStatement(CatchStatement statement) voidvisitClassExpression(ClassExpression expression) voidvisitClosureExpression(ClosureExpression expression) voidvisitClosureListExpression(ClosureListExpression closureListExpression) voidvisitConstantExpression(ConstantExpression expression) voidvoidvisitContinueStatement(ContinueStatement statement) voidvisitDeclarationExpression(DeclarationExpression expression) voidvoidvisitEmptyStatement(EmptyStatement statement) voidvisitExpressionStatement(ExpressionStatement statement) voidvisitFieldExpression(FieldExpression expression) voidvisitForLoop(ForStatement forLoop) voidvisitGStringExpression(GStringExpression expression) voidvisitIfElse(IfStatement ifElse) voidvisitLambdaExpression(LambdaExpression expression) voidvisitListExpression(ListExpression expression) voidvisitMapEntryExpression(MapEntryExpression expression) voidvisitMapExpression(MapExpression expression) voidvoidvisitMethodPointerExpression(MethodPointerExpression expression) voidvoidvisitNotExpression(NotExpression expression) voidvisitPostfixExpression(PostfixExpression expression) voidvisitPrefixExpression(PrefixExpression expression) voidvisitPropertyExpression(PropertyExpression expression) voidvisitRangeExpression(RangeExpression expression) voidvisitReturnStatement(ReturnStatement statement) voidvisitShortTernaryExpression(ElvisOperatorExpression expression) voidvisitSpreadExpression(SpreadExpression expression) voidvisitSpreadMapExpression(SpreadMapExpression expression) voidvoidvisitSwitch(SwitchStatement statement) voidvisitSynchronizedStatement(SynchronizedStatement statement) voidvisitTernaryExpression(TernaryExpression expression) voidvisitThrowStatement(ThrowStatement statement) voidvisitTryCatchFinally(TryCatchStatement statement) voidvisitTupleExpression(TupleExpression expression) voidvisitUnaryMinusExpression(UnaryMinusExpression expression) voidvisitUnaryPlusExpression(UnaryPlusExpression expression) voidvisitVariableExpression(VariableExpression expression) voidvisitWhileLoop(WhileStatement loop) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitorvisit, visit, visitEmptyExpression, visitListOfExpressions
- 
Constructor Details- 
SecuringCodeVisitorprotected SecuringCodeVisitor()
 
- 
- 
Method Details- 
assertStatementAuthorizedChecks that a given statement is either in the allowed list or not in the disallowed list.- Parameters:
- statement- the statement to be checked
- Throws:
- SecurityException- if usage of this statement class is forbidden
 
- 
assertExpressionAuthorizedChecks that a given expression is either in the allowed list or not in the disallowed list.- Parameters:
- expression- the expression to be checked
- Throws:
- SecurityException- if usage of this expression class is forbidden
 
- 
getExpressionType
- 
assertTokenAuthorizedChecks that a given token is either in the allowed list or not in the disallowed list.- Parameters:
- token- the token to be checked
- Throws:
- SecurityException- if usage of this token is forbidden
 
- 
visitBlockStatement- Specified by:
- visitBlockStatementin interface- GroovyCodeVisitor
 
- 
visitForLoop- Specified by:
- visitForLoopin interface- GroovyCodeVisitor
 
- 
visitWhileLoop- Specified by:
- visitWhileLoopin interface- GroovyCodeVisitor
 
- 
visitDoWhileLoop- Specified by:
- visitDoWhileLoopin interface- GroovyCodeVisitor
 
- 
visitIfElse- Specified by:
- visitIfElsein interface- GroovyCodeVisitor
 
- 
visitExpressionStatement- Specified by:
- visitExpressionStatementin interface- GroovyCodeVisitor
 
- 
visitReturnStatement- Specified by:
- visitReturnStatementin interface- GroovyCodeVisitor
 
- 
visitAssertStatement- Specified by:
- visitAssertStatementin interface- GroovyCodeVisitor
 
- 
visitTryCatchFinally- Specified by:
- visitTryCatchFinallyin interface- GroovyCodeVisitor
 
- 
visitEmptyStatement- Specified by:
- visitEmptyStatementin interface- GroovyCodeVisitor
 
- 
visitSwitch- Specified by:
- visitSwitchin interface- GroovyCodeVisitor
 
- 
visitCaseStatement- Specified by:
- visitCaseStatementin interface- GroovyCodeVisitor
 
- 
visitBreakStatement- Specified by:
- visitBreakStatementin interface- GroovyCodeVisitor
 
- 
visitContinueStatement- Specified by:
- visitContinueStatementin interface- GroovyCodeVisitor
 
- 
visitThrowStatement- Specified by:
- visitThrowStatementin interface- GroovyCodeVisitor
 
- 
visitSynchronizedStatement- Specified by:
- visitSynchronizedStatementin interface- GroovyCodeVisitor
 
- 
visitCatchStatement- Specified by:
- visitCatchStatementin interface- GroovyCodeVisitor
 
- 
visitMethodCallExpression- Specified by:
- visitMethodCallExpressionin interface- GroovyCodeVisitor
 
- 
visitStaticMethodCallExpression- Specified by:
- visitStaticMethodCallExpressionin interface- GroovyCodeVisitor
 
- 
visitConstructorCallExpression- Specified by:
- visitConstructorCallExpressionin interface- GroovyCodeVisitor
 
- 
visitTernaryExpression- Specified by:
- visitTernaryExpressionin interface- GroovyCodeVisitor
 
- 
visitShortTernaryExpression- Specified by:
- visitShortTernaryExpressionin interface- GroovyCodeVisitor
 
- 
visitBinaryExpression- Specified by:
- visitBinaryExpressionin interface- GroovyCodeVisitor
 
- 
visitPrefixExpression- Specified by:
- visitPrefixExpressionin interface- GroovyCodeVisitor
 
- 
visitPostfixExpression- Specified by:
- visitPostfixExpressionin interface- GroovyCodeVisitor
 
- 
visitBooleanExpression- Specified by:
- visitBooleanExpressionin interface- GroovyCodeVisitor
 
- 
visitClosureExpression- Specified by:
- visitClosureExpressionin interface- GroovyCodeVisitor
 
- 
visitLambdaExpression- Specified by:
- visitLambdaExpressionin interface- GroovyCodeVisitor
 
- 
visitTupleExpression- Specified by:
- visitTupleExpressionin interface- GroovyCodeVisitor
 
- 
visitMapExpression- Specified by:
- visitMapExpressionin interface- GroovyCodeVisitor
 
- 
visitMapEntryExpression- Specified by:
- visitMapEntryExpressionin interface- GroovyCodeVisitor
 
- 
visitListExpression- Specified by:
- visitListExpressionin interface- GroovyCodeVisitor
 
- 
visitRangeExpression- Specified by:
- visitRangeExpressionin interface- GroovyCodeVisitor
 
- 
visitPropertyExpression- Specified by:
- visitPropertyExpressionin interface- GroovyCodeVisitor
 
- 
visitAttributeExpression- Specified by:
- visitAttributeExpressionin interface- GroovyCodeVisitor
 
- 
visitFieldExpression- Specified by:
- visitFieldExpressionin interface- GroovyCodeVisitor
 
- 
visitMethodPointerExpression- Specified by:
- visitMethodPointerExpressionin interface- GroovyCodeVisitor
 
- 
visitMethodReferenceExpression- Specified by:
- visitMethodReferenceExpressionin interface- GroovyCodeVisitor
 
- 
visitConstantExpression- Specified by:
- visitConstantExpressionin interface- GroovyCodeVisitor
 
- 
visitClassExpression- Specified by:
- visitClassExpressionin interface- GroovyCodeVisitor
 
- 
visitVariableExpression- Specified by:
- visitVariableExpressionin interface- GroovyCodeVisitor
 
- 
visitDeclarationExpression- Specified by:
- visitDeclarationExpressionin interface- GroovyCodeVisitor
 
- 
visitGStringExpression- Specified by:
- visitGStringExpressionin interface- GroovyCodeVisitor
 
- 
visitArrayExpression- Specified by:
- visitArrayExpressionin interface- GroovyCodeVisitor
 
- 
visitSpreadExpression- Specified by:
- visitSpreadExpressionin interface- GroovyCodeVisitor
 
- 
visitSpreadMapExpression- Specified by:
- visitSpreadMapExpressionin interface- GroovyCodeVisitor
 
- 
visitNotExpression- Specified by:
- visitNotExpressionin interface- GroovyCodeVisitor
 
- 
visitUnaryMinusExpression- Specified by:
- visitUnaryMinusExpressionin interface- GroovyCodeVisitor
 
- 
visitUnaryPlusExpression- Specified by:
- visitUnaryPlusExpressionin interface- GroovyCodeVisitor
 
- 
visitBitwiseNegationExpression- Specified by:
- visitBitwiseNegationExpressionin interface- GroovyCodeVisitor
 
- 
visitCastExpression- Specified by:
- visitCastExpressionin interface- GroovyCodeVisitor
 
- 
visitArgumentlistExpression- Specified by:
- visitArgumentlistExpressionin interface- GroovyCodeVisitor
 
- 
visitClosureListExpression- Specified by:
- visitClosureListExpressionin interface- GroovyCodeVisitor
 
- 
visitBytecodeExpression- Specified by:
- visitBytecodeExpressionin interface- GroovyCodeVisitor
 
 
-