Security: XSS via v-html with user-controlled announcement#1039
Conversation
The About.vue component renders the announcement using v-html without sanitization. This allows arbitrary HTML injection if the announcement is user-controlled. Affected files: About.vue Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 Walkthrough操作说明About.vue 在 script setup 中新增 computed 和 dompurify 依赖,创建 safeAnnouncement 计算属性对 announcement 进行 HTML 清理,模板中改用清理后的内容进行渲染。 变更公告安全
评估代码审查工作量🎯 2 (简单) | ⏱️ ~8 分钟 诗
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
感谢贡献。这个 PR 的方向是对的,但合并前还需要两个小修改:
Thanks for the contribution. The direction of this PR is correct, but two small changes are still needed before merge:
|
Problem
The About.vue component renders the announcement using v-html without sanitization. This allows arbitrary HTML injection if the announcement is user-controlled.
Severity:
highFile:
frontend/src/views/common/About.vueSolution
Sanitize the announcement content using DOMPurify before rendering with v-html.
Changes
frontend/src/views/common/About.vue(modified)Testing
Summary by CodeRabbit
Bug Fixes