Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 2b3e74a

Browse files
lopenchiJoseLion
andauthored
[DEVEDSB-1797] Patch high vulnerabilities reported by Snyk (#183)
* Upgrade logback to latet version * Fix CVE-2023-32697 vulnerability for jdbc:sqlite * Fix error when runnin app * Fix vulnerabilities: CVE-2023-5072, CVE-2022-45688 and CVSS 7.5 for org:json * Fix vulnerabilities: CVE-2020-36518 for jackson:databind introducing through twilio * Apply suggestions from code review Co-authored-by: Jose Luis Leon <joseluis5000l@gmail.com> --------- Co-authored-by: Jose Luis Leon <joseluis5000l@gmail.com>
1 parent 6d6546f commit 2b3e74a

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

build.gradle

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ plugins {
99

1010
sourceCompatibility = 1.8
1111
targetCompatibility = 1.8
12-
ext['logbackVersion'] = '1.1.11'
1312
ext['springBootVer'] = '2.2.6.RELEASE'
1413

1514

@@ -31,25 +30,32 @@ configurations {
3130
dependencies {
3231
implementation(group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1')
3332
implementation(group: 'javax.el', name:'javax.el-api', version:'3.0.0')
34-
// Groovy
35-
implementation(group:'org.codehaus.groovy', name:'groovy-all', version:'3.0.8')
3633

3734
// Spring
3835
implementation(group:'org.springframework.boot', name:'spring-boot-starter-data-jpa', version:"${springBootVer}")
3936
implementation(group:'org.springframework.boot', name:'spring-boot-starter-security', version:"${springBootVer}")
40-
implementation(group:'net.rakugakibox.spring.boot', name:'logback-access-spring-boot-starter', version:'2.8.0')
37+
implementation(group:'net.rakugakibox.spring.boot', name:'logback-access-spring-boot-starter', version:'2.11.0')
4138

4239
implementation(group:'com.authy', name:'authy-java', version:'1.5.1')
43-
implementation(group:'com.twilio.sdk', name:'twilio', version:'8.11.0')
44-
implementation(group:'org.xerial', name:'sqlite-jdbc', version:'3.34.0')
40+
implementation(group:'com.twilio.sdk', name:'twilio', version:'8.31.1')
41+
implementation(group:'org.xerial', name:'sqlite-jdbc', version:'3.41.2.2')
4542

4643
testImplementation(group: 'junit', name:'junit', version:'4.13.2')
4744
testImplementation(group:'org.springframework.boot', name:'spring-boot-starter-test', version:"${springBootVer}")
48-
45+
// Groovy
46+
testImplementation (group: 'org.apache.groovy', name: 'groovy-all', version: '4.0.15', ext: 'pom')
47+
48+
// Constraints
49+
constraints {
50+
implementation('org.json:json:20231013') {
51+
because("version defined in authy-java (transitive dependency) has vulnerabilities issues")
52+
}
53+
}
54+
4955
// Spock
5056
testImplementation(group:'org.spockframework', name:'spock-core', version:'2.0-M4-groovy-3.0')
5157
testImplementation(group:'org.spockframework', name:'spock-spring', version:'2.0-M4-groovy-3.0')
52-
testRuntime(group:'cglib', name:'cglib-nodep', version:'3.3.0')
58+
testRuntimeOnly(group:'cglib', name:'cglib-nodep', version:'3.3.0')
5359
}
5460

5561
test {

src/test/groovy/com/twilio/accountsecurity/controllers/PhoneVerificationControllerSpec.groovy

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package com.twilio.accountsecurity.controllers
22

3+
import com.fasterxml.jackson.core.JsonFactoryBuilder
34
import com.twilio.accountsecurity.controllers.requests.PhoneVerificationStartRequest
45
import com.twilio.accountsecurity.controllers.requests.PhoneVerificationVerifyRequest
56
import com.twilio.accountsecurity.exceptions.PhoneVerificationException
67
import com.twilio.accountsecurity.services.PhoneVerificationService
7-
import groovy.json.JsonBuilder
8+
import org.json.JSONObject
89
import org.springframework.http.MediaType
910
import org.springframework.test.web.servlet.MockMvc
1011
import spock.lang.Specification
@@ -30,7 +31,7 @@ class PhoneVerificationControllerSpec extends Specification {
3031
def "start - returns 200"() {
3132
given:
3233
def request = new PhoneVerificationStartRequest(phone, via)
33-
def requestBody = new JsonBuilder(request).toString()
34+
def requestBody = new JSONObject(request).toString()
3435
1 * phoneVerificationService.start(phone, via)
3536

3637
when:
@@ -46,7 +47,7 @@ class PhoneVerificationControllerSpec extends Specification {
4647
def "start - returns 500 for PhoneVerificationException"() {
4748
given:
4849
def request = new PhoneVerificationStartRequest(phone, via)
49-
def requestBody = new JsonBuilder(request).toString()
50+
def requestBody = new JSONObject(request).toString()
5051
1 * phoneVerificationService.start(phone, via) >> {
5152
throw new PhoneVerificationException('message')
5253
}
@@ -65,7 +66,7 @@ class PhoneVerificationControllerSpec extends Specification {
6566
def "verify - returns 200"() {
6667
given:
6768
def httpRequest = new PhoneVerificationVerifyRequest(phone, token)
68-
def requestBody = new JsonBuilder(httpRequest).toString()
69+
def requestBody = new JSONObject(httpRequest).toString()
6970
1 * phoneVerificationService.verify(phone, token)
7071

7172
expect:
@@ -80,7 +81,7 @@ class PhoneVerificationControllerSpec extends Specification {
8081
def "verify - returns 500 for PhoneVerificationException"() {
8182
given:
8283
def httpRequest = new PhoneVerificationVerifyRequest(phone, token)
83-
def requestBody = new JsonBuilder(httpRequest).toString()
84+
def requestBody = new JSONObject(httpRequest).toString()
8485
1 * phoneVerificationService.verify(phone, token) >> {
8586
throw new PhoneVerificationException('message')
8687
}

src/test/groovy/com/twilio/accountsecurity/controllers/RegisterControllerSpec.groovy

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
package com.twilio.accountsecurity.controllers
22

33
import com.twilio.accountsecurity.controllers.requests.UserRegisterRequest
4-
import com.twilio.accountsecurity.exceptions.TokenVerificationException
54
import com.twilio.accountsecurity.exceptions.UserExistsException
65
import com.twilio.accountsecurity.services.RegisterService
7-
import groovy.json.JsonBuilder
8-
import org.springframework.http.MediaType
9-
import org.springframework.mock.web.MockHttpServletRequest
106
import org.springframework.test.web.servlet.MockMvc
11-
import org.springframework.test.web.servlet.request.RequestPostProcessor
127
import spock.lang.Specification
138
import spock.lang.Subject
149

1510
import javax.servlet.ServletException
1611
import javax.servlet.http.HttpServletRequest
17-
import java.security.Principal
1812

19-
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
2013
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup
2114

2215
class RegisterControllerSpec extends Specification {

0 commit comments

Comments
 (0)