fix(maven): send the official Maven CLI user agent to the maven2 registry; refresh npm wrapper lock for published 4.0.0 platform packages - #233
Merged
Mikola Lysenko (mikolalysenko) merged 2 commits intoAug 27, 2026
Conversation
…stry Maven Central blocks/rate-limits user agents containing "socket", so the fallback pom download in the maven vendor backend (acquire_upstream_pom → fetch_pom_bytes) was refused when sent as SocketPatchCLI/x.y.z — the only CLI code path that talks to Maven Central. maven2 registry requests now identify exactly as the official Maven CLI (Apache-Maven/<v> (Java <v>; <os> <ver>), pinned per-OS so the string stays deterministic). Socket API requests keep the honest CLI UA. Tests: shape + no-"socket" guard on the constant, and a wiremock test that only serves the pom when the Maven CLI UA actually goes out on the wire. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
force-pushed
the
fix/maven-central-user-agent
branch
from
August 27, 2026 17:25
b72c0dd to
90aac5b
Compare
Wenxin Jiang (Wenxin-Jiang)
approved these changes
Aug 27, 2026
….0 platform packages The lock was committed while the 4.0.0 @socketsecurity/socket-patch-* platform packages were still unpublished (npm publish was pending 2FA at release time), so npm silently omitted their node_modules entries. Now that they are live on the registry, version-sync's `npm install --package-lock-only` re-adds them, making the sync a non-no-op and failing release-readiness on every PR. Committing the refreshed lock restores the no-op invariant. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
Author
|
CI note: |
Mikola Lysenko (mikolalysenko)
enabled auto-merge (squash)
August 27, 2026 17:56
Mikola Lysenko (mikolalysenko)
deleted the
fix/maven-central-user-agent
branch
August 27, 2026 17:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Maven Central is blocking / severely rate-limiting user agents containing
socket. The CLI's only Maven Central-facing request — the maven2 fallback pom download in the maven vendor backend (acquire_upstream_pom→fetch_pom_bytesincrates/socket-patch-core/src/vendor/maven_repo.rs, default basehttps://repo1.maven.org/maven2) — sends the sharedSocketPatchCLI/x.y.zUA and gets refused, so materializing a maven artifact whose upstream pom isn't in~/.m2fails.Fix
maven2 registry requests now identify exactly as the official Maven CLI, matching the shape maven-resolver sends:
Apache-Maven/<maven> (Java <jdk>; <os.name> <os.version>), pinned per-OS (Mac OS X/Windows/Linuxvariants) to fixed Maven/JDK/OS versions so the string stays deterministic with no runtime probing.Scope: only the maven2 registry client changes UA — including private mirrors via
SOCKET_MAVEN_REGISTRY, which serve realApache-Maven/*traffic anyway. Socket API, telemetry, and self-update requests keep the honestSocketPatchCLI/x.y.zUA.Tests
maven_user_agent_is_the_maven_cli_shape: the constant leads with theApache-Maven/product token and never containssocket(the exact substring Central filters on).pom_fetch_sends_the_maven_cli_user_agent: wiremock only serves the pom when the request carriesMAVEN_USER_AGENTon the wire, so a regression back to the CLI UA fails the fetch.cargo test -p socket-patch-core --lib vendor::maven_repo→ 33/33 green;cargo clippy -p socket-patch-core --all-targetsclean.🤖 Generated with Claude Code
Note
Low Risk
Narrow change to one HTTP client in the Maven vendor path; no auth, API, or lockfile behavior changes.
Overview
Maven Central was refusing or rate-limiting the fallback POM download used when vendoring Maven artifacts without a local
~/.m2copy, because those HTTP requests used the sharedSocketPatchCLI/x.y.zuser agent (Central blocks strings containingsocket).fetch_pom_bytesinmaven_repo.rsnow sends a pinned, per-OSApache-Maven/…user agent that matches the official Maven CLI shape instead of the Socket CLI UA.SOCKET_MAVEN_REGISTRYtraffic is included; Socket API and other outbound calls are unchanged and still use the honest CLI UA.Regression tests assert the UA is Maven-shaped, never contains
socket, and is actually sent on the wire (wiremock). [Unreleased] changelog entry documents the fix.Reviewed by Cursor Bugbot for commit b72c0dd. Configure here.