Package io.codemodder.codemods
Class FixUnsafeNIOPathComparisonCodemod
java.lang.Object
io.codemodder.javaparser.JavaParserChanger
io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.MethodCallExpr>
io.codemodder.codemods.FixUnsafeNIOPathComparisonCodemod
- All Implemented Interfaces:
io.codemodder.CodeChanger
@Codemod(id="pixee:java/fix-unsafe-nio-path-comparison",
importance=MEDIUM,
reviewGuidance=MERGE_AFTER_CURSORY_REVIEW)
public final class FixUnsafeNIOPathComparisonCodemod
extends io.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.MethodCallExpr>
Fix unsafe NIO path comparison.
-
Field Summary
Fields inherited from class io.codemodder.SarifPluginJavaParserChanger
sarif
Fields inherited from class io.codemodder.javaparser.JavaParserChanger
reporter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
onResultFound
(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr, com.contrastsecurity.sarif.Result result) Methods inherited from class io.codemodder.SarifPluginJavaParserChanger
shouldRun, visit
Methods inherited from class io.codemodder.javaparser.JavaParserChanger
dependenciesRequired, getDescription, getIndividualChangeDescription, getReferences, getSummary
-
Constructor Details
-
FixUnsafeNIOPathComparisonCodemod
@Inject public FixUnsafeNIOPathComparisonCodemod(@SemgrepScan(yaml="rules:\n - id: fix-unsafe-nio-path-comparison\n patterns:\n - pattern: (File $CHILD).getCanonicalPath().startsWith((File $PARENT).getCanonicalPath())\n") io.codemodder.RuleSarif sarif)
-
-
Method Details
-
onResultFound
public boolean onResultFound(io.codemodder.CodemodInvocationContext context, com.github.javaparser.ast.CompilationUnit cu, com.github.javaparser.ast.expr.MethodCallExpr methodCallExpr, com.contrastsecurity.sarif.Result result) - Specified by:
onResultFound
in classio.codemodder.SarifPluginJavaParserChanger<com.github.javaparser.ast.expr.MethodCallExpr>
-