diff options
| author | fishystock <215427190+fishystock@users.noreply.github.com> | 2026-08-07 18:58:17 -0400 |
|---|---|---|
| committer | fishystock <215427190+fishystock@users.noreply.github.com> | 2026-08-07 19:54:02 -0400 |
| commit | 65a993fe06abaadcbcb23f6c239db36eb6471954 (patch) | |
| tree | 1eb3c2446d828594f91d85b6de815c85b1eea2e0 /templates/themes/calendar/calendar.html | |
| parent | 8118f7aa5c705382cfa5216a284929d7e1d6f0c8 (diff) | |
security: fix stored xss on calendar api
Diffstat (limited to 'templates/themes/calendar/calendar.html')
| -rw-r--r-- | templates/themes/calendar/calendar.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/templates/themes/calendar/calendar.html b/templates/themes/calendar/calendar.html index 12113dcd..4b5c99ae 100644 --- a/templates/themes/calendar/calendar.html +++ b/templates/themes/calendar/calendar.html @@ -55,6 +55,20 @@ } else { event.allDay = false; } + + var _url = new URL(event.url, window.location.href); + var _scheme = _url.protocol.toLowerCase(); + + // Replace stored javascript/data URI attempts + if(_scheme === 'javascript:' || _scheme === 'data:') { + event.url = "#removed"; + } + + // Only accept #a-zA-Z to avoid CSS injection. + if (/^[#a-zA-Z]+$/.test(event.color) == false) { + event.color = "#removed"; + } + element.find('.fc-title').append("<br/>" + event.description); element.css('background-color',event.color); }, |
