[java-opensaml] branch main updated: OSJ-365 - BasicX509Credential has race condition around cert access

Scott Cantor cantor.2 at osu.edu
Mon Nov 14 17:12:31 UTC 2022


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository java-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=java-opensaml.git;a=commit;h=8da5f00c25113333220f99f2585daebaf3246997

The following commit(s) were added to refs/heads/main by this push:
     new 8da5f00c2 OSJ-365 - BasicX509Credential has race condition around cert access
8da5f00c2 is described below

commit 8da5f00c25113333220f99f2585daebaf3246997
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Nov 14 12:11:47 2022 -0500

    OSJ-365 - BasicX509Credential has race condition around cert access
    
    https://shibboleth.atlassian.net/browse/OSJ-365
    
    Move sync to object to avoid NPE.
---
 .../main/java/org/opensaml/security/x509/BasicX509Credential.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/opensaml-security-api/src/main/java/org/opensaml/security/x509/BasicX509Credential.java b/opensaml-security-api/src/main/java/org/opensaml/security/x509/BasicX509Credential.java
index 393624260..e4da661ff 100644
--- a/opensaml-security-api/src/main/java/org/opensaml/security/x509/BasicX509Credential.java
+++ b/opensaml-security-api/src/main/java/org/opensaml/security/x509/BasicX509Credential.java
@@ -131,7 +131,7 @@ public class BasicX509Credential extends BasicCredential implements X509Credenti
     /** {@inheritDoc} */
     @Override
     @Nonnull @NonnullElements public Collection<X509Certificate> getEntityCertificateChain() {
-        synchronized(entityCertChain) {
+        synchronized(this) {
             if (entityCertChain == null) {
                 final LazySet<X509Certificate> constructedChain = new LazySet<>();
                 constructedChain.add(entityCert);
@@ -151,7 +151,7 @@ public class BasicX509Credential extends BasicCredential implements X509Credenti
         Constraint.isNotNull(newCertificateChain, "Certificate chain collection cannot be null");
         Constraint.isNotEmpty(newCertificateChain, "Certificate chain collection cannot be empty");
         
-        synchronized(entityCertChain) {
+        synchronized(this) {
             entityCertChain = new ArrayList<>(newCertificateChain);
         }
     }
@@ -176,4 +176,4 @@ public class BasicX509Credential extends BasicCredential implements X509Credenti
         throw new UnsupportedOperationException("An X509Credential may not contain a secret key");
     }
 
-}
\ No newline at end of file
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list