Update Hazelcast version, remove security vulnerability 23/117023/1
authorliamfallon <liam.fallon@est.tech>
Wed, 20 Jan 2021 15:38:04 +0000 (15:38 +0000)
committerliamfallon <liam.fallon@est.tech>
Wed, 20 Jan 2021 15:43:51 +0000 (15:43 +0000)
Security vulnerabillitles were flagged in CLM in Hazelcast
version 3.11-BETA-1. Hazelcast version 4.1.1 removes that vulnerability.
The lock handling is slightly different in version 4.1.1 and the old
ILock class is removed. The code is updated to use the new FencedLock
locks.

Issue-ID: POLICY-2943
Change-Id: I0cb7d3cb279fed17b3f8758e55902703491f4b5c
Signed-off-by: liamfallon <liam.fallon@est.tech>
plugins/plugins-context/plugins-context-locking/plugins-context-locking-hazelcast/src/main/java/org/onap/policy/apex/plugins/context/locking/hazelcast/HazelcastLock.java
plugins/pom.xml

index e676e66..caec244 100644 (file)
@@ -1,19 +1,20 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ *  Modifications Copyright (C) 2021 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  * SPDX-License-Identifier: Apache-2.0
  * ============LICENSE_END=========================================================
  */
@@ -21,7 +22,7 @@
 package org.onap.policy.apex.plugins.context.locking.hazelcast;
 
 import com.hazelcast.core.HazelcastInstance;
-import com.hazelcast.core.ILock;
+import com.hazelcast.cp.lock.FencedLock;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 
@@ -35,8 +36,8 @@ public class HazelcastLock implements ReadWriteLock {
     private final String lockId;
 
     // The hazelcast lock
-    private final ILock readLock;
-    private final ILock writeLock;
+    private final FencedLock readLock;
+    private final FencedLock writeLock;
 
     /**
      * Create a Hazelcast lock.
@@ -48,8 +49,8 @@ public class HazelcastLock implements ReadWriteLock {
         this.lockId = lockId;
 
         // Create the Hazelcast read and write locks
-        readLock = hazelcastInstance.getLock(lockId + "_READ");
-        writeLock = hazelcastInstance.getLock(lockId + "_WRITE");
+        readLock = hazelcastInstance.getCPSubsystem().getLock(lockId + "_READ");
+        writeLock = hazelcastInstance.getCPSubsystem().getLock(lockId + "_WRITE");
     }
 
     /**
index b10e865..e872e0f 100644 (file)
@@ -1,6 +1,7 @@
 <!--
   ============LICENSE_START=======================================================
    Copyright (C) 2018 Ericsson. All rights reserved.
+   Modifications Copyright (C) 2021 Nordix Foundation.
   ================================================================================
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
@@ -34,7 +35,7 @@
     <description>Plugins for Apex that can be implemented with various 3PPs are implemented here.</description>
 
     <properties>
-        <version.hazelcast>3.11-BETA-1</version.hazelcast>
+        <version.hazelcast>4.1.1</version.hazelcast>
     </properties>
 
     <modules>