Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-7883

Coverity static analysis: Dereference null return value in CredentialStoreCredentialSource (Elytron)

XMLWordPrintable

      Coverity static-analysis scan found possible method call on null object in {{org.​wildfly.​security.​credential.​source.​CredentialStoreCredentialSource.​getCredential(java.​lang.​Class, java.​lang.​String, java.​security.​spec.​AlgorithmParameterSpec)}}

      https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=6803729&defectInstanceId=1776827&mergedDefectId=1388281&eventId=1776827-8
      The problematic piece of code is:

      credential = credentialStore.retrieve(alias, credentialType);
      return credential.castAs(credentialType, algorithmName, parameterSpec);
      

      The retrieve() method may return null in some cases as can be seen in KeyStoreCredentialStore class:

      //...
      final TopEntry topEntry = cache.get(credentialAlias);
      if (topEntry == null) {
          return null;
      }
      //...
      

              rhn-support-ivassile Ilia Vassilev
              josef.cacek@gmail.com Josef Cacek (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: