Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Email generators escape their inputs inconsistently

Đang mở
#940 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
typescript
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
4
Fork
0
Merge trung bình
14 giờ 50 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Garvan-Data-Science-Platform/ctrl

Tất cả issue của Garvan-Data-Science-Platform/ctrl

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.