Ce produit n'est pas pris en charge par le site Datadog que vous avez sélectionné. ().
Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
classMyClass{publicvoidparseExpressionInterface(PersonpersonObj,Stringproperty){ExpressionParserparser=newSpelExpressionParser();//Unsafe if the input is control by the user..Expressionexp=parser.parseExpression(property+" == 'Albert'");StandardEvaluationContexttestContext=newStandardEvaluationContext(personObj);booleanresult=exp.getValue(testContext,Boolean.class);}}
Compliant Code Examples
classMyClass{publicvoidparseExpressionInterface(PersonpersonObj){ExpressionParserparser=newSpelExpressionParser();// Safe: using hardcoded expression without user inputExpressionexp=parser.parseExpression("name == 'Albert'");StandardEvaluationContexttestContext=newStandardEvaluationContext(personObj);booleanresult=exp.getValue(testContext,Boolean.class);}}
1
2
rulesets:- java-security # Rules to enforce Java security.
Request a personalized demo
Commencer avec Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.