Skip to content

Pin and tighten dependency resolution; verify the client JAR download - #122

Open
Aerhhh wants to merge 1 commit into
masterfrom
security/dependency-hardening
Open

Aerhhh wants to merge 1 commit into
masterfrom
security/dependency-hardening

Conversation

@Aerhhh

@Aerhhh Aerhhh commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Why

Follow-up to the security review (see #116), covering dependencies and the build tooling's downloads.

What changed

Marmalade is pinned. Both modules depended on master-SNAPSHOT, which is whatever the branch holds on the day of the build. They now name commit eef81aa0ff, the commit master-SNAPSHOT resolved to during the review, so this changes no code today. renovate.json gains a second manager so Renovate proposes Marmalade bumps the same way it does for asset-renderer.

Maven Central is asked first. Maven queries repositories in declaration order and appends its built-in Central entry last, so JitPack was being asked first for every artifact, including org.slf4j, Gson and the plugins' dependencies. Central is now declared explicitly ahead of JitPack. JitPack is still used for the com.github.* libraries that Central does not have.

Transitive versions raised past published advisories (managed in the parent pom; none is a direct dependency):

Artifact Was Now Reaches us through
jackson-core / jackson-databind 2.18.2 2.18.11 tooling, via asset-renderer
httpclient5 5.6 5.6.3 tooling, via asset-renderer
httpcore5 / httpcore5-h2 5.4 5.4.3 tooling, via asset-renderer
log4j-api 2.25.3 2.25.5 both modules, via minecraft-library

AssetDownloader

  • The client JAR, freshly downloaded or cached, is checked against the SHA-1 in Mojang's version metadata before anything reads from it. A JAR that fails is deleted.
  • The version must be a plain version string, since it becomes part of the cached file name.
  • A JAR entry whose name would extract outside the output directory is refused.

Limits of this PR

  • The managed versions fix this build. A project that consumes the generator artifact resolves log4j-api through its own dependency tree and still gets 2.25.3 unless the upstream library updates. The advisory there is moderate and concerns MapMessage JSON output, which this library does not use.
  • Marmalade still brings the MongoDB driver, Reflections, Javassist and a native WebP library into every consumer for a handful of utility classes. Trimming that means changing Marmalade or replacing its uses here, which is a larger change than this PR.
  • JitPack artifacts are not covered by any advisory database and carry no signatures; pinning by commit is the available control.

Testing

  • New AssetDownloaderTest (2 tests) for the checksum check.
  • Both modules build against the new versions and the pinned Marmalade; dependency:tree shows the raised versions; a sample of generator and tooling tests passes. The full suite was not run locally.
  • The asset pipeline itself (download, render) was not run; dispatching the spritesheet workflow from this branch would exercise the checksum path end to end.

- Pin Marmalade to commit eef81aa0ff instead of master-SNAPSHOT, and let
  Renovate propose bumps alongside the asset-renderer pin.
- List Maven Central ahead of JitPack so artifacts published on Central
  are never requested from JitPack first.
- Raise transitive versions past published advisories: Jackson 2.18.11,
  httpclient5 5.6.3, httpcore5 and httpcore5-h2 5.4.3, log4j-api 2.25.5.
- AssetDownloader: check the client JAR against Mojang's published SHA-1,
  reject versions that are not plain version strings, and refuse JAR
  entries that would extract outside the output directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant