Class AbstractHardCodedCredentialChecker

All Implemented Interfaces:
JavaCheck, JavaFileScanner
Direct Known Subclasses:
HardCodedPasswordCheck, HardCodedSecretCheck

public abstract class AbstractHardCodedCredentialChecker extends IssuableSubscriptionVisitor
  • Field Details

    • STRING_TO_CHAR_ARRAY

      protected static final MethodMatchers STRING_TO_CHAR_ARRAY
    • EQUALS_MATCHER

      protected static final MethodMatchers EQUALS_MATCHER
  • Constructor Details

    • AbstractHardCodedCredentialChecker

      public AbstractHardCodedCredentialChecker()
  • Method Details

    • getCredentialWords

      protected abstract String getCredentialWords()
    • isCredentialContainingPattern

      protected abstract boolean isCredentialContainingPattern(ExpressionTree expression)
      Determine if the actual hardcoded credential from the expression, contains one of the credentials pattern. This is typically used to ignore constant declaration.
    • report

      protected abstract void report(Tree tree, String match)
    • isSettingCredential

      protected Optional<String> isSettingCredential(MethodInvocationTree tree)
    • isCredentialLikeName

      protected Optional<String> isCredentialLikeName(String name)
    • isCredentialVariable

      protected Optional<String> isCredentialVariable(ExpressionTree variable)
    • isCallOnStringLiteral

      protected boolean isCallOnStringLiteral(ExpressionTree expr)
    • handleStringLiteral

      protected void handleStringLiteral(LiteralTree tree)
    • isPotentialCredential

      protected boolean isPotentialCredential(String literal)
    • handleVariable

      protected void handleVariable(VariableTree tree)
    • handleAssignment

      protected void handleAssignment(AssignmentExpressionTree tree)
    • isPotentialCredential

      protected boolean isPotentialCredential(ExpressionTree expression)
    • handleEqualsMethod

      protected void handleEqualsMethod(MethodInvocationTree mit, MemberSelectExpressionTree methodSelect)