Bump jackson-core to 2.18.6 in ferstl-depgraph-dependencies (CVE-2025-52999)#21868
Bump jackson-core to 2.18.6 in ferstl-depgraph-dependencies (CVE-2025-52999)#21868Copilot wants to merge 7 commits into
Conversation
…-52999) - Update 3 maven-fetches.expected files: jackson 2.14.1→2.18.6, jackson-parent 2.14→2.18.4, oss-parent 48→69, plugin version 4.0.3-CodeQL→4.0.3-CodeQL-2 - Update 2 diagnostics.expected files: plugin version reference 4.0.3-CodeQL→4.0.3-CodeQL-2 - Add update-ferstl-depgraph-dependencies.sh auto-update script
There was a problem hiding this comment.
Pull request overview
Updates the buildless Java extractor’s bundled ferstl-depgraph-dependencies integration-test expectations to reflect a rebuilt depgraph-maven-plugin bundle that pulls in a non-vulnerable Jackson version (addressing CVE-2025-52999), and adds an automation script to reproduce these updates.
Changes:
- Add a new script to rebuild/package the
ferstl/depgraph-maven-plugindependency bundle and rewrite affected*.expectedfiles. - Update
maven-fetches.expectedfixtures to reflect Jackson2.18.6(and updated transitive parent POMs) plus the bumped plugin coordinate4.0.3-CodeQL-2. - Update
diagnostics.expectedfixtures to reflect the new plugin version string in diagnostic messages.
Show a summary per file
| File | Description |
|---|---|
| java/ql/integration-tests/update-ferstl-depgraph-dependencies.sh | New automation script to rebuild the depgraph plugin bundle and update integration-test expected files. |
| java/ql/integration-tests/java/buildless-maven/maven-fetches.expected | Updates expected Maven fetches to new Jackson + plugin coordinate. |
| java/ql/integration-tests/java/buildless-maven-existing-settings-xml/maven-fetches.expected | Same expected-fetch updates for the existing-settings scenario. |
| java/ql/integration-tests/java/buildless-maven-mirrorof/maven-fetches.expected | Same expected-fetch updates for the mirror-of scenario. |
| java/ql/integration-tests/java/buildless-maven-timeout/diagnostics.expected | Updates diagnostic message to reference the new plugin version. |
| java/ql/integration-tests/java/buildless-maven-tolerate-unavailable-dependency/diagnostics.expected | Updates diagnostic message to reference the new plugin version. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 3
| OLD_JACKSON="$(grep -oP 'jackson-core/\K[^/]+(?=/)' "${EXPECTED_FILE}" | head -1)" | ||
| OLD_PLUGIN="$(grep -oP 'depgraph-maven-plugin/\K[^/]+(?=/)' "${EXPECTED_FILE}" | head -1)" | ||
| OLD_OSS_PARENT="$(grep -oP 'fasterxml/oss-parent/\K[^/]+(?=/)' "${EXPECTED_FILE}" | head -1)" | ||
| OLD_JACKSON_PARENT="$(grep -oP 'jackson-parent/\K[^/]+(?=/)' "${EXPECTED_FILE}" | head -1)" | ||
|
|
||
| # Resolve new parent versions from the artifacts Maven just resolved. | ||
| NEW_JACKSON_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/jackson/jackson-parent" \ | ||
| -name "jackson-parent-*.pom" | sort | tail -1 | grep -oP '[\d.]+(?=\.pom)')" | ||
| NEW_OSS_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/oss-parent" \ | ||
| -name "oss-parent-*.pom" | sort | tail -1 | grep -oP '[0-9]+(?=\.pom)')" |
| NEW_JACKSON_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/jackson/jackson-parent" \ | ||
| -name "jackson-parent-*.pom" | sort | tail -1 | grep -oP '[\d.]+(?=\.pom)')" | ||
| NEW_OSS_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/oss-parent" \ | ||
| -name "oss-parent-*.pom" | sort | tail -1 | grep -oP '[0-9]+(?=\.pom)')" | ||
|
|
| echo " 1. Copy ${ZIP_OUT} -> semmle-code resources/lib/ferstl-depgraph-dependencies/ferstl-depgraph-dependencies.zip" | ||
| echo " 2. In semmle-code, update autobuild/src/com/semmle/util/build/Maven.java:" | ||
| echo " bump the plugin version constant to '${PLUGIN_CODEQL_VERSION}'" | ||
| echo " 3. Commit and raise PRs in both repositories." | ||
| trap - EXIT |
|
@copilot Could you change the script to only include runtime jars? Something like this (quick AI-made change, untested): diff --git a/java/ql/integration-tests/update-ferstl-depgraph-dependencies.sh b/java/ql/integration-tests/update-ferstl-depgraph-dependencies.sh
index 9fb034f5c17..56c63f05995 100755
--- a/java/ql/integration-tests/update-ferstl-depgraph-dependencies.sh
+++ b/java/ql/integration-tests/update-ferstl-depgraph-dependencies.sh
@@ -86,12 +86,51 @@ print(f' pom.xml patched: version={new_version}, guava={new_guava}, jackson={ne
PYEOF
# ---------------------------------------------------------------------------
-# Step 3 — Build
+# Step 3 — Build the plugin, then resolve its *runtime* deps into a clean repo
# ---------------------------------------------------------------------------
-LOCAL_REPO="${WORK_DIR}/local-repo"
+#
+# Two separate local repos (mirrors the layout described in the README at
+# semmle-code:resources/lib/ferstl-depgraph-dependencies/ferstl-depgraph-dependencies.README):
+#
+# BUILD_REPO Throwaway cache for the plugin's own `mvn package install` —
+# accumulates build-lifecycle plugins (compiler, surefire, jar,
+# site, plugin-plugin, javadoc parents, ASM, byte-buddy, junit,
+# mockito, dom4j, xerces, sisu-guice, aether, ...) that the
+# extractor never invokes at runtime. Discarded.
+#
+# DIST_REPO Clean repo populated only with the freshly built plugin and
+# its runtime transitive deps, resolved via the plugin's own
+# `:graph` goal against a stub project. This is what gets zipped.
+#
+BUILD_REPO="${WORK_DIR}/build-repo"
+DIST_REPO="${WORK_DIR}/dist-repo"
+
echo "[3/5] Building plugin (mvn package + install, skipping tests) ..."
cd "${WORK_DIR}/plugin-src"
-mvn package install -DskipTests -q -Dmaven.repo.local="${LOCAL_REPO}"
+mvn package install -DskipTests -q -Dmaven.repo.local="${BUILD_REPO}"
+
+echo " Resolving runtime dependencies into clean dist repo ..."
+
+# Seed DIST_REPO with the freshly built plugin jar+pom so the `:graph` run
+# below resolves *its* transitive deps (rather than re-downloading the
+# unpatched upstream artifact from Central).
+PLUGIN_REL="com/github/ferstl/depgraph-maven-plugin/${PLUGIN_CODEQL_VERSION}"
+mkdir -p "${DIST_REPO}/${PLUGIN_REL}"
+cp "${BUILD_REPO}/${PLUGIN_REL}/depgraph-maven-plugin-${PLUGIN_CODEQL_VERSION}.jar" \
+ "${BUILD_REPO}/${PLUGIN_REL}/depgraph-maven-plugin-${PLUGIN_CODEQL_VERSION}.pom" \
+ "${DIST_REPO}/${PLUGIN_REL}/"
+
+# Stub project used purely as a vehicle for invoking `:graph`.
+cd "${WORK_DIR}"
+mvn -q -B archetype:generate -DinteractiveMode=false \
+ -DarchetypeGroupId=org.apache.maven.archetypes \
+ -DarchetypeArtifactId=maven-archetype-quickstart \
+ -DgroupId=com.mycompany.app -DartifactId=my-app \
+ -Dmaven.repo.local="${BUILD_REPO}"
+cd "${WORK_DIR}/my-app"
+mvn -q "com.github.ferstl:depgraph-maven-plugin:${PLUGIN_CODEQL_VERSION}:graph" \
+ -Dmaven.repo.local="${DIST_REPO}"
+cd "${WORK_DIR}"
# ---------------------------------------------------------------------------
# Step 4 — Package local-repo zip
@@ -100,7 +139,7 @@ echo "[4/5] Packaging local Maven repo into zip ..."
# Remove build-time-only noise (but keep _remote.repositories for Maven
# cache-validation compatibility).
-find "${LOCAL_REPO}" \( \
+find "${DIST_REPO}" \( \
-name "resolver-status.properties" \
-o -name "*.lastUpdated" \
-o -name "m2e-lastUpdated.properties" \
@@ -122,11 +161,11 @@ if [[ -n "${SHA1_CMD}" ]]; then
if [[ ! -f "${f}.sha1" ]]; then
${SHA1_CMD} "${f}" | awk '{print $1}' > "${f}.sha1"
fi
- done < <(find "${LOCAL_REPO}" \( -name "*.jar" -o -name "*.pom" \) -print0)
+ done < <(find "${DIST_REPO}" \( -name "*.jar" -o -name "*.pom" \) -print0)
fi
ZIP_OUT="${WORK_DIR}/ferstl-depgraph-dependencies.zip"
-(cd "${LOCAL_REPO}" && zip -r -q "${ZIP_OUT}" .)
+(cd "${DIST_REPO}" && zip -r -q "${ZIP_OUT}" .)
echo ""
echo " Zip created: ${ZIP_OUT}"
@@ -150,9 +189,9 @@ OLD_OSS_PARENT="$(grep -oP 'fasterxml/oss-parent/\K[^/]+(?=/)' "${EXPECTED_FILE}
OLD_JACKSON_PARENT="$(grep -oP 'jackson-parent/\K[^/]+(?=/)' "${EXPECTED_FILE}" | head -1)"
# Resolve new parent versions from the artifacts Maven just resolved.
-NEW_JACKSON_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/jackson/jackson-parent" \
+NEW_JACKSON_PARENT="$(find "${DIST_REPO}/com/fasterxml/jackson/jackson-parent" \
-name "jackson-parent-*.pom" | sort | tail -1 | grep -oP '[\d.]+(?=\.pom)')"
-NEW_OSS_PARENT="$(find "${LOCAL_REPO}/com/fasterxml/oss-parent" \
+NEW_OSS_PARENT="$(find "${DIST_REPO}/com/fasterxml/oss-parent" \
-name "oss-parent-*.pom" | sort | tail -1 | grep -oP '[0-9]+(?=\.pom)')"
echo " Jackson: ${OLD_JACKSON} -> ${JACKSON_VERSION}"
|
- Use BUILD_REPO/DIST_REPO split so zip contains only runtime deps (build-lifecycle plugins, test jars, etc. stay in throwaway BUILD_REPO) - Minimal inline stub pom.xml (no deps) instead of archetype:generate to avoid polluting DIST_REPO with stub project's own dependencies - Replace grep -oP (PCRE, unavailable on macOS BSD grep) with Python re - Use version-aware Python version_key() for max POM version selection (lexicographic sort fails for e.g. 2.18.10 vs 2.18.6; release > snapshot) - Write zip to caller's working directory; keep cleanup trap active; remove `trap - EXIT` which was leaving WORK_DIR behind
Done in the latest commit. Changes made:
I also took the opportunity to fix the three issues from the automated review:
|
|
@copilot fix the "[5/5] Updating integration-test expected files ... |
Fixed in the latest commit. The root cause was that heredocs ( The fix writes the two Python helpers as actual files in |
|
@copilot Fix: [5/5] Updating integration-test expected files ... |
Fixed in the latest commit. There were two remaining patterns that could trigger this on macOS bash 3.2:
All Python helpers are now written to files and invoked cleanly — no heredocs in potentially problematic positions remain. |
jackson-core2.14.1 bundled inferstl-depgraph-dependenciesis vulnerable to CVE-2025-52999 (StackOverflowError on deeply nested JSON, fixed in 2.15.0). This updates the companiongithub/codeqlintegration-test expected files to match the rebuilt plugin bundle.Expected file updates
The internal semmle-code companion PR rebuilds
depgraph-maven-pluginwith:2.14.1→2.18.6(fixes CVE; aligns with main CodeQL Java dependency set)4.0.3-CodeQL→4.0.3-CodeQL-2(ensures Maven cache invalidation)jackson-parent2.14→2.18.4,com/fasterxml/oss-parent48→69(transitive POM parents)Updated files:
maven-fetches.expected(×3:buildless-maven,buildless-maven-existing-settings-xml,buildless-maven-mirrorof) — new Jackson/oss-parent paths and plugin coordinatediagnostics.expected(×2:buildless-maven-timeout,buildless-maven-tolerate-unavailable-dependency) — plugin version string in diagnostic messagesAuto-update script
Adds
java/ql/integration-tests/update-ferstl-depgraph-dependencies.shto automate future dependency bumps. The script:ferstl/depgraph-maven-pluginat tagdepgraph-maven-plugin-4.0.3pom.xml(version suffix, Guava, Jackson)mvn package install -DskipTests*.expectedfiles in-placeRequires JDK 17, Maven 3.9.x (not 4.x), git, python3.