π‘οΈ Sentinel: [CRITICAL] Fix path normalization vulnerability in typescript extractor#310
π‘οΈ Sentinel: [CRITICAL] Fix path normalization vulnerability in typescript extractor#310bashandbone wants to merge 1 commit into
Conversation
Fixes a path traversal issue in manual module path resolution where `std::path::Component::ParentDir` randomly popped roots and prefix bounding tokens, and indiscriminately swallowed `..` traversals when resolving relative paths. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Reviewer's GuideFixes a critical path normalization vulnerability in the TypeScript incremental extractor by correctly handling File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
π¨ Severity: CRITICAL
π‘ Vulnerability: The
std::path::Componentloop in thetypescriptextractor's path normalization carelessly popped elements without checking stack bounds or root prefixes. When..ParentDircomponents were encountered without a previous valid element on the stack (i.e. standard relative path syntax like../../file.ts), it effectively ignored the..elements, altering the path destination or enabling directory traversal escape vulnerabilities. It also falsely popped root/prefix elements.π― Impact: This caused faulty module resolution and enabled path traversal outside of bounded analysis directories, presenting a serious security traversal risk.
π§ Fix: Explicitly prevented popping bounded constants (
RootDir/Prefix). Updated logic to push theParentDirinstead of ignoring it when the stack is empty or its preceding element is also aParentDir(to natively preserve consecutive../../).β Verification: Ran
cargo +nightly fmt,cargo clippy, the workspace tests to verify no regressions existed (cargo test --workspace -- --skip incremental_postgres_tests --skip incremental_integration_tests), and targeted tests (cargo test -p thread-flow --test extractor_typescript_tests) indicating normal functional parity was maintained securely. Also formatted and included learnings in.jules/sentinel.md.PR created automatically by Jules for task 9407032769846878330 started by @bashandbone
Summary by Sourcery
Fix insecure path normalization in the TypeScript dependency extractor and apply minor cleanups and documentation updates.
Bug Fixes:
Enhancements:
Documentation: