TDD: BUG-HUNT: [security] Resource exhaustion DoS in LSP language discovery directory traversal #7160

Open
opened 2026-04-10 08:20:16 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Branch: tdd/m3.6.0-lsp-discovery-resource-exhaustion-dos
  • Commit Message: test(lsp): add @tdd_expected_fail scenario for resource exhaustion DoS in detect_directory_languages()
  • Milestone: v3.6.0
  • Parent Epic: #824

Background and Context

This TDD issue captures the failing test that proves the resource exhaustion DoS vulnerability exists in detect_directory_languages() in src/cleveragents/lsp/discovery.py (lines 221–233). The method uses unbounded os.walk() with no depth limit, file count limit, or timeout, allowing an attacker to cause indefinite CPU/memory exhaustion via crafted directory structures.

The test must be tagged @tdd_issue, @tdd_issue_<N> (where N is the companion bug issue number), and @tdd_expected_fail. It must pass CI while the bug is unfixed (i.e., the assertion fails, proving the bug exists), and fail CI once the fix is applied without removing the tag.

Subtasks

  • Write a Behave scenario in features/ that exercises detect_directory_languages() with a deeply nested directory structure and asserts it completes within a bounded time/depth
  • Tag the scenario with @tdd_issue, @tdd_issue_<N>, and @tdd_expected_fail
  • Write a Behave scenario that exercises detect_directory_languages() with a directory containing an excessive number of files and asserts a file count limit is enforced
  • Write a Behave scenario that verifies symlink loops do not cause infinite traversal (i.e., followlinks=False or equivalent protection)
  • Confirm all three scenarios fail their underlying assertions (proving the bug exists) and pass CI via @tdd_expected_fail inversion
  • Open a PR to master from the tdd/ branch

Definition of Done

  • All three @tdd_expected_fail scenarios are committed and pass CI (assertion fails = bug confirmed)
  • Scenarios are tagged @tdd_issue, @tdd_issue_<N>, and @tdd_expected_fail
  • PR merged to master
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: Bug Hunting | Agent: new-issue-creator

## Metadata - **Branch**: `tdd/m3.6.0-lsp-discovery-resource-exhaustion-dos` - **Commit Message**: `test(lsp): add @tdd_expected_fail scenario for resource exhaustion DoS in detect_directory_languages()` - **Milestone**: v3.6.0 - **Parent Epic**: #824 ## Background and Context This TDD issue captures the failing test that proves the resource exhaustion DoS vulnerability exists in `detect_directory_languages()` in `src/cleveragents/lsp/discovery.py` (lines 221–233). The method uses unbounded `os.walk()` with no depth limit, file count limit, or timeout, allowing an attacker to cause indefinite CPU/memory exhaustion via crafted directory structures. The test must be tagged `@tdd_issue`, `@tdd_issue_<N>` (where N is the companion bug issue number), and `@tdd_expected_fail`. It must pass CI while the bug is unfixed (i.e., the assertion fails, proving the bug exists), and fail CI once the fix is applied without removing the tag. ## Subtasks - [ ] Write a Behave scenario in `features/` that exercises `detect_directory_languages()` with a deeply nested directory structure and asserts it completes within a bounded time/depth - [ ] Tag the scenario with `@tdd_issue`, `@tdd_issue_<N>`, and `@tdd_expected_fail` - [ ] Write a Behave scenario that exercises `detect_directory_languages()` with a directory containing an excessive number of files and asserts a file count limit is enforced - [ ] Write a Behave scenario that verifies symlink loops do not cause infinite traversal (i.e., `followlinks=False` or equivalent protection) - [ ] Confirm all three scenarios fail their underlying assertions (proving the bug exists) and pass CI via `@tdd_expected_fail` inversion - [ ] Open a PR to `master` from the `tdd/` branch ## Definition of Done - [ ] All three `@tdd_expected_fail` scenarios are committed and pass CI (assertion fails = bug confirmed) - [ ] Scenarios are tagged `@tdd_issue`, `@tdd_issue_<N>`, and `@tdd_expected_fail` - [ ] PR merged to `master` - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: Bug Hunting | Agent: new-issue-creator
HAL9000 added this to the v3.6.0 milestone 2026-04-10 08:20:41 +00:00
Author
Owner

Verified — TDD test for critical security bug: LSP language discovery DoS. MoSCoW: Must-have. Priority: Critical.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — TDD test for critical security bug: LSP language discovery DoS. MoSCoW: Must-have. Priority: Critical. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#7160
No description provided.