Skip to content

Prevent std imports from escaping the standard-library root #644

Closed

Description

@LunaStev

Current evidence

front/parser/src/import.rs confines local imports to their canonical module directory and external imports to their canonical dependency package root. std_import_unit, however, converts the text after std:: with replace("::", "/"), joins it to the std root, checks only that the resulting path is a file, and then parses the canonicalized target.

That leaves std imports without the equivalent containment check. Traversal components or a symlink inside the installed std tree can resolve to a .wave file outside the standard-library root.

Scope

  • Reject std import paths containing traversal or otherwise invalid module segments.
  • Canonicalize the std root and selected import target before parsing.
  • Require the canonical target to remain inside the canonical std root, including through symlinks.
  • Preserve valid std::foo::bar imports and the existing compatibility-revision validation.
  • Return a normal Wave diagnostic instead of allowing an escaped file to be parsed.

Completion criteria

  • Tests cover a normal std import, a traversal attempt, and a symlink that resolves outside the std root.
  • Escaping imports fail before parsing the outside file.
  • Valid installed std imports continue to work unchanged.

Activity

  1. added
    bug
    good first issue
    on Sep 15, 2026
  2. self-assigned this
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions