[JBoss JIRA] (WFLY-7965) Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
by Martin Choma (JIRA)
[ https://issues.jboss.org/browse/WFLY-7965?page=com.atlassian.jira.plugin.... ]
Martin Choma updated WFLY-7965:
-------------------------------
Affects Version/s: 11.0.0.Alpha1
> Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
> ------------------------------------------------------------------------------------------------
>
> Key: WFLY-7965
> URL: https://issues.jboss.org/browse/WFLY-7965
> Project: WildFly
> Issue Type: Bug
> Components: Security
> Affects Versions: 11.0.0.Alpha1
> Reporter: Martin Choma
> Assignee: Darran Lofthouse
>
> Coverity static-analysis scan found possible dereference null return value in following code
> {code:java|title=ServerAuthenticationContext.java}
> if (log.isTraceEnabled()) {
> log.tracef("Authorizing principal %s.", authenticationPrincipal.getName());
> log.tracef("Authorizing against the following attributes: %s => %s",
> authorizationIdentity.getAttributes().keySet(), authorizationIdentity.getAttributes().values());
> }
> {code}
> Coverity suppose null value could get here via {{AggregateSecurityRealm.Identity.getAuthorizationIdentity}} calling {{TokenSecurityRealm.TokenRealmIdentity.getAuthorizationIdentity}}
> {code:java|title=TokenRealmIdentity.java}
> @Override
> public AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException {
> if (exists()) {
> return new AuthorizationIdentity() {
> @Override
> public Attributes getAttributes() {
> return claims;
> }
> };
> }
> return null;
> }
> {code}
> https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=85537...
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 3 months
[JBoss JIRA] (WFLY-7965) Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
by Martin Choma (JIRA)
Martin Choma created WFLY-7965:
----------------------------------
Summary: Coverity static analysis: Dereference null return value in ServerAuthenticationContext (Elytron)
Key: WFLY-7965
URL: https://issues.jboss.org/browse/WFLY-7965
Project: WildFly
Issue Type: Bug
Components: Security
Reporter: Martin Choma
Assignee: Darran Lofthouse
Coverity static-analysis scan found possible dereference null return value in following code
{code:java|title=ServerAuthenticationContext.java}
if (log.isTraceEnabled()) {
log.tracef("Authorizing principal %s.", authenticationPrincipal.getName());
log.tracef("Authorizing against the following attributes: %s => %s",
authorizationIdentity.getAttributes().keySet(), authorizationIdentity.getAttributes().values());
}
{code}
Coverity suppose null value could get here via {{AggregateSecurityRealm.Identity.getAuthorizationIdentity}} calling {{TokenSecurityRealm.TokenRealmIdentity.getAuthorizationIdentity}}
{code:java|title=TokenRealmIdentity.java}
@Override
public AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException {
if (exists()) {
return new AuthorizationIdentity() {
@Override
public Attributes getAttributes() {
return claims;
}
};
}
return null;
}
{code}
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=85537...
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 3 months
[JBoss JIRA] (WFLY-7964) Coverity static analysis: Resource leak in LdapSecurityRealm (Elytron)
by Martin Choma (JIRA)
Martin Choma created WFLY-7964:
----------------------------------
Summary: Coverity static analysis: Resource leak in LdapSecurityRealm (Elytron)
Key: WFLY-7964
URL: https://issues.jboss.org/browse/WFLY-7964
Project: WildFly
Issue Type: Bug
Components: Security
Reporter: Martin Choma
Assignee: Darran Lofthouse
Priority: Critical
Coverity static-analysis scan found resource leak in LdapSecurityRealm.getIdentity().
It has to be in try-with-resources, because Stream<LdapIdentity> has registered close handler, where NamingEnumeration.close() is called. Looking into one possible implementation http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u... It would be safer to call close() explicitelly.
However chained stream statement is used in try, which cause 2 Stream objects to be created. But only one of them is closed. Stream created by ldapSearch.search(context) (with exlicitely registered close handler) is not closed.
{code:java|title=LdapSecurityRealm.java}
try (
Stream<LdapIdentity> identityStream = ldapSearch.search(context)
.map(result -> new LdapIdentity(result.getNameInNamespace()))
) {
LdapIdentity identity = identityStream.findFirst().orElse(null);
{code}
https://scan7.coverity.com/reports.htm#v23632/p11778/fileInstanceId=85538...
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
9 years, 3 months