Repository navigation
Test Maven hosted, vendored and agent modes against production - #2118
Conversation
Production has published a free Maven patch since 2026-10-23 (jackson-databind 2.7.9.2, GHSA-qr7j-h6gg-jmgc), but the production suites still said Maven had none and only watched for one. Their canary has printed a NOTE about it on every hosted-e2e run since then, in a passing job. Add a Maven leg per mode (tests/maven_production): hosted in e2e_hosted_production, vendored and agent in e2e_vendored_production, beside the Go agent leg. Each leg builds a real project with real Maven from Maven Central, applies the patch with the real CLI against production, and builds again: - Maven must resolve the artifacts it resolved before, byte for byte, except the patched jar. That jar must differ from the original only in the members the patch record names, each matching its afterHash. - The project's own class, compiled by Maven, runs on the resolved classpath: the JVM must load the patched class from that jar, with the fix active (and the upstream class, fix absent, before the patch). - The drop-in check: on every JDK the run provides, every class of the original jar and of the applied jar is loaded and linked beside the same dependencies, and the two reports must be identical. Each replaced class must keep the class-file version of the class it replaces. - rollback, then scan + remove, must each restore every file byte for byte, and Maven must resolve the original again. hosted-e2e gains JDK selection (8, 11, 17, 21, 25 from the runner image, setup-java for any that are missing), a pinned Maven 3.9.16, and a step for the vendored and agent legs. No setup-java distribution offers Java 6 or 7 for Linux x64, so Java 8 is the oldest runtime CI checks. Maven leaves the unpublished-ecosystems canaries, joins the preflight, and the docs describe the new legs and when the canary's report is seen. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…p-in check Review findings on the new legs: - The upstream build returned a soft skip for any failure. Only a failure to resolve from Maven Central is a reason not to run now; a launcher that cannot start, or a fixture that no longer compiles, fails the leg. - Maven ran under the leg's own home without the version-manager roots (asdf, mise, SDKMAN) the CLI isolation carries, so a `mvn` that is a shim failed there. It gets the same roots and the global `.tool-versions`. - The undo removed the patch named on the first event for the package. It reads the `applied` event's UUID first, then `downloaded`. - The hosted leg sat inside the hosted suite's retry loop. All three legs run in one step with their own attempts; the suite's loop skips `maven_`. The step's "leg ran" check no longer anchors at line start. - The Maven installer was pasted into hosted-e2e. Both ci.yml jobs call scripts/install-maven.sh. - The fixture carried its own copies of the patch-view fetch, the fresh checkout and Maven's argument assembly, ran `mvn -v` twice and hashed the local repository in modes that never read it. Those go through common/patch_view.rs and maven_build_common (which now keeps the Java runtime path and takes an environment hook). The one live Maven patch is Java 6 bytecode and no setup-java distribution offers Java 6, so scripts/container-jdk.sh gives the legs a `java` and `javac` that run in azul/zulu-openjdk:6, pinned by digest: no network, bounded, only the legs' temp directory mounted. It is best effort. When Docker or the image is unavailable the job warns and the check covers Java 8 and later. Java 25 joins only when the runner image already has it, so neither adds a way for the job to fail. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryMedium Risk Overview CI consolidates Maven install into Shared test helpers add Reviewed by Cursor Bugbot for commit 85597c8. Configure here. |
|
[agent] PR shepherd: review brief for What it does: Adds one real-Maven production e2e leg for each mode (hosted, vendored and agent). Each leg runs the live free patch for jackson-databind 2.7.9.2 (
In CI the Maven legs move into their own step of Risk: Medium. This is test and CI only, with no product code. But Look here:
Verified:
Changes I made: None. Open questions: None blocking. Two to watch:
Generated by Claude Code |
What is now covered
Production has published one free Maven patch since 2026-10-23:
pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.7.9.2, patch8e82692a-a5bd-40ac-97a7-4f1483449fd6(GHSA-qr7j-h6gg-jmgc / CVE-2018-11307). It replaces one class,SubTypeValidator, at class-file version 50 (Java 6). The production suites still said Maven had no free patch and only watched for one.This adds one Maven leg per mode. All three share one fixture,
crates/socket-patch-cli/tests/maven_production/mod.rs:maven_hosted_jackson_databind_deliverye2e_hosted_productionmaven_vendored_jackson_databind_deliverye2e_vendored_productionmaven_agent_jackson_databind_deliverye2e_vendored_production, beside the Go agent leg (agent mode has no production suite of its own)Each leg runs the real CLI against
patches-api.socket.devon the anonymous free tier and real Maven against Maven Central, with its own home directory and Maven local repository. Nothing is mocked.mvn compileplusdependency:build-classpathon a project that depends on jackson-databind 2.7.9.2. The project's own class, compiled by Maven against the dependency, runs on the classpath Maven resolved. The JVM must loadSubTypeValidatorfrom the upstream jar with the fix absent (its deny list lacksorg.apache.ibatis.parsing.XPathParser).get <uuid> --mode <mode>, then build again:2.7.9.2-socket.8e82692aon the Socket repository, the local repository does not hold that version before the build, Maven downloads it frompatch.socket.dev, and the jar's sha256 is the one in.mvn/checksums/checksums.sha256.mvn -o. The resolved jar is byte for byte the committed.socket/vendor/maven2/…jar.mvn -C -U. Maven keeps the swapped jar, and its.sha1describes it./patch/view/<uuid>) does not name is byte for byte the original's, and each one it names goes from the record'sbeforeHashto itsafterHash. The JVM loads the patched class from the jar Maven resolved, with the fix active.rollback. Every file is restored byte for byte, Maven resolves the original artifacts again (same paths, same sha256), and the JVM loads the unpatched class. For hosted and vendored the project tree must equal the tree before the patch. For agent, the artifact's directory in the local repository must hold exactly the files it held before, and no other file Maven had cached may differ. The project keeps an empty manifest and the backup of the original jar under.socket/jvm-originals/, which is the documented design; the leg accepts exactly those two files.scan --package <purl> --mode <mode>, undo withremove <uuid>. Same restored state, same Maven check.Step 2 pins the patch by UUID, so another patch published later for the same release cannot change what is tested. If
scanthen selects a different patch in step 5, the leg prints aNOTEand still holds the undo to the same standard.The leg skips (and fails under the strict flags CI sets) only when it cannot run at all: no Maven, no JDK, or an upstream build that could not resolve from Maven Central. Every other failure, the upstream build's included, fails the test.
The drop-in check
On each JDK the run provides, every class of the original jar and of the applied jar is loaded and linked beside the same dependency jars (
DropIn.java, compiled by that JDK itself, since current compilers cannot emit class files for the oldest runtimes). The two reports must be identical: the same classes link, the same ones fail with the same error, and each replaced class initializes and keeps its public and protected members. Only the fix may differ. Each replaced class must also keep the class-file version of the class it replaces.JDKs in CI
JAVA_HOME_<N>_X64actions/setup-java(temurin) installs all four, the fallback thee2ejob's JVM legs useazul/zulu-openjdk:6in a container, pinned by digestHow I checked what CI can provide:
ubuntu-24.04image (README of image20261111.370.1) ships Java 8.0.512, 11.0.33, 17.0.21, 21.0.13 and 25.0.5 asJAVA_HOME_<N>_X64.hosted-e2eruns on a Depot runner, and I could not inspect that image, so 25 is used only when present and the other four fall back tosetup-java. Temurin publishes all of them for Linux x64 (Adoptium API).setup-javadistribution offers Java 6 or 7. Zulu is the one that used to. The pinned action (v6.0.1) resolvesdistribution: zulufrom Azul's metadata API; its exact query for Linux x64 glibc returns 218 packages, Java 8 to 27. The catalogs it reads for Liberica (8, 10 to 27), Red Hat (8, 11, 17, 21) and Corretto (8, 11, 15 to 27) start at 8 too. The remaining distributions are lines that start at 8 or later; I did not query those.Java 6.
scripts/container-jdk.shmakes a stand-in JDK home whosebin/javaandbin/javacrun inside an image. The fixture already takes any directory with those two tools as a JDK, so the legs need no special case.azul/zulu-openjdk@sha256:0165cd4f…e7f7a. That is what the tag6points to on Docker Hub (last pushed 2018-11-07; a schema 2 manifest, so current Docker engines pull it; linux/amd64; 113 MB). Inside: Zulu 6.22.0.3 (OpenJDK 6u119) on Ubuntu 18.04.LICENSE, the OpenJDK assembly and Classpath exceptions, and Azul'sDISCLAIMER, which says the open-source licences prevail. Azul's current "builds of OpenJDK Terms of Use" call Zulu builds "100% open source", provided as is, with no support owed; the Docker Hub page says they are "available for free unlimited use". I found no restriction on running it in CI. It is unmaintained: Azul's support roadmap ends Java 6 in December 2018 except for paying customers, its download API lists no Java 6 build, and Docker Hub marks the tag inactive, so it could disappear. The digest pin means it cannot change.--network none, as the runner's user, with only the legs' temp directory mounted.When the legs run
All three run in one step of the
hosted-e2ejob, "Run Maven production e2e (hosted, vendored, agent)", with the filter--ignored maven_over both suites. The hosted suite's own step skips them (--skip maven_). The job runs on:main;opened,synchronize,reopened,ready_for_review);osiswindowsormacos.No label is involved, and
CI_SCOPEdoes not scope the job.ci-okneeds it, so the legs are merge-blocking.Outages
The same on every event, a merge-queue run included.
HOSTED_E2E_DISABLED=trueand re-run the failed jobs. Every step is skipped and the job passes with aBYPASSEDbanner. There is no Maven-only bypass, as there is none for any other ecosystem.curl --retry 5each); this is the script thee2ejob's Maven legs already run on every PR and merge-queue entry. Each leg's upstream build tries Central once, then Google's Central mirror twice. If that still fails the leg cannot run, which the strict flags turn into a failure; the step retries all three legs up to three times, then the job fails. Same bypass. The npm, PyPI and RubyGems legs treat their registries the same way, without a mirror.What is new for unrelated PRs: one more upstream, Maven Central, which can fail this job the way the npm, PyPI and RubyGems registries already can. Nothing else added here can fail the job on its own: Java 6 and Java 25 are optional, and
setup-javaruns only if the runner image lacks Java 8, 11, 17 or 21, whichci.ymlalready counts on every runner image having. A Maven failure no longer reruns the other ecosystems' legs, and their failures no longer rerun Maven's.The canary
canary_unpublished_ecosystemsprobes production for free patches in ecosystems the suite has no leg for. By design it never fails: it prints aNOTEunlessSOCKET_PATCH_HOSTED_E2E_CANARY_STRICT=1, and no workflow sets that. It has been naming Maven in a passing job since the patch was published. From today'shosted-e2eon main (run 44119917071):The docs say what to do then: add the catalog fixture, the preflight registration, the install proof and the CI toolchain, and update both coverage tables. This PR does that for Maven. Maven leaves both canaries' lists and joins both preflights; the canaries still watch Cargo, NuGet and Composer, which have no free patch today. The vendored suite's canary is not run by any workflow, and its comment now says so.
Review findings
/code-review highfound ten. All ten are fixed in the second commit.is_resolution_failureis shared frommaven_build_commonFAILED, "the upstream build failed, and not on resolving from Maven Central"^MAVEN-PRODtest <name> ...andokseparately, so another test's line can land between themscripts/tests/test_container_jdk.pypins the patterndelivered_uuidtook the first event's UUIDappliedevent's UUID, thendownloaded(vendored names the patch only there)jvm_env::isolate_cliapplies to Maven too, and the global.tool-versionsis copied into the leg's home~/.tool-versions): passed. A unit test pins parity with the CLI's isolation--skip maven_hosted-e2escripts/install-maven.sh, called by bothci.ymljobstest_ci_maven_download.pyruns both steps against a fake CDN in every mode/patch/viewfetchcommon/patch_view.rs; the hosted suite's two helpers and the fixture use itgem_bundler_hosted_install_prooflocally (verified 4 patched files againstafterHash)fresh_checkoutmaven_build_common::fresh_checkoutcopiessrc/too; the local copy is gonecargo checkof its other usersFixture::mvnrepeatedMvn::run;mvn -vran twiceMvn::run_withtakes an environment hook, anddetectkeeps the runtime pathOne copy of the installer is left on purpose:
gradle-compatibility.ymlhas had its own since before this PR. Switching it would run that workflow's full matrix on this PR; it can move to the script in a follow-up.What I ran locally
macOS arm64, Maven 3.9.16, on the tree of the head commit. CI's strict flags, four JDKs:
jdk6-scriptis whatscripts/container-jdk.sh azul/zulu-openjdk@sha256:0165… …/jdk6-script …/tmp2wrote (amd64, emulated here). Java 8 and 17 are scratch wrappers of the same shape overeclipse-temurin:8-jdkand:17-jdk; Java 26 is Homebrew's JDK.The vendored and agent legs print the same lines as the hosted one; only their Java 6 and last lines are shown. On Java 6, one class of 573 fails to link in both jars alike (
ext.PathDeserializer, which needsjava.nio.file.Pathfrom Java 7).Also run on that tree:
gem_bundler_hosted_install_proof(finding 7): results in the table above.spawn_env_hygiene(21 passed) and theclihelper-copy ratchets.cargo check --all-featureson both suites and every other test target that includesmaven_build_common.rustfmt --checkon the touched Rust files;shellcheckon the two new scripts.python3 -B -m unittest discover -s scripts/tests: 418 pass. Seven are new: the container script against a fake Docker (pull, soft skips, digest pin, the exactdocker runarguments), the workflow wiring, and bothci.ymlinstaller steps.cargo clippyon the touched test targets: no finding in files or lines this PR adds. With-D warningsthese targets already fail on main incommon/andprebuilt_common/(duplicate_mod,needless_borrow); CI lints only the shipped targets.Before the review fixes I also ran a negative control for the harness: the applied jar with
SubTypeValidator's class-file version raised to 99.DropInreportslink-fail …SubTypeValidator: java.lang.UnsupportedClassVersionError,linked 572 of 573, and exits non-zero.What CI will be the first to run
This draft does not trigger CI. Nothing in the workflow has run there yet:
setup-javafallback.scripts/container-jdk.shon Linux: Docker on that runner, the pull by digest, and the image running natively as the runner's user.scripts/install-maven.shinhosted-e2eand in thee2ejob's Maven legs, on Linux, macOS and Windows.Not asserted, and decisions for the owner
NOTEabout the directory entries and do not fail on it.NOTEin a passing job was the only signal for 25 days. Options: set the strict flag on the nightly run, or turn theNOTEinto a workflow warning. I changed neither.No product bug found. The CLI's behaviour is unchanged; only tests, scripts, the workflow and docs are touched.
Generated by Claude Code