From: Sunil Unnava Date: Tue, 27 Feb 2018 08:09:04 +0000 (-0500) Subject: Security issues fixes X-Git-Tag: v1.1.1^0 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fmessagerouter%2Fmsgrtr.git;a=commitdiff_plain;h=907bb776273e1bf41331609c51dc520c3d4fa181 Security issues fixes Issue-ID: DMAAP-207 Change-Id: I8c95f2647676fc4c2e754bdc280b97886f53403f Signed-off-by: Sunil Unnava --- diff --git a/.project b/.project index 885141a..13ca257 100644 --- a/.project +++ b/.project @@ -10,13 +10,30 @@ + + net.sf.eclipsecs.core.CheckstyleBuilder + + + org.eclipse.m2e.core.maven2Builder + + org.springframework.ide.eclipse.core.springbuilder + + + + + org.springframework.ide.eclipse.boot.validation.springbootbuilder + + + + org.springframework.ide.eclipse.core.springnature + net.sf.eclipsecs.core.CheckstyleNature org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature diff --git a/pom.xml b/pom.xml index 90ae0fe..2630493 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ 4.0.0 org.onap.dmaap.messagerouter.msgrtr msgrtr - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT jar dmaap-messagerouter-msgrtr Message Router - Restful interface built for kafka @@ -36,7 +36,7 @@ - 3.2.14.RELEASE + 3.2.15.RELEASE 3.0.4 1.2 1.7 @@ -90,13 +90,62 @@ - + + commons-collections + commons-collections + 3.2.2 + + + ch.qos.logback + logback-core + 1.2.0 + + + ch.qos.logback + logback-classic + 1.2.0 + + + commons-beanutils + commons-beanutils + 1.9.2 + + + + commons-logging + commons-logging + + + + + org.codehaus.groovy + groovy-all + 2.4.4 + compile + + + jline + jline + + + + + commons-fileupload + commons-fileupload + 1.3.3 + + junit junit 4.11 test + + com.att.aft + dme2 + 3.1.200-oss + @@ -233,15 +282,21 @@ - org.apache.httpcomponents - httpclient - 4.4.1 - - - org.apache.httpcomponents - httpclient-cache - 4.4.1 - + org.apache.httpcomponents + httpclient + 4.5.3 + + + org.apache.httpcomponents + httpclient-cache + 4.5.3 + + + org.apache.httpcomponents + httpcore + 4.4.1 + + @@ -262,24 +317,12 @@ 2.6.0 - - com.att.aft - dme2 - 3.1.200 - com.google.code.gson gson 2.8.0 - - org.mockito - mockito-all - 1.9.5 - test - - com.fasterxml.jackson.core diff --git a/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java b/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java index b2db07e..df486d5 100644 --- a/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java +++ b/src/test/java/com/att/nsa/cambria/service/impl/AdminServiceImplemTest.java @@ -25,23 +25,51 @@ package com.att.nsa.cambria.service.impl; import static org.junit.Assert.*; import java.io.IOException; +import java.util.Date; import com.att.nsa.cambria.beans.DMaaPContext; +import com.att.nsa.cambria.embed.EmbedConfigurationReader; +import com.att.nsa.cambria.utils.ConfigurationReader; import com.att.nsa.configs.ConfigDbException; +import com.att.nsa.drumlin.till.data.sha1HmacSigner; import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; public class AdminServiceImplemTest { + + private static DMaaPContext context = new DMaaPContext(); + + private static EmbedConfigurationReader embedConfigurationReader = new EmbedConfigurationReader(); + + @BeforeClass + public static void setUp() throws Exception { + + final long nowMs = System.currentTimeMillis(); + Date date = new Date(nowMs + 10000); + + final String serverCalculatedSignature = sha1HmacSigner.sign(date.toString(), "password"); + MockHttpServletRequest request = new MockHttpServletRequest(); + request.addHeader("X-Auth", "admin:" + serverCalculatedSignature); + + //NsaSimpleApiKey apiKey = new NsaSimpleApiKey("admin", "password"); + // PowerMockito.when(baseNsaApiDbImpl.loadApiKey("b/7ouTn9FfEw2PQwL0ov/Q==")).thenReturn(apiKey); - @Before - public void setUp() throws Exception { + request.addHeader("X-Date", date); + request.addHeader("Date", date); + MockHttpServletResponse response = new MockHttpServletResponse(); + context.setRequest(request); + context.setResponse(response); + context.setConfigReader(embedConfigurationReader.buildConfigurationReader()); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { + embedConfigurationReader.tearDown(); } @@ -51,7 +79,7 @@ public class AdminServiceImplemTest { AdminServiceImpl adminServiceImpl = new AdminServiceImpl(); try { - adminServiceImpl.showConsumerCache(new DMaaPContext()); + adminServiceImpl.showConsumerCache(context); } catch (IOException | AccessDeniedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -73,7 +101,7 @@ public class AdminServiceImplemTest { AdminServiceImpl adminServiceImpl = new AdminServiceImpl(); try { - adminServiceImpl.dropConsumerCache(new DMaaPContext()); + adminServiceImpl.dropConsumerCache(context); } catch (IOException | AccessDeniedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -95,7 +123,7 @@ public class AdminServiceImplemTest { AdminServiceImpl adminServiceImpl = new AdminServiceImpl(); try { - adminServiceImpl.getBlacklist(new DMaaPContext()); + adminServiceImpl.getBlacklist(context); } catch (IOException | AccessDeniedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -117,7 +145,7 @@ public class AdminServiceImplemTest { AdminServiceImpl adminServiceImpl = new AdminServiceImpl(); try { - adminServiceImpl.addToBlacklist(new DMaaPContext(), "120.120.120.120"); + adminServiceImpl.addToBlacklist(context, "120.120.120.120"); } catch (IOException | AccessDeniedException | ConfigDbException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -139,7 +167,7 @@ public class AdminServiceImplemTest { AdminServiceImpl adminServiceImpl = new AdminServiceImpl(); try { - adminServiceImpl.addToBlacklist(new DMaaPContext(), "120.120.120.120"); + adminServiceImpl.addToBlacklist(context, "120.120.120.120"); } catch (IOException | AccessDeniedException | ConfigDbException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/version.properties b/version.properties index d6e413c..e1118ab 100644 --- a/version.properties +++ b/version.properties @@ -27,7 +27,7 @@ major=1 minor=1 -patch=0 +patch=1 base_version=${major}.${minor}.${patch}