Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Email generators escape their inputs inconsistently

未关闭
#940 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
冷清
技术栈
typescript
领域
backend

调研方向

Start with the six generator functions in application/common/src/emails/generate.ts and compare their replaceAll chains with adminInvite.html and adminPasswordInvite.html. Check how the existing generators apply escapeHtml, then run the relevant email tests. Done means the shared render helper escapes consistently and the email templates still render correctly.

由索引模型根据 Issue 内容生成。

描述

backend bug enhancement

Four of the six generators in application/common/src/emails/generate.ts escape their inputs with escapeHtml. generateAdminInviteEmail and generateAdminPasswordInviteEmail don't.

Not #739. That one is about sanitising admin-authored HTML stored in the database, fixed with DOMPurify. This is the generator layer escaping inconsistently, and fixing #739 wouldn't touch it. @ignatiusm flagged escaping in this file reviewing #810 and pointed at #739 from there, so filing separately rather than letting it get lost inside that one. Also not #761, which is about template organisation and styling.

Both unescaped generators take one link built from process.env.ADMIN_HOSTNAME plus a crypto-random token, so nothing user-controlled reaches them. Worth fixing because the next person to add a parameter to either function has no reason to expect it won't be escaped.

Fix: the six generators are near-identical replaceAll chains, so rather than editing two functions in place, extract a shared render helper that always escapes. That collapses the duplication and removes the asymmetry in one change.

Related: #739, #761, #810. Files: application/common/src/emails/generate.ts, adminInvite.html, adminPasswordInvite.html.

主要语言
TypeScript
星标
4
派生
0
平均合并
14 小时 50 分钟
30 天内合并 PR
5

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Garvan-Data-Science-Platform/ctrl 的其他 Issue

查看 Garvan-Data-Science-Platform/ctrl 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。