test_path_traversal_with_symlink() — langchain Function Reference
Architecture documentation for the test_path_traversal_with_symlink() function in test_file_search.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7abfbdeb_e6dd_9885_4703_f5b0dd0bfac8["test_path_traversal_with_symlink()"] e5a178bd_bdb1_3bca_cf3b_735c1d713414["TestPathTraversalSecurity"] 7abfbdeb_e6dd_9885_4703_f5b0dd0bfac8 -->|defined in| e5a178bd_bdb1_3bca_cf3b_735c1d713414 style 7abfbdeb_e6dd_9885_4703_f5b0dd0bfac8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py lines 252–270
def test_path_traversal_with_symlink(self, tmp_path: Path) -> None:
"""Test that symlinks outside root are blocked."""
(tmp_path / "allowed").mkdir()
(tmp_path / "secret.txt").write_text("secret", encoding="utf-8")
# Create symlink from allowed dir to parent
try:
(tmp_path / "allowed" / "link").symlink_to(tmp_path)
except OSError:
pytest.skip("Symlink creation not supported")
middleware = FilesystemFileSearchMiddleware(root_path=str(tmp_path / "allowed"))
# Try to access via symlink
assert isinstance(middleware.glob_search, StructuredTool)
assert middleware.glob_search.func is not None
result = middleware.glob_search.func(pattern="*.txt", path="/link")
assert result == "No files found"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_path_traversal_with_symlink() do?
test_path_traversal_with_symlink() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py.
Where is test_path_traversal_with_symlink() defined?
test_path_traversal_with_symlink() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py at line 252.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free