build(deps): persistence-jpa가 querydsl-jpa 대신 querydsl-core로 컴파일한다

문제: persistence-jpa의 compileOnly·testImplementation
`com.querydsl:querydsl-jpa:5.1.0:jakarta`에 HIGH CVE-2024-49203(orderBy를 통한 HQL injection)이 있다. 그 좌표에는 고친 버전이
없다(GHSA-6q3q-6v5j-h6vg: com.querydsl:querydsl-jpa·querydsl-apt <=5.1.0, 고친
버전 없음). trivy 37건 중 마지막 남은 한 건이다.

고친 방법: 이 leaf가 쓰는 Querydsl 타입은 `querydsl.PredicatePolicy`의
`com.querydsl.core.types.Predicate` 하나이고, 이것은 querydsl-core에 있다(공지 대상이
아니다). 그래서 두 줄을 `com.querydsl:querydsl-core`(Boot BOM이 관리하는 5.1.0)로
바꾼다. 둘 다 compileOnly·test 범위라 배포물은 원래부터 Querydsl을 싣지 않는다.
JPAQuery를 만드는 querydsl-jpa는 이 capability를 켜는 서비스가 직접 더하는 것으로
그대로 둔다(README의 안내와 같다). build.gradle 주석에 이유를 적었다.
- 버린 대안: OpenFeign 포크 `io.github.openfeign.querydsl:querydsl-jpa`(5.6.1, 6.10.1+)로
  옮기기. 좌표가 바뀌어 파생 서비스가 같이 바꿔야 하고, 이 leaf에는 필요 없는 jar다.
- 버린 대안: `.trivyignore.yaml`에 90일 무시. 쓰지 않는 jar의 위험을 기한부로 안는다.
이 선택은 총괄에게 물었고 답을 받기 전에 권하는 안으로 진행했다.

위험·한계: querydsl-jpa를 직접 더하는 서비스는 여전히 고친 버전이 없는 좌표를 쓴다.
업그레이드 안내 B-54에 OpenFeign 포크를 검토하라고 적는다. 동작 변화는 없다
(compileOnly 클래스패스에서 쓰지 않는 jar 하나가 빠진다).

검증(desktop, 이 트리 6831ad47):
- 세 빌드를 `--write-locks`로 다시 썼다. persistence-jpa lockfile에서 querydsl-jpa가
  7개 구성에서 빠졌고 querydsl-core 5.1.0은 그대로다.
- `:adapter:outbound:persistence-jpa:check :adapter:outbound:persistence-jpa:testQualityCheck
  verifyDependencyLocks` rc=0, test 666 실패 0(`PredicatePolicyTest`,
  `JpaModuleBoundaryTest` 포함).
- `:adapter:outbound:persistence-jpa:compileJava --rerun` rc=0: 운영 코드가
  querydsl-core만으로 컴파일된다.
- 앞 커밋 트리(c5ed4659)를 깨끗한 worktree로 꺼내 돌린 trivy에서 남은
  HIGH·CRITICAL은 이 한 건이었다.
This commit is contained in:
DongHyeonka
2026-11-07 17:58:32 +09:00
parent 9fcab227d8
commit 8e3bef0f3e
2 changed files with 8 additions and 3 deletions
@@ -93,10 +93,16 @@ dependencies {
// contracts, but the Stable runtime classpath must not carry either. compileOnly keeps them off
// every deployment while still compiling the support classes; a deployment that opts in adds the
// artifact itself, and the guards refuse the capability when the classes are absent.
compileOnly 'com.querydsl:querydsl-jpa:5.1.0:jakarta'
//
// Querydsl: the platform's support (`querydsl.PredicatePolicy`) uses only querydsl-core's
// `Predicate`, so querydsl-core is what this leaf compiles against (version from the Boot BOM).
// querydsl-jpa, which builds the JPAQuery a service runs, stays the opting-in deployment's own
// dependency: `com.querydsl:querydsl-jpa` carries CVE-2024-49203 (HQL injection through orderBy)
// and has no fixed release under that coordinate.
compileOnly 'com.querydsl:querydsl-core'
compileOnly 'org.hibernate.orm:hibernate-envers'
testImplementation 'com.querydsl:querydsl-jpa:5.1.0:jakarta'
testImplementation 'com.querydsl:querydsl-core'
testImplementation 'org.hibernate.orm:hibernate-envers'
testImplementation libs.archunit.junit5
// FlywaySchemaPolicyTest reads the PostgreSQL lock setting FlywaySchemaPolicy hands Flyway. Test
@@ -40,7 +40,6 @@ com.jayway.jsonpath:json-path:2.10.0=jpaPlatformPerformanceTestCompileClasspath,
com.mysema.commons:mysema-commons-lang:0.2.4=compileClasspath,jpaPlatformPerformanceTestCompileClasspath,jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestCompileClasspath,postgresqlIntegrationTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:13.5.0=checkstyle
com.querydsl:querydsl-core:5.1.0=compileClasspath,jpaPlatformPerformanceTestCompileClasspath,jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestCompileClasspath,postgresqlIntegrationTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.querydsl:querydsl-jpa:5.1.0=compileClasspath,jpaPlatformPerformanceTestCompileClasspath,jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestCompileClasspath,postgresqlIntegrationTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
com.sun.istack:istack-commons-runtime:4.1.2=jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestRuntimeClasspath,runtimeClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.tngtech.archunit:archunit-junit5-api:1.3.0=jpaPlatformPerformanceTestCompileClasspath,jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestCompileClasspath,postgresqlIntegrationTestRuntimeClasspath,testCompileClasspath,testFixturesCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.tngtech.archunit:archunit-junit5-engine-api:1.3.0=jpaPlatformPerformanceTestRuntimeClasspath,postgresqlIntegrationTestRuntimeClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath