Skip to content

Validate dependency identities and constrain package filesystem access - #29639

Open
mohammadfawaz wants to merge 15 commits into
masterfrom
codex/fix-dependency-name-traversal
Open

mohammadfawaz wants to merge 15 commits into
masterfrom
codex/fix-dependency-name-traversal

Conversation

@mohammadfawaz

@mohammadfawaz mohammadfawaz commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Package loading could read or write outside the intended package and build paths. Distinct names such as foo and foo.aleo could also replace the same build artifact.

  • Validate primary and dependency names before constructing paths. Require local Aleo bytecode to declare the requested program ID.
  • Reject dependency aliases that share an output path, including an alias for the primary program and names that differ only in ASCII case.
  • Reject symlinks and nonregular entries in manifests, lock files, source and test directories, cached Git checkouts, and build output. Apply the source checks to the compiler and LSP.
  • Validate locked Git commit hashes before constructing checkout paths. Preserve the network pins, dependency updates, and atomic lock replacement from Lock network dependencies and add explicit dependency updates #29641.

For example, a local dependency named ../outside.aleo now fails before build output is written. A dependency named app cannot replace the output for primary program app.aleo. A linked src, tests, or leo.lock now causes an error. Explicit local dependency paths remain supported, including a path that selects a package through a directory symlink. Library Helper and program helper.aleo cannot share a package graph or workspace, so the build remains portable across filesystems. Manifest and lock formats do not change. The checks do not prevent filesystem changes by another process during a build.

Findings addressed

This PR includes the changes from #29643, #29645, and #29648. Review the combined fix here.

@mohammadfawaz mohammadfawaz self-assigned this Sep 25, 2026
@mohammadfawaz mohammadfawaz added 🐛 bug Something isn't working 🧱 Core Compiler Anything related to the core compiler including parsing, analysis, transforms, codegen, etc. labels Sep 25, 2026
@mohammadfawaz mohammadfawaz changed the title Reject unsafe network dependency names Validate dependency identities and constrain package filesystem access Sep 30, 2026
@mohammadfawaz mohammadfawaz added 🖥️ CLI Anything related to the Leo CLI. 🔌 LSP Anything related to Leo LSP labels Sep 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working 🖥️ CLI Anything related to the Leo CLI. 🧱 Core Compiler Anything related to the core compiler including parsing, analysis, transforms, codegen, etc. 🔌 LSP Anything related to Leo LSP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant