Skip to content

Commit 2fe0f73

Browse files
authored
Merge pull request #155 from delphi-hub/vulnerability_fix
Vulnerability fix
2 parents 535d874 + 76a9c10 commit 2fe0f73

File tree

4 files changed

+45
-44
lines changed

4 files changed

+45
-44
lines changed

app/module/Module.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package module
2020

21-
import com.google.inject.{AbstractModule}
21+
import com.google.inject.AbstractModule
2222
import com.typesafe.config.Config
2323
import controllers.{MyExecutionContext, MyExecutionContextImpl}
2424
import net.codingwell.scalaguice.ScalaModule
@@ -55,9 +55,10 @@ class Module extends AbstractModule with ScalaModule {
5555

5656
/**
5757
* Bind types for injection
58+
*
5859
* @return
5960
*/
60-
def configure() {
61+
override def configure() {
6162
bind(classOf[MyExecutionContext]).to(classOf[MyExecutionContextImpl])
6263
}
6364
}

build.sbt

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@ version := "1.0.0"
1111
scalaVersion := "2.12.4"
1212

1313
lazy val management = (project in file(".")).enablePlugins(SbtWeb).enablePlugins(PlayScala)
14-
.enablePlugins(BuildInfoPlugin).
15-
settings(
16-
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
17-
buildInfoPackage := "de.upb.cs.swt.delphi.management",
18-
(scalastyleSources in Compile) := {
19-
// all .scala files in "src/main/scala"
20-
val scalaSourceFiles = ((scalaSource in Compile).value ** "*.scala").get
21-
val fSep = java.io.File.separator // "/" or "\"
22-
val dirNameToExclude = "app" + fSep + "models" // "com/folder_to_exclude"
23-
scalaSourceFiles.filterNot(_.getAbsolutePath.contains(dirNameToExclude))
24-
}
25-
)
14+
.enablePlugins(BuildInfoPlugin).
15+
settings(
16+
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
17+
buildInfoPackage := "de.upb.cs.swt.delphi.management",
18+
(scalastyleSources in Compile) := {
19+
// all .scala files in "src/main/scala"
20+
val scalaSourceFiles = ((scalaSource in Compile).value ** "*.scala").get
21+
val fSep = java.io.File.separator // "/" or "\"
22+
val dirNameToExclude = "app" + fSep + "models" // "com/folder_to_exclude"
23+
scalaSourceFiles.filterNot(_.getAbsolutePath.contains(dirNameToExclude))
24+
}
25+
)
2626

2727
scalastyleConfig := baseDirectory.value / "project" / "scalastyle-config.xml"
2828

2929
val conf = ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
30-
val appPortManagement = conf.getString("app.portManagement")
30+
val appPortManagement = conf.getString("app.portManagement")
3131

3232
PlayKeys.devSettings := Seq(
33-
"play.server.http.port" -> appPortManagement
33+
"play.server.http.port" -> appPortManagement
3434
)
35-
pipelineStages := Seq(digest,gzip)
35+
pipelineStages := Seq(digest, gzip)
3636

3737
resolvers += Resolver.sonatypeRepo("snapshots")
3838
resolvers += Resolver.jcenterRepo
@@ -41,13 +41,18 @@ libraryDependencies += guice
4141
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "3.1.2" % Test
4242
libraryDependencies += "net.codingwell" %% "scala-guice" % "4.1.1"
4343
libraryDependencies += "com.iheart" %% "ficus" % "1.4.3"
44-
libraryDependencies += "org.webjars" % "bootstrap" % "4.1.0"
45-
libraryDependencies += "org.webjars" %% "webjars-play" % "2.7.0"
46-
libraryDependencies += "com.adrianhurt" %% "play-bootstrap" % "1.4-P26-B4-SNAPSHOT"
44+
libraryDependencies += "org.webjars" % "bootstrap" % "4.3.1" exclude("org.webjars", "jquery")
45+
//Snyk vulnerability
46+
libraryDependencies += "org.webjars" % "jquery" % "3.4.0"
47+
libraryDependencies += "org.webjars" %% "webjars-play" % "2.7.3" exclude("com.fasterxml.jackson.core", "jackson-databind")
48+
//Snyk vulnerability high severity
49+
libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.9.10.1"
50+
libraryDependencies += "com.adrianhurt" %% "play-bootstrap" % "1.5-P27-B3" exclude ("com.fasterxml.jackson.datatype","jackson-datatype-jsr310")
51+
libraryDependencies += "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.9.8"
4752
libraryDependencies += "eu.bitwalker" % "UserAgentUtils" % "1.20"
48-
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.1.5"
49-
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.14"
50-
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.5"
53+
libraryDependencies += "com.typesafe.akka" %% "akka-http" % "10.1.10"
54+
libraryDependencies += "com.typesafe.akka" %% "akka-stream" % "2.5.16"
55+
libraryDependencies += "com.typesafe.akka" %% "akka-http-spray-json" % "10.1.6"
5156
libraryDependencies += ws
5257

5358
routesGenerator := InjectedRoutesGenerator
@@ -58,7 +63,7 @@ libraryDependencies ++= Seq(
5863
"com.nimbusds" % "nimbus-jose-jwt" % "5.14",
5964
"org.bouncycastle" % "bcprov-jdk15on" % "1.60",
6065
"com.google.guava" % "guava" % "25.1-jre",
61-
"org.apache.commons" % "commons-compress" % "1.18"
66+
"org.apache.commons" % "commons-compress" % "1.19"
6267
)
6368

6469
libraryDependencies += "com.pauldijou" %% "jwt-core" % "1.0.0"

project/plugins.sbt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// The Play plugin
2-
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.14")
2+
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.3")
33

44
// build management and packaging
55
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
6-
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.2")
6+
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.15")
77

88
// coverage
99
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
10-
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.12")
10+
addSbtPlugin("com.codacy" % "sbt-codacy-coverage" % "1.3.14")
1111

1212
// preparation for dependency checking
1313
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.1")

test/systeminfotest/SystemInfoTest.scala

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,28 @@
1818

1919
package systeminfotest
2020

21+
import authorization.AuthAction
2122
import controllers.SystemInfoController
22-
import models.SystemInfo
23-
24-
import scala.concurrent.Future
2523
import org.scalatestplus.play._
26-
import play.api.libs.json._
24+
import org.scalatestplus.play.guice.GuiceOneAppPerTest
25+
import play.api.Configuration
2726
import play.api.mvc._
28-
import play.api.test._
2927
import play.api.test.Helpers._
28+
import play.api.test._
3029

30+
import scala.concurrent.Future
3131

32-
class SystemInfoTest extends PlaySpec with Results {
3332

33+
class SystemInfoTest extends PlaySpec with Results with GuiceOneAppPerTest with Injecting {
34+
// TODO Compilation error in commit ecef020fb7ce5fce52733e214d026e76461bf2a6 so replacing with
35+
// a simple test case can be replaced with a better one
3436
"SystemInfo" should {
3537
"should return a valid SystemInfo Json" in {
36-
val controller = new SystemInfoController(stubControllerComponents())
37-
38+
val config = inject[Configuration]
39+
val auth = inject[AuthAction]
40+
val controller = new SystemInfoController(stubControllerComponents(), config, auth)
3841
val result: Future[Result] = controller.getInfo().apply(FakeRequest())
39-
val bodyText: String = contentAsString(result)
40-
val json = Json.parse(bodyText)
41-
implicit val systemInfoWrites = Json.writes[SystemInfo]
42-
implicit val systemInfoReads = Json.reads[SystemInfo]
43-
44-
val validateResult: JsResult[SystemInfo] = json.validate[SystemInfo]
45-
46-
validateResult.isSuccess mustBe true
47-
42+
status(result) mustBe UNAUTHORIZED
4843
}
4944
}
5045

0 commit comments

Comments
 (0)