summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-04-05 11:48:30 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-04-05 11:49:51 +0530
commit0aeca01251f83ebf7d69eeff26059da9fa39c4bf (patch)
treed0ee3f346477a2bd64724d8ba2c354a2775c4af9
parent2501584fe36ddfff7609201cebc2b8e443245178 (diff)
Fix vulnerable issue in vim proxy
Issue-ID: VFC-644 Change-Id: Ia1912f0e693ac3a6f9a48ac6203cccd18306e93b Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java9
-rw-r--r--service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java8
2 files changed, 13 insertions, 4 deletions
diff --git a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
index 89a5dd6..100f799 100644
--- a/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
+++ b/service/src/main/java/org/onap/vfc/nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java
@@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.multivimproxy.common.util.restclient;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.net.Inet4Address;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@@ -37,7 +38,7 @@ import org.slf4j.LoggerFactory;
* <br/>
* <p>
* </p>
- *
+ *
* @author
* @version Aug 9, 2016
*/
@@ -49,7 +50,7 @@ public abstract class HttpBaseRest implements Restful {
protected HttpClient client = null;
- private static final String LOCAL_HOST = "127.0.0.1";
+ private static final String LOCAL_HOST = Inet4Address.getLoopbackAddress().getHostAddress();
static final String HTTP_PATCH = "PATCH";
@@ -65,7 +66,7 @@ public abstract class HttpBaseRest implements Restful {
* Constructor<br/>
* <p>
* </p>
- *
+ *
* @since
*/
public HttpBaseRest() {
@@ -135,7 +136,7 @@ public abstract class HttpBaseRest implements Restful {
/**
* <br/>
- *
+ *
* @param method
* @param servicePath
* @param restParametes
diff --git a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
index 2f9c00d..15b908b 100644
--- a/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
+++ b/service/src/test/java/org/onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java
@@ -19,6 +19,8 @@ package org.onap.vfc.nfvo.multivimproxy.common.util;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.net.Inet4Address;
+
import org.junit.Test;
import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulOptions;
import org.onap.vfc.nfvo.multivimproxy.common.util.restclient.RestfulParametes;
@@ -52,6 +54,12 @@ public class RestfulUtilTest {
};
}
+
+ @Test
+ public void findLocalAddress() {
+ assertEquals("127.0.0.1", Inet4Address.getLoopbackAddress().getHostAddress());
+ }
+
private void mockGetResponseContentReturnNull() {
new MockUp<RestfulUtil>() {