a2ui-project / a2ui-project/a2ui

[BUG]: Default text renderer in the a2a-chat-canvas sample bypasses Angular HTML sanitization

オープン
#2,294 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
P2 status: first-line-handled
主要言語
TypeScript
スター
16.4k
フォーク
1.3k
平均マージ
2日 13時間
マージ済み PR(30日)
134

説明

# Default text renderer in the a2a-chat-canvas sample bypasses Angular HTML sanitization

Repository: https://github.com/a2ui-project/a2ui (sample project `samples/community/client/angular/projects/a2a-chat-canvas`, v0.0.1)
CWE: CWE-79 (Improper Neutralization of Input During Web Page Generation — XSS)

## Summary

The default implementation of the chat canvas's text-part renderer returns `sanitizer.bypassSecurityTrustHtml()`, and the component binds the result via `@HostBinding('innerHTML')`. Remote agent text parts are therefore rendered as raw HTML inside the host application's origin. The class does not actually render markdown; it passes the original HTML through.

## Affected code

- `samples/community/client/angular/projects/a2a-chat-canvas/src/lib/services/sanitizer-markdown-renderer-service.ts:29`
- Rendered at `default-text-part.ts:60-71` (`@HostBinding('innerHTML')`)
- Wired as the default by `markdown-renderer-service.ts:31-36` and `config.ts:103`

## Observed behavior

An agent message containing `` executes in the host page (standard stored-XSS consequence of the SafeHtml bypass).

## Context

This is community sample code (v0.0.1), not an official npm release; it is filed because the unsafe renderer is the default configuration of the sample, so applications copying the sample inherit the behavior as-is.

## Suggested remediation

Make a sanitizing pipeline the default renderer — e.g. the `@a2ui/markdown-it` path used elsewhere (markdown-it with `html: false` + DOMPurify).

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。