Repository navigation
feat: opt-in binary uploads saved to disk (UPLOAD_SAVE_EXTENSIONS) - #1
Merged
Merged
Conversation
PDFs (and any other binary type) sent to the bot were refused twice: the security validator's upload allowlist has no .pdf, and the agentic document handler only accepts UTF-8 text it can inline into the prompt. - UPLOAD_SAVE_EXTENSIONS (default empty, so no behaviour change) extends the validator allowlist; in agentic mode matching files are saved under UPLOAD_SAVE_DIR (default .telegram-uploads, relative to the current working directory) as <UTC timestamp>_<sanitised name>, and Claude gets the path. - The resolved path is refused outside APPROVED_DIRECTORY; UPLOAD_SAVE_DIR must be relative without '..'. Size limit and other filename checks unchanged. - Tests for settings parsing, validator, path safety and the handler; docs in .env.example, docs/configuration.md, CLAUDE.md; CHANGELOG entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
PDFs and other binary files sent to the bot were refused twice:
.pdfis not in the security validator's upload allowlist, and the agentic document handler only accepts UTF-8 text it can inline into the prompt.UPLOAD_SAVE_EXTENSIONS(comma-separated, default empty, so no behaviour change) extends the validator allowlist. In agentic mode, matching files are saved underUPLOAD_SAVE_DIR(default.telegram-uploads, relative to the current working directory) as<UTC timestamp>_<sanitised name>, and Claude gets the saved path instead of the content.APPROVED_DIRECTORY.UPLOAD_SAVE_DIRmust be relative without..; extensions must match\.[a-z0-9]{1,10}. The 10 MB limit and the other filename checks are unchanged. Classic mode is unchanged..env.example,docs/configuration.md,CLAUDE.md;CHANGELOG.mdentry.How it was tested
../, absolute names, hidden names, symlink escape), and the handler (file saved, path passed to Claude; nothing saved by default).tests/unit/test_mcp/test_telegram_server.py, which needs the optional MCP dependency not installed in the test env). flake8 clean; black 25.x / isort 6 formatting.UPLOAD_SAVE_EXTENSIONS=.pdf, restart, send a PDF (to be done by the maintainer).Note
The bot currently running on our machine is the same patch on top of
v1.8.0(commit54f08ff, branchbquant/v1.8.0-uploads). That branch could not be pushed: its.github/workflowsfiles differ from this fork'smain, and the token lacks theworkflowscope. This PR is based on the fork'smain, so it also includes the two upstream commits afterv1.8.0(overwirehq#236 stop-reason footer, overwirehq#239 CI).🤖 Generated with Claude Code