Skip to content

Commit 7c62589

Browse files
authored
Merge pull request #3 from blasttoys/development
Development
2 parents e1e5f50 + dc70b31 commit 7c62589

File tree

12 files changed

+105
-56
lines changed

12 files changed

+105
-56
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Change Log
22

3+
### V1.3.5-SNAPSHOT
4+
5+
- Fixed vulnerability CVE-2020-25649, CVE-2020-15522, CVE-2020-9488 and CVE-2019-17571
6+
- Update dependency library for bouncycastle to version 1.69
7+
- Update dependency library for jackson-databind to version 2.10.5.1
8+
- Remove dependency library for slf4j, updated to log4j version 2.14.1 for logging
9+
310
### V1.3.4-SNAPSHOT
411

512
- Fixed vulnerability CVE-2019-14379 and CVE-2019-14439

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2017-2020 GovTech, Government Digital Services, PDD-AI
1+
Copyright (C) 2017-2021 GovTech, Government Digital Services - ENP
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,25 @@ mvn install
6363
<dependency>
6464
<groupId>com.api.util</groupId>
6565
<artifactId>ApiSecurity</artifactId>
66-
<version>1.3.2-SNAPSHOT</version>
66+
<version>1.3.5-SNAPSHOT</version>
6767
</dependency>
6868
```
6969

7070
**Note:**
71-
* This project is leveraging on _slf4j-log4j12_ framework for the logging. If you are using logging implementation other than log4j, you can change to other type of implementation such as nop,simple,jdk14,logback. You could replace the following xml in pom.xml.
72-
* If your are using Log4j _Version2_, please refer to [Log4j2-SLF4J Binding](https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/index.html)
71+
* This project is leveraging on Log4j _Version2_ framework for the logging. If you are using logging implementation other than Log4j _Version2_ , you can change to other type of implementation such as nop,simple,jdk14,logback. You could replace the following xml in pom.xml.
7372

7473

7574
```xml
7675
<dependency>
77-
<groupId>org.slf4j</groupId>
78-
<artifactId>slf4j-log4j12</artifactId>
79-
<version>1.7.25</version>
76+
<groupId>org.apache.logging.log4j</groupId>
77+
<artifactId>log4j-api</artifactId>
78+
<version>2.14.1</version>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.apache.logging.log4j</groupId>
82+
<artifactId>log4j-core</artifactId>
83+
<version>2.14.1</version>
8084
</dependency>
81-
8285
```
8386

8487
#### Maven Test
@@ -136,7 +139,7 @@ repositories {
136139
mavenLocal()
137140
}
138141
dependencies {
139-
compile group: 'com.api.util', name: 'ApiSecurity', version: '1.3.1-SNAPSHOT'
142+
compile group: 'com.api.util', name: 'ApiSecurity', version: '1.3.5-SNAPSHOT'
140143
}
141144
142145
```
@@ -554,7 +557,7 @@ public void Http_POST_Test() throws ApiUtilException, IOException
554557
}
555558

