snappymail/dev/Common
djmaze 08f34b9954 @ZaphodB fix(security): message images loaded without consent through srcset and CSS
The sanitizer sends img src, and url() in background-image, list-style-image
and content, through the remote content handling: blocked until the user
allows it, rewritten to the proxy when it is on. Two other ways to load an
image were left alone:

- srcset (and sizes) were on the attribute allowlist and never rewritten, so
  <img srcset="https://..."> loaded when the message opened. With the proxy on,
  the CSP keeps img-src to 'self', but a relative srcset="?/ProxyExternal/<b64>"
  is same-origin and made the server fetch an attacker URL at render time: a
  read receipt with no click. With the proxy off the browser fetched directly.
- url() in any other style property (border-image-source, mask-image, filter,
  ...) kept its value, with the same two outcomes.

Drop srcset and sizes from the allowlist (attributes not on it are deleted),
and remove any other style property whose value holds url(). Relative img src
was already safe: anything not cid:, http(s) or data:image/ is parked as
data-x-src-broken.

Checked the style sweep in Chromium: border-image-source, mask-image (both
spellings), filter and cursor lose the url(), other declarations survive, and
the background/list-style shorthands are left to the existing handling.
2026-10-25 23:28:14 +01:00
..
Audio.js Draft idea for custom notification sounds 2023-12-05 16:18:36 +01:00
Cache.js Cache changes for #1003 2023-03-06 11:36:23 +01:00
Consts.js User Settings General messages per page use <input number instead of select 2021-09-03 16:40:16 +02:00
Enums.js Ask old login password on CryptKey decrypt failure, to reseal with new password 2024-03-18 12:25:24 +01:00
EnumsUser.js Slightly modified patch code of #1657 2024-07-11 01:31:58 +02:00
File.js Prevent Infinity #1540 2024-04-08 17:22:27 +02:00
Folders.js Resolve #1678 2024-08-20 16:30:25 +02:00
Fullscreen.js centralize elementById('rl-app') 2023-02-20 15:47:46 +01:00
Globals.js Improved some AppData handling 2024-03-07 01:16:58 +01:00
Html.js @ZaphodB fix(security): message images loaded without consent through srcset and CSS 2026-10-25 23:28:14 +01:00
HtmlEditor.js Removed TODO as mentioned in #1473 2024-03-04 19:48:57 +01:00
Links.js Added option to convert HTML to Markdown instead of plain, using Turndown #1604 2024-09-14 14:00:36 +02:00
Plugins.js Reduce JavaScript footprint 2022-10-10 13:52:56 +02:00
Selector.js Cleanup and simplify messageList UpOrDown handling 2023-10-08 13:57:46 +02:00
Translator.js Change handling of (token) errors due to #1706 2024-08-16 22:05:15 +02:00
Utils.js Prevent Infinity #1540 2024-04-08 17:22:27 +02:00
UtilsUser.js Resolve #1689 2024-08-06 17:50:43 +02:00