[PR #704] [MERGED] fix: don't allow Rich markup from user content #836

Closed
opened 2026-02-16 09:17:19 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/704
Author: @vtrivedy
Created: 1/10/2026
Status: Merged
Merged: 1/13/2026
Merged by: @vtrivedy

Base: masterHead: vivek/fix-rich-markup-injection


📝 Commits (2)

  • 6b43de4 fix: prevent Rich markup injection from user content
  • 475a67c Merge branch 'master' into vivek/fix-rich-markup-injection

📊 Changes

4 files changed (+125 additions, -16 deletions)

View changed files

📝 libs/deepagents-cli/deepagents_cli/clipboard.py (+2 -0)
📝 libs/deepagents-cli/deepagents_cli/main.py (+21 -10)
📝 libs/deepagents-cli/deepagents_cli/widgets/messages.py (+16 -6)
libs/deepagents-cli/tests/unit_tests/test_messages.py (+86 -0)

📄 Description

Summary

  • Fix crash when users paste content containing brackets like }, [/* deps */]); which Rich interprets as markup tags
  • Use Text objects to separate trusted markup from untrusted user content in message widgets
  • Add markup=False to tool output widgets and clipboard notifications
  • Suppress Pydantic v1 compatibility warning on startup

Changes

  • widgets/messages.py: UserMessage, ErrorMessage, SystemMessage now use Text objects; tool output widgets use markup=False
  • main.py: Use Text objects for console.print calls with user/error content
  • clipboard.py: Add markup=False to toast notification
  • tests/unit_tests/test_messages.py: 32 parametrized tests for markup injection scenarios

Test plan

  • Unit tests pass: pytest tests/unit_tests/test_messages.py (32 tests)
  • Manual: paste [foo] bar [baz] - displays without crash
  • Manual: copy text with brackets - toast shows without crash
  • Ruff linting passes on changed files

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagents/pull/704 **Author:** [@vtrivedy](https://github.com/vtrivedy) **Created:** 1/10/2026 **Status:** ✅ Merged **Merged:** 1/13/2026 **Merged by:** [@vtrivedy](https://github.com/vtrivedy) **Base:** `master` ← **Head:** `vivek/fix-rich-markup-injection` --- ### 📝 Commits (2) - [`6b43de4`](https://github.com/langchain-ai/deepagents/commit/6b43de4e212814e4a6d3f90b8c5c3aa7fdb13495) fix: prevent Rich markup injection from user content - [`475a67c`](https://github.com/langchain-ai/deepagents/commit/475a67c5a3b42c1e51ebbe9af85659a7bb7e2b90) Merge branch 'master' into vivek/fix-rich-markup-injection ### 📊 Changes **4 files changed** (+125 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `libs/deepagents-cli/deepagents_cli/clipboard.py` (+2 -0) 📝 `libs/deepagents-cli/deepagents_cli/main.py` (+21 -10) 📝 `libs/deepagents-cli/deepagents_cli/widgets/messages.py` (+16 -6) ➕ `libs/deepagents-cli/tests/unit_tests/test_messages.py` (+86 -0) </details> ### 📄 Description ## Summary - Fix crash when users paste content containing brackets like `}, [/* deps */]);` which Rich interprets as markup tags - Use `Text` objects to separate trusted markup from untrusted user content in message widgets - Add `markup=False` to tool output widgets and clipboard notifications - Suppress Pydantic v1 compatibility warning on startup ## Changes - `widgets/messages.py`: UserMessage, ErrorMessage, SystemMessage now use `Text` objects; tool output widgets use `markup=False` - `main.py`: Use `Text` objects for console.print calls with user/error content - `clipboard.py`: Add `markup=False` to toast notification - `tests/unit_tests/test_messages.py`: 32 parametrized tests for markup injection scenarios ## Test plan - [x] Unit tests pass: `pytest tests/unit_tests/test_messages.py` (32 tests) - [x] Manual: paste `[foo] bar [baz]` - displays without crash - [x] Manual: copy text with brackets - toast shows without crash - [x] Ruff linting passes on changed files --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:17:19 -05:00
yindo closed this issue 2026-02-16 09:17:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#836