Commit c8eb5cc
committed
fix: escape user-controlled URLs in ImageFrame and Video embeddings
The |src= option (and Video |width=) were read from options_raw/args_raw
and interpolated into HTML attributes unescaped, allowing stored XSS via
attribute breakout (e.g. src=http://x" onerror="alert(1)).
Route src/href through mistune's escape_url(safe_url(...)) to reject
harmful schemes and percent-encode the value, and HTML-escape width.
Adds regression tests for both embeddings.1 parent 99e4d81 commit c8eb5cc
2 files changed
Lines changed: 75 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
37 | 53 | | |
38 | 54 | | |
39 | 55 | | |
| |||
575 | 591 | | |
576 | 592 | | |
577 | 593 | | |
| 594 | + | |
578 | 595 | | |
579 | | - | |
580 | | - | |
| 596 | + | |
| 597 | + | |
581 | 598 | | |
582 | 599 | | |
583 | 600 | | |
| |||
681 | 698 | | |
682 | 699 | | |
683 | 700 | | |
684 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
685 | 704 | | |
686 | 705 | | |
687 | 706 | | |
| |||
746 | 765 | | |
747 | 766 | | |
748 | 767 | | |
749 | | - | |
| 768 | + | |
750 | 769 | | |
751 | 770 | | |
752 | 771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
187 | 239 | | |
188 | 240 | | |
189 | 241 | | |
| |||
0 commit comments