556559
```
557-
560+
558561
## Contributing
559562
For more information about contributing PRs and issues, see [CONTRIBUTING.md](.github/CONTRIBUTING.md).
560563

@@ -566,6 +569,6 @@ See [CHANGELOG.md](CHANGELOG.md).
566569

567570
## References
568571
+ [UTF-8 in Gradle](https://stackoverflow.com/questions/21267234/show-utf-8-text-properly-in-gradle)
569-
+ [SLF4J FAQ](https://www.slf4j.org/faq.html)
570-
+ [Akana API Consumer Security](http://docs.akana.com/ag/cm_policies/using_api_consumer_app_sec_policy.htm)
571-
+ [RSA and HMAC Request Signing Standard](http://tools.ietf.org/html/draft-cavage-http-signatures-05)
572+
+ [LOG4J2 FAQ](https://logging.apache.org/log4j/2.x/faq.html)
573+
+ [Akana API Consumer Security](http://docs.akana.com/cm/learnmore/app_security.htm)
574+
+ [RSA and HMAC Request Signing Standard](https://tools.ietf.org/id/draft-cavage-http-signatures-08.html)

build.gradle

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'com.github.kt3k.coveralls' version '2.6.3'
55
}
66

7-
version '1.3.4-SNAPSHOT'
7+
version '1.3.5-SNAPSHOT'
88

99
tasks.withType(JavaCompile) {
1010
options.encoding = "UTF-8"
@@ -16,13 +16,23 @@ repositories {
1616

1717
dependencies {
1818
//compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'
19+
20+
//gradle 4.0
1921
compile group: 'commons-lang', name: 'commons-lang', version: '2.4'
20-
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
21-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.9.2'
22+
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
23+
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1'
24+
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.5.1'
2225
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
23-
compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.60'
24-
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.25'
25-
testCompile group: 'junit', name: 'junit', version: '4.12'
26+
compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.69'
27+
28+
testCompile group: 'junit', name: 'junit', version: '4.13.1'
29+
30+
//gradle 6.9
31+
//implementation group: 'commons-lang', name: 'commons-lang', version: '2.4'
32+
//implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.5.1'
33+
//implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
34+
//implementation group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.69'
35+
//testImplementation group: 'junit', name: 'junit', version: '4.13.1'
2636
}
2737

2838
jar {

pom.xml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.api.util</groupId>
44
<artifactId>ApiSecurity</artifactId>
5-
<version>1.3.4-SNAPSHOT</version>
5+
<version>1.3.5-SNAPSHOT</version>
66
<build>
77
<plugins>
88
<plugin>
@@ -61,7 +61,7 @@
6161
<dependency>
6262
<groupId>junit</groupId>
6363
<artifactId>junit</artifactId>
64-
<version>4.12</version>
64+
<version>4.13.1</version>
6565
<scope>test</scope>
6666
<exclusions>
6767
<exclusion>
@@ -78,10 +78,15 @@
7878
<scope>test</scope>
7979
</dependency>
8080
<dependency>
81-
<groupId>org.slf4j</groupId>
82-
<artifactId>slf4j-log4j12</artifactId>
83-
<version>1.7.25</version>
84-
</dependency>
81+
<groupId>org.apache.logging.log4j</groupId>
82+
<artifactId>log4j-api</artifactId>
83+
<version>2.14.1</version>
84+
</dependency>
85+
<dependency>
86+
<groupId>org.apache.logging.log4j</groupId>
87+
<artifactId>log4j-core</artifactId>
88+
<version>2.14.1</version>
89+
</dependency>
8590
<dependency>
8691
<groupId>commons-lang</groupId>
8792
<artifactId>commons-lang</artifactId>
@@ -90,7 +95,7 @@
9095
<dependency>
9196
<groupId>com.fasterxml.jackson.core</groupId>
9297
<artifactId>jackson-databind</artifactId>
93-
<version>2.10.0.pr3</version>
98+
<version>2.10.5.1</version>
9499
</dependency>
95100
<dependency>
96101
<groupId>com.googlecode.json-simple</groupId>
@@ -100,7 +105,7 @@
100105
<dependency>
101106
<groupId>org.bouncycastle</groupId>
102107
<artifactId>bcpkix-jdk15on</artifactId>
103-
<version>1.60</version>
108+
<version>1.69</version>
104109
</dependency>
105110
</dependencies>
106111
<properties>

src/main/java/com/api/util/ApiSecurity/ApiSigning.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
1111
import org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder;
1212
import org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder;
13+
import org.apache.logging.log4j.Logger;
14+
import org.apache.logging.log4j.LogManager;
1315
import org.bouncycastle.operator.InputDecryptorProvider;
1416
import org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo;
15-
import org.slf4j.Logger;
16-
import org.slf4j.LoggerFactory;
17+
1718

1819
import javax.crypto.Mac;
1920
import javax.crypto.spec.SecretKeySpec;
@@ -42,7 +43,7 @@
4243
*/
4344
public class ApiSigning {
4445

45-
private static final Logger log = LoggerFactory.getLogger(ApiSigning.class);
46+
private static final Logger log = LogManager.getLogger(ApiSigning.class);
4647

4748
/**
4849
* Create HMACRSA256 Signature (L1) with a given basestring

src/main/resources/log4j.properties

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/main/resources/log4j2.properties

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
status = error
3+
dest = err
4+
name = PropertiesConfig
5+
6+
7+
# log to console
8+
appender.console.type = Console
9+
appender.console.name = STDOUT
10+
appender.console.layout.type = PatternLayout
11+
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n
12+
13+
14+
# log to file
15+
# property.filename = target/rolling/rollingtest.log
16+
# appender.rolling.type = RollingFile
17+
# appender.rolling.name = RollingFile
18+
# appender.rolling.fileName = ${filename}
19+
# appender.rolling.filePattern = target/rolling2/test1-%d{MM-dd-yy-HH-mm-ss}-%i.log.gz
20+
# appender.rolling.layout.type = PatternLayout
21+
# appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} [%t] %-5p:: %m%n
22+
# appender.rolling.policies.type = Policies
23+
# appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
24+
# appender.rolling.policies.time.interval = 2
25+
# appender.rolling.policies.time.modulate = true
26+
# appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
27+
# appender.rolling.policies.size.size=10000KB
28+
# appender.rolling.strategy.type = DefaultRolloverStrategy
29+
# appender.rolling.strategy.max = 10
30+
# logger.rolling.name = com.example.my.app
31+
# logger.rolling.level = debug
32+
# logger.rolling.additivity = false
33+
# logger.rolling.appenderRef.rolling.ref = RollingFile
34+
35+
36+
#Root logger
37+
rootLogger.level = debug
38+
rootLogger.appenderRef.stdout.ref = STDOUT

src/test/java/com/api/util/ApiSecurity/ApiSecurityTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import java.util.Set;
1717

1818
import org.junit.runner.RunWith;
19-
import org.slf4j.Logger;
20-
import org.slf4j.LoggerFactory;
19+
import org.apache.logging.log4j.Logger;
20+
import org.apache.logging.log4j.LogManager;
2121

2222
import com.api.util.testframework.JUnitFactoryRunner;
2323
import com.api.util.testframework.JUnitTestFactory;
@@ -35,7 +35,7 @@
3535
@RunWith(JUnitFactoryRunner.class)
3636
public class ApiSecurityTest {
3737

38-
private static final Logger log = LoggerFactory.getLogger(ApiSecurityTest.class);
38+
private static final Logger log = LogManager.getLogger(ApiSecurityTest.class);
3939

4040
private static final String testDataPath = getLocalPath("src/main/resources/test-suites/testData/");
4141

src/test/java/com/api/util/ApiSecurity/AuthorizationTokenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import static org.junit.Assert.*;
1010

1111
/**
12-
* @author GDS-PDD
12+
* @author GDS-ENP
1313
*
1414
*/
1515
public class AuthorizationTokenTest {

src/test/java/com/api/util/testframework/RuntimeTestCase.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.api.util.testframework;
22

3-
import org.slf4j.Logger;
4-
import org.slf4j.LoggerFactory;
3+
import org.apache.logging.log4j.Logger;
4+
import org.apache.logging.log4j.LogManager;
55

66
import com.api.util.ApiSecurity.ApiList;
77
import com.api.util.ApiSecurity.ApiSigning;
@@ -35,7 +35,7 @@
3535

3636
public class RuntimeTestCase{
3737

38-
private static final Logger log = LoggerFactory.getLogger(RuntimeTestCase.class);
38+
private static final Logger log = LogManager.getLogger(RuntimeTestCase.class);
3939

4040
//private ApiList apiList;
4141
private String testName;
@@ -61,6 +61,7 @@ public void setTestName(String testName) {
6161
*/
6262
@JUnitFactoryTest
6363
public void getSignatureBaseString() throws IOException, InterruptedException, ParseException {
64+
log.trace("Entering teset test application.");
6465
log.info("====================> Start :: RuntimeTestCase :: getSignatureBaseString :: testName : {} ", testName);
6566

6667
ExpectedResult expectedResult = testDatum.getExpectedResult();

src/test/java/com/api/util/testframework/RuntimeTestUtility.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.api.util.testframework;
22

3-
import org.slf4j.Logger;
4-
import org.slf4j.LoggerFactory;
3+
import org.apache.logging.log4j.Logger;
4+
import org.apache.logging.log4j.LogManager;
55

66
import com.api.util.ApiSecurity.ApiList;
77
import com.api.util.ApiSecurity.ApiUtilException;
@@ -19,7 +19,7 @@
1919

2020
public class RuntimeTestUtility {
2121

22-
private static final Logger log = LoggerFactory.getLogger(RuntimeTestUtility.class);
22+
private static final Logger log = LogManager.getLogger(RuntimeTestUtility.class);
2323
private static ApiList apiList;
2424

2525
public static String getExpectedResultMap(ExpectedResult expectedResult) throws ApiUtilException {

0 commit comments

Comments
 (0)