GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — model validator accepts '.' and '..' as artifactId/version, creating path-traversal segments in local repository paths · Issue #12427 · apache/maven

model validator accepts '.' and '..' as artifactId/version, creating path-traversal segments in local repository paths #12427

New issue
Copy link
New issue
Copy link
Closed
#12410
Closed
model validator accepts '.' and '..' as artifactId/version, creating path-traversal segments in local repository paths#12427
#12410
Copy link

Description

@jmestwa-coder
jmestwa-coder
opened on Jul 7, 2026
Issue body actions

Affected version

4.1.0-SNAPSHOT (master); the compat maven-model-builder validator has the same gap.

Bug description

coordinate ids and versions equal to . or .. pass model validation:

  • isValidCoordinatesId (maven-impl DefaultModelValidator) / isValidId (compat) check each character individually and . is an allowed character, so the strings . and .. are accepted as groupId/artifactId
  • validateVersion only bans the filesystem metacharacters \/:"<>|?*, so a version of .. passes too
  • same gap in the wildcard-id variant

these values are used verbatim as directory segments when an artifact is mapped to its local repository path (groupId-as-dirs/artifactId/version/artifactId-version.ext in the default layout, see DefaultRepositoryLayout.pathOf), so an artifactId or version of .. is a literal path-traversal segment.

example: this dependency passes STRICT validation

<dependency>
  <groupId>org.example</groupId>
  <artifactId>..</artifactId>
  <version>1.0</version>
</dependency>

and maps to the local-repository path

org/example/../1.0/..-1.0.jar  ->  org/1.0/..-1.0.jar

so the .. segment escapes the coordinate directory. a dependency version of .. does the same one level down (org/example/lib/../lib-...jar -> org/example/lib-...jar). any POM in the dependency graph can carry such coordinates.

groupId on its own is not a raw-segment vector since the layout maps its dots to path separators (org..evil becomes org//evil, an empty segment rather than ..), but ./.. as a whole groupId is rejected as well for consistency.

fix in #12410: reject . and .. in the id checks, the wildcard variant, and validateVersion, in both the maven-impl and compat maven-model-builder validators, with regression tests in each module.

Activity

  1. jmestwa-coder
    added 2 commits that reference this issue on Jul 7, 2026

    [apache#12427] reject path-traversal segments in coordinate ids and v…

    c56ab89

    [apache#12427] add test coverage for single-dot and groupId path-trav…

    c8ac7a0
  2. elharo commented on Jul 7, 2026

    @elharo
    elharo
    on Jul 7, 2026
    Contributor
    More actions

    Anyone remember where the normative rules for maven artifact and group IDs are written down?

  3. elharo commented on Jul 7, 2026

    @elharo
    elharo
    on Jul 7, 2026
    Contributor
    More actions

    As best I can tell on a quick search the problem is that "these values are used verbatim as directory segments when an artifact is mapped to its local repository path." I cannot find any reference that states . and .. are illegal group or artifact IDs.

  4. jmestwa-coder
    added a commit that references this issue on Jul 8, 2026

    [apache#12427] reword javadoc: rejection is due to the path mapping, …

    1c0b584
  5. gnodet
    closed this as completedin #12410on Jul 28, 2026
  6. gnodet
    added a commit that references this issue on Jul 28, 2026

    [Backport 4.0.x] Fix #12427: Reject path-traversal segments in coordi…

    This issue will close once commit ff7e765 is merged into the 'master' branch.
    ff7e765
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.