Skip to content

Commit

Permalink
feat: Denylist PlayWeb configuration names with undefined config keys.
Browse files Browse the repository at this point in the history
…Fixes #57
  • Loading branch information
Mat Mannion authored and Mat Mannion committed Aug 23, 2019
1 parent aa46958 commit 50e5d9e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scala/SnykSbtPlugin-0.1x.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.json4s._

object SnykSbtPlugin extends AutoPlugin {
val ConfigBlacklist: Set[String] =
Set("windows", "universal", "universal-docs", "debian", "rpm", "universal-src", "docker", "linux")
Set("windows", "universal", "universal-docs", "debian", "rpm", "universal-src", "docker", "linux", "web-assets", "web-plugin", "web-assets-test")

case class SnykModuleInfo(version: String, configurations: Set[String])

Expand Down
2 changes: 1 addition & 1 deletion scala/SnykSbtPlugin-1.2x.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import sjsonnew.support.scalajson.unsafe.PrettyPrinter

object SnykSbtPlugin extends AutoPlugin {
val ConfigBlacklist: Set[String] =
Set("windows", "universal", "universal-docs", "debian", "rpm", "universal-src", "docker", "linux")
Set("windows", "universal", "universal-docs", "debian", "rpm", "universal-src", "docker", "linux", "web-assets", "web-plugin", "web-assets-test")

case class SnykModuleInfo(version: String, configurations: Set[String])
case class SnykProjectData(
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/testproj-play-scala-seed-1.2.8/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
logs
target
/.idea
/.idea_modules
/.classpath
/.project
/.settings
/RUNNING_PID
17 changes: 17 additions & 0 deletions test/fixtures/testproj-play-scala-seed-1.2.8/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name := """testproj-play-scala-seed-1.2.8"""
organization := "com.example"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.13.0"

libraryDependencies += guice
libraryDependencies += "org.scalatestplus.play" %% "scalatestplus-play" % "4.0.3" % Test

// Adds additional packages into Twirl
//TwirlKeys.templateImports += "com.example.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "com.example.binders._"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.2.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.3")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
14 changes: 14 additions & 0 deletions test/system/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ test('run inspect() on 1.2.8 with custom-plugin', async (t) => {
'1.4',
'correct version found');
});

test('run inspect() on play-scala-seed 1.2.8 with custom-plugin', async (t) => {
const result: any = await plugin.inspect(path.join(__dirname, '..', 'fixtures'),
'testproj-play-scala-seed-1.2.8/build.sbt', {'sbt-graph': true});
t.equal(result.plugin.name, 'snyk:sbt', 'correct handler');

t.equal(result.package.packageFormatVersion, 'mvn:0.0.1', 'correct package format version');
t.equal(result.package
.dependencies['com.typesafe.play:play-guice_2.13']
.dependencies['com.typesafe.play:play_2.13']
.dependencies['com.fasterxml.jackson.datatype:jackson-datatype-jsr310'].version,
'2.9.8',
'correct version found');
});

0 comments on commit 50e5d9e

Please sign in to comment.