Skip to content
This repository was archived by the owner on Apr 14, 2023. It is now read-only.

Commit 735bb0b

Browse files
authored
Merge pull request #1716 from matthewdunsdon/CVE-2020-15250
fix(#1713): CVE-2020-15250 (Medium) detected in junit-4.12.jar
2 parents 497eb5a + 244eaee commit 735bb0b

23 files changed

+252
-206
lines changed

custom/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ repositories {
1111
}
1212

1313
dependencies {
14-
testCompile group: 'junit', name: 'junit', version: '4.12'
14+
testCompile group: 'junit', name: 'junit', version: '4.13.1'
1515
}

gradle.properties

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,14 @@ LEADPONY_JUSTIFY_VERSION=0.14.0
2929
JACKSON_VERSION=2.11.1
3030
MEDEIA_VALIDATOR_JACKSON_VERSION=1.1.1
3131

32-
JUNIT_JUPITER_VERSION=5.5.1
33-
JUNIT_4_VERSION=4.12
34-
JUNIT_PLATFORM_RUNNER_VERSION=1.3.1
32+
JUNIT_JUPITER_VERSION=5.6.3
33+
JUNIT_4_VERSION=4.13.1
34+
JUNIT_PLATFORM_RUNNER_VERSION=1.6.3
3535
MOCKITO_VERSION=1.9.5
3636
MOCKITO_JUNIT_JUPITER_VERSION=2.28.2
3737
GHERKIN_VERSION=5.0.0
38-
CUCUMBER_VERSION=4.0.0
39-
CUCUMBER_EXPRESSIONS_VERSION=6.0.1
40-
CUCUMBER_PICOCONTAINER_VERSION=1.2.5
38+
CUCUMBER_VERSION=5.0.0
39+
CUCUMBER_PICOCONTAINER_VERSION=5.0.0
4140
SELENIUM_VERSION=3.141.59
4241

4342
FAKER_VERSION=1.0.2

orchestrator/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ dependencies {
4545
testCompile "org.junit.platform:junit-platform-runner:${JUNIT_PLATFORM_RUNNER_VERSION}"
4646
testCompile "org.junit.vintage:junit-vintage-engine:${JUNIT_JUPITER_VERSION}"
4747
testCompile "org.junit.jupiter:junit-jupiter-params:${JUNIT_JUPITER_VERSION}"
48-
testCompile "io.cucumber:cucumber-core:${CUCUMBER_VERSION}"
4948
testCompile "io.cucumber:cucumber-junit:${CUCUMBER_VERSION}"
5049
testCompile "io.cucumber:cucumber-java:${CUCUMBER_VERSION}"
51-
testCompile "io.cucumber:cucumber-jvm:${CUCUMBER_VERSION}"
50+
testCompile "io.cucumber:cucumber-java8:${CUCUMBER_VERSION}"
5251
testCompile "io.cucumber:gherkin:${GHERKIN_VERSION}"
53-
testCompile "io.cucumber:cucumber-expressions:${CUCUMBER_EXPRESSIONS_VERSION}"
54-
testCompile "info.cukes:cucumber-picocontainer:${CUCUMBER_PICOCONTAINER_VERSION}"
52+
testCompile "io.cucumber:cucumber-picocontainer:${CUCUMBER_PICOCONTAINER_VERSION}"
5553
testCompile "org.mockito:mockito-all:${MOCKITO_VERSION}"
5654
testCompile "com.shazam:shazamcrest:${SHAZAMCREST_VERSION}"
5755
testCompile "org.junit.jupiter:junit-jupiter-engine:${JUNIT_JUPITER_VERSION}"

orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/cucumber/features/operators/general/ConstraintTypes.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ Feature: Correct Constraint Types, validation exceptions should be raised if the
4141
Given there is a non nullable field foo
4242
And foo has type "datetime"
4343
And foo is in set:
44-
| "aaa"|
45-
| "bbb |
46-
| "ccc |
44+
| "aaa" |
45+
| "bbb" |
46+
| "ccc" |
4747
Then the profile is invalid
4848

4949
Scenario Outline: <wrongType> constraint <constraint> cannot be applied to <type> fields

orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/cucumber/testframework/TestRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework;
1818

1919
import com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.utils.GeneratorCucumber;
20+
import io.cucumber.junit.CucumberOptions;
2021
import org.junit.runner.RunWith;
21-
import cucumber.api.CucumberOptions;
2222

2323
@RunWith(GeneratorCucumber.class)
2424
@CucumberOptions(

orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/cucumber/testframework/steps/BooleanValueStep.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
package com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.steps;
1818

19+
import com.fasterxml.jackson.core.JsonParseException;
1920
import com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.utils.CucumberTestState;
2021
import com.scottlogic.datahelix.generator.profile.dtos.constraints.ConstraintType;
21-
import cucumber.api.java.en.When;
22+
import io.cucumber.java.ParameterType;
23+
import io.cucumber.java.en.When;
2224

2325
public class BooleanValueStep {
2426
private final CucumberTestState state;
@@ -27,6 +29,11 @@ public BooleanValueStep(CucumberTestState state) {
2729
this.state = state;
2830
}
2931

32+
@ParameterType(name = "boolean", value = "(true|false)$")
33+
public Boolean defineBoolean(String value) throws JsonParseException {
34+
return Boolean.valueOf(value);
35+
}
36+
3037
@When("{fieldVar} is equal to {boolean}")
3138
public void whenFieldIsConstrainedByNumericValue(String fieldName, Boolean value) {
3239
this.state.addConstraint(fieldName, ConstraintType.EQUAL_TO, value);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2019 Scott Logic Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.steps;
18+
19+
import com.scottlogic.datahelix.generator.core.config.detail.CombinationStrategyType;
20+
import io.cucumber.java.ParameterType;
21+
22+
import java.util.Arrays;
23+
24+
public class CombinationStrategyStep {
25+
@ParameterType(name = "combinationStrategy", value = "(.*)$")
26+
public CombinationStrategyType defineCombinationStrategy(String value) {
27+
return Arrays.stream(CombinationStrategyType.values())
28+
.filter(val -> val.toString().equalsIgnoreCase(value))
29+
.findFirst().orElse(CombinationStrategyType.PINNING);
30+
}
31+
}

orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/cucumber/testframework/steps/CucumberHooks.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.steps;
1818

19-
import cucumber.api.Scenario;
20-
import cucumber.api.java.Before;
19+
import io.cucumber.java.Before;
20+
import io.cucumber.java.Scenario;
2121
import org.junit.AssumptionViolatedException;
2222

2323
public class CucumberHooks {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2019 Scott Logic Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.steps;
18+
19+
import com.scottlogic.datahelix.generator.core.config.detail.DataGenerationType;
20+
import com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.utils.CucumberGenerationMode;
21+
import io.cucumber.java.ParameterType;
22+
23+
import java.util.Arrays;
24+
25+
public class DataGenerationStep {
26+
@ParameterType(name = "generationStrategy", value = "(.*)$")
27+
public DataGenerationType defineGenerationStrategy(String value) {
28+
return Arrays.stream(DataGenerationType.values())
29+
.filter(val -> val.toString().equalsIgnoreCase(value))
30+
.findFirst().orElse(DataGenerationType.FULL_SEQUENTIAL);
31+
}
32+
33+
@ParameterType(name = "generationMode", value = "(.*)$")
34+
public CucumberGenerationMode defineGenerationMode(String value) {
35+
return Arrays.stream(CucumberGenerationMode.values())
36+
.filter(val -> val.toString().equalsIgnoreCase(value))
37+
.findFirst().orElse(CucumberGenerationMode.VALIDATING);
38+
}
39+
}

orchestrator/src/test/java/com/scottlogic/datahelix/generator/orchestrator/cucumber/testframework/steps/DateTimeValueStep.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
import com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.utils.CucumberTestState;
2121
import com.scottlogic.datahelix.generator.orchestrator.cucumber.testframework.utils.GeneratorTestUtilities;
2222
import com.scottlogic.datahelix.generator.profile.dtos.constraints.ConstraintType;
23-
import cucumber.api.java.en.And;
24-
import cucumber.api.java.en.Then;
25-
import cucumber.api.java.en.When;
23+
import io.cucumber.java.ParameterType;
24+
import io.cucumber.java.en.And;
25+
import io.cucumber.java.en.Then;
26+
import io.cucumber.java.en.When;
2627

2728
import java.time.OffsetDateTime;
29+
import java.util.Arrays;
30+
import java.util.List;
2831
import java.util.function.Function;
32+
import java.util.stream.Collectors;
2933

3034
public class DateTimeValueStep {
3135
public static final String DATETIME_REGEX = "(-?(\\d{4,19})-(\\d{2})-(\\d{2}T(\\d{2}:\\d{2}:\\d{2}\\.\\d{3}))Z?)";
@@ -37,6 +41,20 @@ public DateTimeValueStep(CucumberTestState state, CucumberTestHelper helper){
3741
this.helper = helper;
3842
}
3943

44+
@ParameterType(name = "date", value = DateTimeValueStep.DATETIME_REGEX)
45+
public String defineDate(String value) {
46+
return extractConstraint(value);
47+
}
48+
49+
private String extractConstraint(String gherkinConstraint) {
50+
List<String> allConstraints = Arrays.asList(gherkinConstraint.split(" "));
51+
return allConstraints.get(0) + allConstraints
52+
.stream()
53+
.skip(1)
54+
.map(value -> value.substring(0, 1).toUpperCase() + value.substring(1))
55+
.collect(Collectors.joining());
56+
}
57+
4058
@When("^([A-z0-9]+) is equal to boolean true")
4159
public void equalToTrue(String fieldName) {
4260
state.addConstraint(fieldName, ConstraintType.EQUAL_TO, true);

0 commit comments

Comments
 (0)