From 0aeca01251f83ebf7d69eeff26059da9fa39c4bf Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Thu, 5 Apr 2018 11:48:30 +0530 Subject: Fix vulnerable issue in vim proxy Issue-ID: VFC-644 Change-Id: Ia1912f0e693ac3a6f9a48ac6203cccd18306e93b Signed-off-by: Kanagaraj Manickam k00365106 --- .../nfvo/multivimproxy/common/util/restclient/HttpBaseRest.java | 9 +++++---- .../onap/vfc/nfvo/multivimproxy/common/util/RestfulUtilTest.java | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'service') 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; *
*

*

- * + * * @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
*

*

- * + * * @since */ public HttpBaseRest() { @@ -135,7 +136,7 @@ public abstract class HttpBaseRest implements Restful { /** *
- * + * * @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() { -- cgit 1.2.3-korg