Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2024-05-27 - Path Traversal in Custom Path Normalization
**Vulnerability:** Path normalization logic in `typescript.rs` unconditionally called `components.pop()` when encountering a `ParentDir` (`..`).
**Learning:** This implementation flaw allowed dropping `RootDir` (`/`) or `Prefix` (`C:\`), and mishandled sequential `..` segments when the components list was empty, potentially allowing path resolution outside expected scopes.
**Prevention:** When manually resolving paths with `std::path::Component`, explicitly check the last component before popping. Ignore `..` if the last element is root/prefix, push `..` if the list is empty or the last element is also `..`, and only pop otherwise.
12 changes: 11 additions & 1 deletion crates/flow/src/incremental/extractors/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,17 @@ impl TypeScriptDependencyExtractor {
for component in resolved.components() {
match component {
std::path::Component::ParentDir => {
components.pop();
let last = components.last().copied();
match last {
Some(std::path::Component::RootDir)
| Some(std::path::Component::Prefix(_)) => {}
Some(std::path::Component::ParentDir) | None => {
components.push(component);
}
_ => {
components.pop();
}
}
}
std::path::Component::CurDir => {}
_ => components.push(component),
Expand Down