diff --git a/features/lsp_discovery_dos_protection.feature b/features/lsp_discovery_dos_protection.feature index 413b07276..61387e892 100644 --- a/features/lsp_discovery_dos_protection.feature +++ b/features/lsp_discovery_dos_protection.feature @@ -1,4 +1,6 @@ Feature: LSP language discovery DoS protection + @tdd_issue + @tdd_issue_7161 Prevent resource exhaustion attacks via directory traversal limits. Issue #7161: Resource exhaustion DoS in LSP language discovery. diff --git a/src/cleveragents/lsp/discovery.py b/src/cleveragents/lsp/discovery.py index ef746666f..7533ad718 100644 --- a/src/cleveragents/lsp/discovery.py +++ b/src/cleveragents/lsp/discovery.py @@ -257,7 +257,7 @@ class LanguageDiscovery: break # Calculate current depth - depth = root[len(directory):].count(os.sep) + depth = root[len(directory) :].count(os.sep) if depth > max_depth: logger.warning( "lsp.discovery.max_depth_exceeded",