Commit c751e3e
fix(mini-app): use JSON.stringify for JS-string context in task-detail
ISSUE-002 (HIGH): `const taskId = '${escapeHtml(data.taskId)}'` escapes
HTML (& < > ") but NOT single quote — wrong escape domain for a JS
string literal. A taskId containing ' or \n breaks out of the string
and injects arbitrary JS. email-full.ts already uses the correct
JSON.stringify pattern; task-detail had drifted.
ISSUE-008 (MED): `data.status.toUpperCase()` was rendered unescaped.
TS's 'active'|'blocked'|'complete' union is a type assertion at the DB
boundary (server.ts:315), not runtime-validated — a corrupted row
could inject HTML. Wrap in escapeHtml.
Also wrap the taskId in encodeURIComponent when building the SSE URL
so it survives special characters that JSON.stringify passes through.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 988062c commit c751e3e
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
0 commit comments