Skip to content

chore: harden embedded-POM trust boundary in install:install-file (3.x backport) - #447

Open
gnodet wants to merge 2 commits into
maven-install-plugin-3.xfrom
quick-fix/harden-embedded-pom-trust-3x
Open

chore: harden embedded-POM trust boundary in install:install-file (3.x backport)#447
gnodet wants to merge 2 commits into
maven-install-plugin-3.xfrom
quick-fix/harden-embedded-pom-trust-3x

Conversation

@gnodet

@gnodet gnodet commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of the embedded-POM trust boundary hardening from master to the 3.x maintenance line. Addresses four findings from a static security audit.

Findings addressed

ID Severity Title
f001 MEDIUM Embedded JAR POM silently chooses install coordinates, poisoning shared local repo
f002 MEDIUM Foreign embedded POM installed verbatim even with explicit CLI coordinates
f003 LOW Defense-in-depth DOCTYPE rejection for attacker-authored embedded POM
f004 LOW Coordinate validators accept dot-only and empty segments, escaping coordinate directory

Changes

Same logical fixes as the master PR, adapted to Maven 3 APIs (MavenXpp3Reader, MojoExecutionException, Aether, etc.):

  • Coordinate adoption visibility (f001): Fail when multiple META-INF/maven/*/pom.xml entries match; validate entry-path vs model GAV; log at INFO; warn before overwriting; validate packaging.
  • CLI-coordinate priority (f002): When full g/a/v/packaging supplied, skip embedded POM and generate minimal POM. When partial coordinates supplied, cross-check against embedded POM.
  • DOCTYPE screening (f003): Encoding-aware pre-scan for <!DOCTYPE before parsing embedded POM XML.
  • Coordinate validation (f004): Reject empty/dot-only IDs, leading-dot groupIds. Containment-check install path against local repository root.

Note on InstallMojo

The 3.x InstallMojo does NOT need these changes — its architecture uses a single atomic InstallRequest (no per-project loop), and it already matches by plugin presence, not execution-id.

Category

Security hardening — backport from master.

Test plan

  • New unit tests for all 4 findings pass
  • Existing tests pass unchanged
  • mvn clean install -B succeeds

🤖 Generated with Claude Code

gnodet and others added 2 commits August 31, 2026 14:55
…x backport)

Backport of security hardening from master to the 3.x maintenance line.
Static analysis findings (no live exploit demonstrated):

- f001 (MEDIUM): Make coordinate adoption from embedded POM visible and
  cross-checked — fail on multiple POM entries, validate entry-path vs
  model GAV, log at INFO, warn before overwriting, validate packaging
- f002 (MEDIUM): Skip embedded POM when full CLI coordinates supplied;
  cross-check operator-supplied coordinates against embedded POM
- f003 (LOW): Defense-in-depth DOCTYPE rejection for embedded POM XML
  with encoding-aware screening (UTF-8/16/32, EBCDIC)
- f004 (LOW): Reject empty/dot-only coordinates and leading-dot groupIds;
  containment-check install path against local repository root

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The embedded-POM trust hardening changed log.debug() to log.info()
for provenance visibility. Update the integration test assertions
to match the new log level and message format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
gnodet marked this pull request as ready for review September 1, 2026 10:57
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