Skip to content

Commit 4b2ec52

Browse files
committed
USPR-13800: fix CI wiring for verifySpringExpressionVersion and dedupe version constant
Wire verifySpringExpressionVersion into the `test` task (in addition to `check`) so it actually executes as part of this repo's CI, which invokes `test` directly rather than the `check` lifecycle task. Also extract the 7.0.8 floor into a single local variable within build.gradle to avoid duplicating the version literal across the resolutionStrategy block and the verification task.
1 parent ca57a93 commit 4b2ec52

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎build.gradle‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ allprojects {
2323
}
2424

2525
subprojects {
26+
def springExpressionMinVersion = '7.0.8'
27+
2628
configurations.configureEach {
2729
resolutionStrategy.eachDependency {
2830
if (requested.group == 'tools.jackson.core'
@@ -59,10 +61,10 @@ subprojects {
5961
'after maxHeaderSize truncation, fixed in 4.2.16.Final')
6062
}
6163
if (requested.group == 'org.springframework' && requested.name == 'spring-expression'
62-
&& requested.version != null && requested.version < '7.0.8') {
63-
useVersion('7.0.8')
64+
&& requested.version != null && requested.version < springExpressionMinVersion) {
65+
useVersion(springExpressionMinVersion)
6466
because('GHSA-r5w3-xv2f-j59q: Spring Expression Language (SpEL) Algorithmic Denial of Service ' +
65-
'via crafted expressions causing excessive resource consumption, fixed in 7.0.8')
67+
'via crafted expressions causing excessive resource consumption, fixed in ' + springExpressionMinVersion)
6668
}
6769
}
6870
}
@@ -132,14 +134,15 @@ subprojects {
132134
if (dep instanceof org.gradle.api.artifacts.result.ResolvedDependencyResult) {
133135
def id = dep.selected.moduleVersion
134136
if (id != null && id.group == 'org.springframework' && id.name == 'spring-expression'
135-
&& id.version < '7.0.8') {
136-
throw new GradleException("org.springframework:spring-expression resolved to ${id.version} in configuration ${config.name}, but must be >= 7.0.8 (GHSA-r5w3-xv2f-j59q)")
137+
&& id.version < springExpressionMinVersion) {
138+
throw new GradleException("org.springframework:spring-expression resolved to ${id.version} in configuration ${config.name}, but must be >= ${springExpressionMinVersion} (GHSA-r5w3-xv2f-j59q)")
137139
}
138140
}
139141
}
140142
}
141143
}
142144
}
143145

146+
tasks.named('test') { dependsOn tasks.named('verifySpringExpressionVersion') }
144147
tasks.named('check') { dependsOn tasks.named('verifySpringExpressionVersion') }
145148
}

0 commit comments

Comments
 (0)