Skip to content

fix(telegram): add timeout to file download to prevent DoS (CWE-400) - #6914

Merged
obviyus merged 2 commits into
openclaw:mainfrom
hclsys:fix/telegram-download-timeout
Feb 2, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
hclsys:fix/telegram-download-timeout

Conversation

@hclsys

@hclsys hclsys commented Feb 2, 2026 •

Copy link
Copy Markdown

Summary

Add AbortSignal.timeout() to both fetch calls in src/telegram/download.ts to prevent indefinite hangs when Telegram API is slow or unresponsive.

  • getTelegramFile(): 30s timeout for metadata API call
  • downloadTelegramFile(): 60s timeout for file download

Both functions now accept an optional timeoutMs parameter for configurability while maintaining backward compatibility.

Security

  • CWE: CWE-400 - Uncontrolled Resource Consumption
  • CVSS: 7.5 (High) - Network-based DoS vector
  • Impact: Without timeouts, a slow/malicious Telegram API can hang the gateway indefinitely, exhausting connections and blocking threads

Changes

File Change
src/telegram/download.ts Add optional timeoutMs parameter with AbortSignal.timeout() to both fetch calls

Test Plan

  • pnpm vitest run src/telegram/download.test.ts - 2 tests pass
  • pnpm lint src/telegram/download.ts - No warnings/errors
  • Manual: Verify timeout behavior with slow/hanging server (simulated)

Related

Fixes #6849


🤖 Generated with Claude Code

Greptile Overview

Greptile Summary

This PR adds request timeouts to Telegram file retrieval to prevent indefinite hangs: getTelegramFile() now passes AbortSignal.timeout(30_000) to the Telegram getFile metadata fetch, and downloadTelegramFile() passes AbortSignal.timeout(60_000) to the actual file download fetch. Both functions accept an optional timeoutMs parameter with defaults, preserving existing call sites.

The change is localized to src/telegram/download.ts and leverages the global fetch implementation already used elsewhere in the repository, improving resilience against slow/unresponsive upstream Telegram endpoints (CWE-400 mitigation).

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • Change is small and isolated to adding AbortSignal.timeout() to existing fetch calls, with defaulted optional parameters preserving current behavior; no new control flow or data handling is introduced beyond bounded request duration.
  • No files require special attention

@openclaw-barnacle openclaw-barnacle Bot added the channel: telegram Channel integration: telegram label Feb 2, 2026
chenglun.hu and others added 2 commits February 2, 2026 13:32
Add AbortSignal.timeout() to both fetch calls in download.ts to prevent
indefinite hangs when Telegram API is slow or unresponsive.

- getTelegramFile(): 30s timeout for metadata API call
- downloadTelegramFile(): 60s timeout for file download

Both functions now accept optional timeoutMs parameter for configurability.

Fixes openclaw#6849

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@obviyus
obviyus force-pushed the fix/telegram-download-timeout branch from 7f7b8cb to 0770d31 Compare February 2, 2026 08:09
@obviyus
obviyus merged commit 01449a2 into openclaw:main Feb 2, 2026
38 of 42 checks passed
@obviyus

obviyus commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: 01449a2
  • Merge commit: 01449a2

Thanks @hclsys!

dbachelder pushed a commit to dbachelder/openclaw that referenced this pull request Feb 3, 2026
cjiewong pushed a commit to cjiewong/moltbot that referenced this pull request Feb 3, 2026
HashWarlock pushed a commit to HashWarlock/openclaw that referenced this pull request Feb 4, 2026
uxcu pushed a commit to uxcu/kook-openclaw that referenced this pull request Feb 5, 2026
bestNiu pushed a commit to bestNiu/clawdbot that referenced this pull request Feb 5, 2026
FullStackKevinVanDriel pushed a commit to FullStackKevinVanDriel/openclaw that referenced this pull request Feb 10, 2026
battman21 pushed a commit to battman21/openclaw that referenced this pull request Feb 12, 2026
battman21 pushed a commit to battman21/openclaw that referenced this pull request Feb 12, 2026
@obviyus obviyus self-assigned this Mar 23, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Telegram file download lacks timeout, can hang gateway indefinitely

2 participants