Skip to content

fix(langchain): symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob#35194

Open
corridor-security[bot] wants to merge 1 commit intomasterfrom
corridor/fix-c37ca0bb-1770933560998
Open

fix(langchain): symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob#35194
corridor-security[bot] wants to merge 1 commit intomasterfrom
corridor/fix-c37ca0bb-1770933560998

Conversation

@corridor-security
Copy link
Copy Markdown
Contributor

Summary

This PR was generated by Corridor to fix:

  • Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob

Changes

These changes mitigate a high-severity symlink traversal by resolving each discovered path to its real filesystem location and validating it remains under the configured root in both the glob/rglob and _python_search code paths. The fix uses Path.resolve(), a try/except around relative_to(self.root_path), and derives the virtual path from the resolved path (with stat follow_symlinks=False); the same resolve-then-validate approach is applied before any I/O, and the changes are surgical, touching only the two affected code paths and preserving public interfaces.


Generated by Corridor

@github-actions github-actions bot added external langchain `langchain` package issues & PRs and removed external labels Feb 12, 2026
@jkennedyvz John Kennedy (jkennedyvz) changed the title Fix Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob Fix: Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob Feb 12, 2026
@jkennedyvz John Kennedy (jkennedyvz) changed the title Fix: Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob fix: Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob Feb 12, 2026
@github-actions github-actions bot added the fix For PRs that implement a fix label Feb 12, 2026
@mdrxy Mason Daugherty (mdrxy) changed the title fix: Symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob fix(langchain): symlink-following directory traversal in FilesystemFileSearchMiddleware via rglob/glob Feb 13, 2026
@github-actions github-actions bot added fix For PRs that implement a fix and removed fix For PRs that implement a fix labels Feb 13, 2026
@github-actions github-actions bot added the size: XS < 50 LOC label Mar 9, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 9, 2026

This PR is missing a linked issue. All external contributions must reference an approved issue or discussion.

Please add one of the following to your PR description:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>

If no issue exists yet, open one and wait for maintainer approval before proceeding.

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

Labels

external fix For PRs that implement a fix langchain `langchain` package issues & PRs missing-issue-link size: XS < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants