Skip to content

Hosted and vendored Maven cannot serve a patched classifier jar: the grant covers only the main jar #2200

Open

Description

Summary

A classifier variant of a patched Maven artifact cannot be delivered patched in hosted or vendored mode:

  • hosted refuses with redirect_maven_classifier_unsupported (crates/socket-patch-core/src/patch/redirect/mod.rs:9695): "the Socket patch covers only the main jar";
  • vendored copies the upstream classifier jar and degrades with classifier_unpatched_copy (crates/socket-patch-core/src/vendor/jvm/gradle.rs:502).

Agent mode does handle classifier jars (it swaps each jar leaf it finds).

Why this matters

Classifier jars are how Maven ships platform-specific and alternate builds of the same code (native bundles such as linux-x86_64, jdk8 vs jdk11 builds, shaded). When the fix is in code that the classifier jar also carries, the build keeps the vulnerable copy on its class path, which the tool correctly reports but cannot fix.

Suggested direction

Let the patch service's grant serve a patched jar per classifier (keyed by the classifier and ext qualifiers the manifest already uses for variants), and have hosted/vendored wire each classifier the build declares. Keep today's refusal when the service has no patched jar for a declared classifier.

Activity

  1. mikolalysenko commented on Dec 1, 2026

    @mikolalysenko
    Collaborator

    [agent] Looked at what this needs. Not started: it needs a matching change in Socket's backend first.

    • Checked on main at 1b3f422: the patch service builds and grants one patched jar per module version, the main jar. Hosted mode therefore refuses a declared classifier (redirect_maven_classifier_unsupported), and vendored mode copies upstream's classifier jar and degrades the result when that jar carries its own copy of a patched class (classifier_unpatched_copy, VEX withheld).
    • Backend: a patched build per classifier jar of a patched module, served under the same grant. The manifest already keys such variants by the classifier and ext qualifiers.
    • CLI, once those exist: wire each classifier the build declares to its patched jar, and keep today's refusal for a classifier the service has no build of.

    Related and fixable without the backend: #2380 (a classifier jar that another library's pom asks for breaks the Gradle build after vendor and scan report success).

    Like #2195, the CLI half lands in the redirect code that #2273 changes heavily, so it should come after it.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions