-
Notifications
You must be signed in to change notification settings - Fork 60
Add WebSearch tool renderer with structured parsing #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
89db5ec
Add WebSearch tool models and factory parser
cboos 5e2e452
Add WebSearch HTML and Markdown formatters
cboos bb00e22
Add documentation for implementing tool renderers
cboos 3100339
Add analysis content support to WebSearch output
cboos 0775b30
Use structured toolUseResult for WebSearch parsing
cboos 8b31bf0
Simplify WebSearch parser and improve rendering
cboos c6bf083
Fix double tab opening when clicking links in TUI MarkdownViewer
cboos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 107
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 111
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 132
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 50381
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 50381
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 8217
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 1648
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 886
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 393
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 755
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 1174
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 48
🏁 Script executed:
Repository: daaain/claude-code-log
Length of output: 809
Sanitize WebSearch external content before markdown rendering to prevent XSS injection.
WebSearch summaries, link titles, and URLs originate from external APIs and are currently embedded directly into markdown (in
_websearch_as_markdown, line 233-256) without escaping. The markdown renderer usesmistunewithescape=False(line 256 in utils.py), which means HTML tags in the markdown input will be rendered as HTML output. This creates an XSS vector: a malicious API response containing<script>or<img onerror=...>tags in a summary or title would execute in the browser.Fix: Escape WebSearch external fields (
output.summary,link.title) usingescape_html()before building the markdown string in_websearch_as_markdown(). Alternatively, enableescape=Truein mistune or sanitize the rendered HTML output withbleachafter markdown rendering.🤖 Prompt for AI Agents