Files
jcoffey-dev e806515cb4
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 10m6s
Spam filter: check the links in QR codes in a message's images
A phishing message can carry its link only as a QR code in an image
("quishing"), where the URL checks never look: they read the subject and
text parts. Requested in community t/292.

With the new x:SpamSettings scanQrCodes setting on (off by default), the
URL analysis reads QR codes in the message's images and puts each web link
it finds through the same checks as the message's other links (DNSBLs,
redirectors, homographs, IP hosts, URL rules), at a new location qr_code,
so a rule can tell a link came from a QR code. A message with such a link
gets QR_CODE_URL, scored 0.0 in the bundled rules (3.0.2-inbuxa.2): a QR
code alone isn't a spam sign, and an administrator can give it a score.

What's read (crates/spam-filter/src/analysis/qr.rs):
- image parts, whatever their declared type, and data: images in HTML,
  sniffed from the bytes as PNG, JPEG, GIF or WebP; nothing else
- at most 4 images per message, each at most 4 MB and 16 megapixels (the
  size comes from the header, before anything is decoded) and at least
  64 px a side; decoding has image's allocation limits set
- images over 1600 px are scaled down before they're scanned
- no image is started after 1 s; at most 10 links, http and https only
- decoding runs on a blocking thread

New dependencies: image 0.25 (png, jpeg, gif, webp only; no default
features) and rqrr 0.11 (no default features, fed greyscale pixels).
Both are permissive ((MIT OR Apache-2.0); rqrr also ISC), as are the 16
crates they bring.

SpamSettings is stored at version 1 with the setting after every existing
field; settings stored before read back with scanning off.

Test: qr.rs unit tests (a link read from a PNG and from a JPEG flyer, none
from a JPEG with no code, a data: URL, the size and format caps, only web
links kept, links kept once); the antispam url test reads a code in an
image part, in an octet-stream attachment and in a data: URL, each giving
QR_CODE_URL plus SUSPICIOUS_URL from the IP link's URL check, and nothing
for a photo with no code; a registry test for the stored versions.

Fixes #401
2026-11-18 16:32:48 -07:00
..
2026-09-18 10:21:56 -07:00
2026-09-18 10:21:56 -07:00
2026-09-18 10:21:56 -07:00
2026-09-18 10:21:56 -07:00
2026-09-18 10:21:56 -07:00
2026-09-28 06:29:38 -07:00