-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
170 lines (148 loc) · 5.56 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
170 lines (148 loc) · 5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins {
kotlin("multiplatform") version "2.4.10"
id("com.vanniktech.maven.publish") version "0.37.0"
}
// Security floors for npm packages in the Kotlin/JS build toolchain
// (kotlin-js-store/yarn.lock). None of these reach the published artifact: the JS
// package declares no dependencies, and they only run webpack/karma/mocha at build
// time. They are pinned here rather than in the lockfile alone because
// `kotlinUpgradeYarnLock` keeps any entry that already satisfies its declared range,
// so a plain lock refresh leaves the vulnerable version in place.
//
// Some of these override the range their parent asks for (Dependabot's patched
// version is a major bump for the parent), so the yarn resolution is the only way
// to reach them without also upgrading the parent.
//
// NOTE: `rootPackageJson` does not treat resolutions as a task input, so after
// editing this map run `./gradlew kotlinUpgradeYarnLock --rerun-tasks`.
//
// When adding or raising a floor, set it from the newest advisory affecting that
// major line, not from the one Dependabot happens to have flagged. A follow-up
// advisory can find an earlier fix incomplete and make its "patched" version
// vulnerable in turn, which is exactly what happened to brace-expansion below.
val npmSecurityFloors = mapOf(
// host confusion; ajv <- schema-utils <- webpack. Parent asks ^3.0.1.
// GHSA-7p8r-x3mc-p8w7 (CVE-2026-18446), GHSA-v2hh-gcrm-f6hx (CVE-2026-16221)
"fast-uri" to "^3.1.5",
// minimatch@^9 asks ^2.0.2. The floor is 2.1.4 rather than the 2.1.3 that
// GHSA-mh99-v99m-4gvg patches, because GHSA-rgw5-rvv9-x895 (CVE-2026-69152)
// then found that mitigation incomplete and 2.1.3 itself vulnerable.
"brace-expansion" to "^2.1.4",
// mocha asks ^6.0.2, patched is 7.0.5. GHSA-5c6j-r48x-rmvq, GHSA-qj8w-gfj5-8c6v
"serialize-javascript" to "^7.0.5",
// mocha asks ^7.0.0, patched is 8.0.3. GHSA-73rr-hh4g-fpgx
"diff" to "^8.0.3",
// KGP pins webpack exactly (5.101.3); patched is 5.104.1. Held to the 5.104
// minor on purpose: a caret floats to the latest 5.x, which is a much larger
// drift from the version KGP is tested against than these two low-severity
// advisories justify. GHSA-8fgc-7cc6-rx7x, GHSA-38r7-794h-5758
"webpack" to "~5.104.1",
)
rootProject.plugins.withType<YarnPlugin> {
val yarn = rootProject.the<YarnRootExtension>()
npmSecurityFloors.forEach { (pkg, version) -> yarn.resolution(pkg, version) }
}
val major = 2
val minor = 0
val patch = 1
val isCiServer = System.getenv("GITHUB_ACTIONS") != null || System.getProperty("GITHUB_ACTIONS") != null
group = "io.viascom.nanoid"
version = "$major.$minor.$patch${if (isCiServer) "" else "-SNAPSHOT"}"
logger.lifecycle("Version of this build: $version")
repositories {
mavenCentral()
}
kotlin {
jvmToolchain(17)
jvm()
js {
browser {
testTask {
useKarma { useChromeHeadless() }
}
}
nodejs()
}
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser {
testTask {
useKarma { useChromeHeadless() }
}
}
nodejs()
}
macosArm64()
iosArm64()
iosX64()
iosSimulatorArm64()
tvosArm64()
tvosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosDeviceArm64()
watchosSimulatorArm64()
linuxX64()
linuxArm64()
mingwX64()
sourceSets {
commonMain.dependencies {
implementation("dev.whyoleg.cryptography:cryptography-random:0.6.0")
}
commonTest.dependencies {
implementation(kotlin("test"))
}
}
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
tasks.withType<Jar>().configureEach {
manifest {
attributes["Implementation-Version"] = project.version
}
}
mavenPublishing {
// Uploads and validates on the Central Portal; releasing stays a manual
// click on central.sonatype.com (deliberate: spec section 2.4).
publishToMavenCentral()
// GPG signing stays CI-only, driven by the signing.* properties the
// publish workflow passes (secring.gpg based, unchanged mechanism).
if (isCiServer) {
signAllPublications()
}
coordinates("io.viascom.nanoid", "nanoid", version.toString())
pom {
name.set("nanoid")
description.set("A tiny, secure, URL-friendly, unique string ID generator for Kotlin Multiplatform.")
url.set("https://github.com/viascom/nanoid-kotlin")
licenses {
license {
name.set("Apache-2.0 license")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
}
}
scm {
url.set("https://github.com/viascom/nanoid-kotlin")
connection.set("scm:git://github.com/viascom/nanoid-kotlin.git")
developerConnection.set("scm:git://github.com/viascom/nanoid-kotlin.git")
}
developers {
developer {
id.set("itsmefox")
name.set("Patrick Bösch")
email.set("patrick.boesch@viascom.email")
organizationUrl.set("https://viascom.io/")
}
developer {
id.set("nik-sta")
name.set("Nikola Stankovic")
email.set("nikola.stankovic@viascom.email")
organizationUrl.set("https://viascom.io/")
}
}
}
}