From 6774c6c82df2afb73340629e94d5c2bc30fe39a4 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Sat, 30 Dec 2023 05:47:05 +0000 Subject: [PATCH] Document `auth-common` dependency Also: * Simplify implementation dependencies. --- buildSrc/build.gradle.kts | 83 +++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 39 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 9df492c4..b69b91dd 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -169,49 +169,54 @@ tasks.withType { } dependencies { - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion") - - @Suppress( - "VulnerableLibrariesLocal", "RedundantSuppression" /* - `artifactregistry-auth-common` has transitive dependency on Gson and Apache `commons-codec`. - - Gson from version `2.8.6` until `2.8.9` is vulnerable to Deserialization of Untrusted Data - (https://devhub.checkmarx.com/cve-details/CVE-2022-25647/). - - Apache `commons-codec` before 1.13 is vulnerable to information exposure - (https://devhub.checkmarx.com/cve-details/Cxeb68d52e-5509/). - - We use Gson `2.10.1`and we force it in `forceProductionDependencies()`. - We use `commons-code` with version `1.16.0`, forcing it in `forceProductionDependencies()`. + api("com.github.jk1:gradle-license-report:$licenseReportVersion") + dependOnAuthCommon() + + listOf( + "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion", + "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion", + "com.github.jk1:gradle-license-report:$licenseReportVersion", + "com.google.guava:guava:$guavaVersion", + "com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion", + "gradle.plugin.com.github.johnrengelman:shadow:${shadowVersion}", + "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion", + "io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion", + // https://github.com/srikanth-lingala/zip4j + "net.lingala.zip4j:zip4j:2.10.0", + "net.ltgt.gradle:gradle-errorprone-plugin:${errorPronePluginVersion}", + "org.ajoberstar.grgit:grgit-core:${grGitVersion}", + "org.jetbrains.dokka:dokka-base:${dokkaVersion}", + "org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}", + "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion", + "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion", + "org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion" + ).forEach { + implementation(it) + } +} - So, we should be safe with the current version `artifactregistry-auth-common` until - we migrate to a later version. */ - ) +/** + * Includes the `implementation` dependency on `artifactregistry-auth-common`, + * with the version defined in [googleAuthToolVersion]. + * + * `artifactregistry-auth-common` has transitive dependency on Gson and Apache `commons-codec`. + * Gson from version `2.8.6` until `2.8.9` is vulnerable to Deserialization of Untrusted Data + * (https://devhub.checkmarx.com/cve-details/CVE-2022-25647/). + * + * Apache `commons-codec` before 1.13 is vulnerable to information exposure + * (https://devhub.checkmarx.com/cve-details/Cxeb68d52e-5509/). + * + * We use Gson `2.10.1` and we force it in `forceProductionDependencies()`. + * We use `commons-code` with version `1.16.0`, forcing it in `forceProductionDependencies()`. + * + * So, we should be safe with the current version `artifactregistry-auth-common` until + * we migrate to a later version. + */ +fun DependencyHandlerScope.dependOnAuthCommon() { + @Suppress("VulnerableLibrariesLocal", "RedundantSuppression") implementation( "com.google.cloud.artifactregistry:artifactregistry-auth-common:$googleAuthToolVersion" ) { exclude(group = "com.google.guava") } - - implementation("com.google.guava:guava:$guavaVersion") - api("com.github.jk1:gradle-license-report:$licenseReportVersion") - implementation("org.ajoberstar.grgit:grgit-core:${grGitVersion}") - implementation("net.ltgt.gradle:gradle-errorprone-plugin:${errorPronePluginVersion}") - - // Add explicit dependency to avoid warning on different Kotlin runtime versions. - implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - - implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion") - implementation("com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}") - implementation("org.jetbrains.dokka:dokka-base:${dokkaVersion}") - implementation("gradle.plugin.com.github.johnrengelman:shadow:${shadowVersion}") - - // https://github.com/srikanth-lingala/zip4j - implementation("net.lingala.zip4j:zip4j:2.10.0") - - implementation("io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion") - implementation("org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion") }