[JBoss JIRA] (ELY-738) Coverity static analysis: Dereference null return value in SingleSignOnServerMechanismFactory (Elytron)
by Ilia Vassilev (JIRA)
[ https://issues.jboss.org/browse/ELY-738?page=com.atlassian.jira.plugin.sy... ]
Ilia Vassilev updated ELY-738:
------------------------------
Fix Version/s: 1.1.0.Beta15
> Coverity static analysis: Dereference null return value in SingleSignOnServerMechanismFactory (Elytron)
> -------------------------------------------------------------------------------------------------------
>
> Key: ELY-738
> URL: https://issues.jboss.org/browse/ELY-738
> Project: WildFly Elytron
> Issue Type: Bug
> Reporter: Josef Cacek
> Assignee: Ilia Vassilev
> Labels: static_analysis
> Fix For: 1.1.0.Beta15
>
>
> Coverity static-analysis scan found possible call on null object in {{SingleSignOnServerMechanismFactory.evaluateRequst()}} method:
> {code}
> getTargetMechanism(mechanismName, singleSignOnSession).evaluateRequest(createHttpServerRequest(request, singleSignOnSession));
> {code}
> https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=57602...
> The problem is the {{getTargetMechanism}} call, which just calls an {{HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism()}} method.
> The {{createAuthenticationMechanism}} doesn't declare it could return null, nevertheless, the implementations use null as fallback (e.g. look at {{ServerMechanismFactoryImpl.createAuthenticationMechanism()}})
> *Suggested improvement*
> I see 2 possible solutions:
> 1. Declare in javadoc of {{HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism()}} method, that it can return null and add the null-check into the {{SingleSignOnServerMechanismFactory.evaluateRequst()}} method
> 2. or throw an exception from {{HttpServerAuthenticationMechanismFactory.createAuthenticationMechanism()}} implementations instead of returning null
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 2 months
[JBoss JIRA] (ELY-743) Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
by Ilia Vassilev (JIRA)
[ https://issues.jboss.org/browse/ELY-743?page=com.atlassian.jira.plugin.sy... ]
Ilia Vassilev updated ELY-743:
------------------------------
Fix Version/s: 1.1.0.Beta16
> Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
> ------------------------------------------------------------------------------------------------
>
> Key: ELY-743
> URL: https://issues.jboss.org/browse/ELY-743
> Project: WildFly Elytron
> Issue Type: Bug
> Reporter: Josef Cacek
> Assignee: Ilia Vassilev
> Labels: static_analysis
> Fix For: 1.1.0.Beta16
>
>
> Coverity static-analysis scan found 3 possible calls on null objects in {{ServerAuthenticationContext}} class.
> https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=57603...
> In {{ServerAuthenticationContext.AuthorizedState.isSamePrincipal(Principal)}} - Return value of function which returns null is dereferenced without checking.
> {code}
> 2039 boolean isSamePrincipal(final Principal principal) {
>
> // 1. returned_null: getName returns null (checked 9 out of 11 times). (The virtual call resolves to org.wildfly.security.auth.server.PrincipalDecoder.<clinit>/<gen>org.wildfly.security.auth.server.PrincipalDecoder_instance_2.getName.) [show details]
>
> // 2. var_assigned: Assigning: name = null return value from getName.
> 2040 String name = authorizedIdentity.getSecurityDomain().getPrincipalDecoder().getName(principal);
>
> // CID 1369286 (#1 of 1): Dereference null return value (NULL_RETURNS)3. dereference: Dereferencing a pointer that might be null name when calling isSameName. [show details]
> 2041 return isSameName(name);
> 2042 }
> {code}
> https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=57603...
> In {{ServerAuthenticationContext.NameAssignedState.isSamePrincipal(Principal)}} - the same as the previous one.
> https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=57603...
> In {{ServerAuthenticationContext.ANONYMOUS.handleOne(Callback[], int)}}
> {code}
> 790 final PasswordCallback passwordCallback = (PasswordCallback) callback;
> 791
>
> // 8. returned_null: getCredentialAcquireSupport returns null (checked 0 out of 1 times). [show details]
>
> // CID 1369304 (#1 of 1): Dereference null return value (NULL_RETURNS)9. null_method_call: Calling a method on null object getCredentialAcquireSupport(org.wildfly.security.credential.PasswordCredential.class).
> 792 if (getCredentialAcquireSupport(PasswordCredential.class).mayBeSupported()) {
> {code}
> *Suggested improvement*
> Add null checks.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 2 months
[JBoss JIRA] (ELY-751) Coverity static analysis: Explicit null dereferenced in LdapKeyStore (Elytron)
by Ilia Vassilev (JIRA)
[ https://issues.jboss.org/browse/ELY-751?page=com.atlassian.jira.plugin.sy... ]
Ilia Vassilev updated ELY-751:
------------------------------
Fix Version/s: 1.1.0.Beta24
> Coverity static analysis: Explicit null dereferenced in LdapKeyStore (Elytron)
> ------------------------------------------------------------------------------
>
> Key: ELY-751
> URL: https://issues.jboss.org/browse/ELY-751
> Project: WildFly Elytron
> Issue Type: Bug
> Reporter: Josef Cacek
> Assignee: Ilia Vassilev
> Priority: Critical
> Labels: static_analysis
> Fix For: 1.1.0.Beta24
>
>
> Coverity static-analysis scan found possible use of null object in {{LdapKeyStore}} constructor.
> https://scan7.coverity.com/reports.htm#v16159/p11778/fileInstanceId=57601...
> The {{LdapKeyStore.Builder.build()}} method constructs the {{LdapKeyStore}} instance this way:
> {code}
> return new LdapKeyStore(spi, null, null);
> {code}
> and the constructor just calls parent ctor:
> {code}
> protected LdapKeyStore(KeyStoreSpi keyStoreSpi, Provider provider, String type) {
> super(keyStoreSpi, provider, type);
> }
> {code}
> And it fails with NPE if debug for {{KeyStore}} is enabled as the constructor contains:
> {code}
> if (!skipDebug && pdebug != null) {
> pdebug.println("KeyStore." + type.toUpperCase() + " type from: " +
> this.provider.getName());
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 2 months