From bbdb15ea69da4efbbbbb33139ea81d6e299a8702 Mon Sep 17 00:00:00 2001 From: jnsereko Date: Fri, 16 Jul 2021 09:07:02 -0400 Subject: [PATCH] MM-860: Implemented anti-csrf tokens for OpenMRS protection against CSRF attacks --- .../ReferenceApplicationActivatorTest.java | 12 ++++------ .../resources/TestingApplicationContext.xml | 5 +++++ omod/src/main/webapp/pages/login.gsp | 1 + pom.xml | 22 +++++++++---------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/api/src/test/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivatorTest.java b/api/src/test/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivatorTest.java index d3516e5a..d3afc53e 100644 --- a/api/src/test/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivatorTest.java +++ b/api/src/test/java/org/openmrs/module/referenceapplication/ReferenceApplicationActivatorTest.java @@ -8,6 +8,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; +import org.mockito.ArgumentMatcher; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.openmrs.scheduler.SchedulerService; @@ -47,16 +48,11 @@ public void shouldSaveNewTaskIfNotAlreadyRegistered() { new ReferenceApplicationActivator().setupHL7ProcessingTask(schedulerService); - verify(schedulerService).saveTaskDefinition(Matchers.argThat(new BaseMatcher() { + verify(schedulerService).saveTaskDefinition(Matchers.argThat(new ArgumentMatcher() { @Override - public boolean matches(Object obj) { - return obj instanceof TaskDefinition - && ProcessHL7InQueueTask.class.getName().equals(((TaskDefinition) obj).getTaskClass()); - } - - @Override - public void describeTo(Description description) { + public boolean matches(TaskDefinition obj) { + return ProcessHL7InQueueTask.class.getName().equals(obj.getTaskClass()); } })); diff --git a/api/src/test/resources/TestingApplicationContext.xml b/api/src/test/resources/TestingApplicationContext.xml index 1db88a02..ed2eef80 100644 --- a/api/src/test/resources/TestingApplicationContext.xml +++ b/api/src/test/resources/TestingApplicationContext.xml @@ -18,6 +18,11 @@ + + + org.openmrs + + diff --git a/omod/src/main/webapp/pages/login.gsp b/omod/src/main/webapp/pages/login.gsp index 6db5866f..07dec946 100644 --- a/omod/src/main/webapp/pages/login.gsp +++ b/omod/src/main/webapp/pages/login.gsp @@ -188,6 +188,7 @@ <% } %> +

<% if(!selectLocation) {%>

diff --git a/pom.xml b/pom.xml index 3deea05a..448bb834 100644 --- a/pom.xml +++ b/pom.xml @@ -35,24 +35,24 @@ UTF-8 - 2.0.1 + 2.5.0-SNAPSHOT 2.6 1.3 - 2.9 + 2.16.0 2.5.0 2.0.2 1.2 0.2.12 0.10.6 - 3.3.0 + 4.0.1 1.6.1 - 4.4.0 - 1.6 + 4.7.0 + 1.11.0 1.5 - 1.7 + 1.13.0 1.2.2 - 1.21.0 - 2.5.0 + 1.31.0 + 2.13.0 3.21.0-SNAPSHOT 1.7 2.2 @@ -63,7 +63,7 @@ 2.16 2.12.0 1.2.3 - 1.2.1 + 1.4.0 @@ -228,7 +228,7 @@ org.openmrs.module - htmlformentry-api-1.10 + htmlformentry-api-2.3 ${htmlformentryVersion} provided @@ -460,7 +460,7 @@ org.openmrs.module - htmlformentry-api-1.10 + htmlformentry-api-2.3