0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

dependency-checkでgrettyに含まれる脆弱性をスキップする方法

Last updated at Posted at 2019-12-30

前提 - バージョン

build.gradle.kts
plugins {
  id("org.owasp.dependencycheck") version "5.2.4"

  id("org.gretty") version "3.0.1"
}

説明

dependency-checkとは

依存関係に脆弱性がないか調べてくれるツール
owaspのjeremylongさんがつくっている?
https://jeremylong.github.io/DependencyCheck/

grettyとは

IDEの機能を使わなくても、gradleタスクでtomcatやjettyなどのアプリケーションサーバーを起動できる
gradleプラグイン
https://plugins.gradle.org/plugin/org.gretty

なぜしようとおもったか

grettyいれたらたくさん脆弱性があった

image.png

とても悲しい・・・
見つかった脆弱性は246個とのこと。

grettyはローカル環境だけで使っていて、
開発環境や本番環境で製品となる依存関係には含まれないので、
この脆弱性は見たくない。

方法

1.grettyのconfigurationをしらべる

下記のようなタスクを用意・実行して、configurationの一覧を出力する

build.gradle.kts
tasks.register("showConfiguration") {
    configurations.stream().forEach {
        println(it.name)
    }
}

出力した結果、「gretty」から始まるconfigurationがあるので、
コピーしておく

2.dependencyCheckのskipConfigurationsに1.を入れる

gretty version 3.0.1の場合だと以下のようになりました。
前のバージョンだと、「tomcat8」等追加になるかと思います

kotlin DSL

build.gradle.kts
dependencyCheck {
  skipConfigurations = listOf(
      "gretty",
      "grettyNoSpringBoot",
      "grettyProductRuntime",
      "grettyProvidedCompile",
      "grettyRunnerJetty7",
      "grettyRunnerJetty8",
      "grettyRunnerJetty9",
      "grettyRunnerJetty93",
      "grettyRunnerJetty94",
      "grettyRunnerTomcat85",
      "grettyRunnerTomcat9",
      "grettySpringLoaded",
      "grettyStarter"
  )
}

gradle

build.gradle
dependencyCheck {
  skipConfigurations = [
      "gretty",
      "grettyNoSpringBoot",
      "grettyProductRuntime",
      "grettyProvidedCompile",
      "grettyRunnerJetty7",
      "grettyRunnerJetty8",
      "grettyRunnerJetty9",
      "grettyRunnerJetty93",
      "grettyRunnerJetty94",
      "grettyRunnerTomcat85",
      "grettyRunnerTomcat9",
      "grettySpringLoaded",
      "grettyStarter"
  ]
}

結果

image.png

見つかった脆弱性は0になりました:relaxed:

まとめ

※gretty version 3.0.1の場合。
前のバージョンだと、「tomcat8」等追加になるかと思います

build.gradle.kts
dependencyCheck {
  skipConfigurations = listOf(
      "gretty",
      "grettyNoSpringBoot",
      "grettyProductRuntime",
      "grettyProvidedCompile",
      "grettyRunnerJetty7",
      "grettyRunnerJetty8",
      "grettyRunnerJetty9",
      "grettyRunnerJetty93",
      "grettyRunnerJetty94",
      "grettyRunnerTomcat85",
      "grettyRunnerTomcat9",
      "grettySpringLoaded",
      "grettyStarter"
  )
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?