[Pkg-roundcube-maintainers] Bug#1153803: roundcube: Security updates 1.6.21 and 1.7.6 released

Guilhem Moulin guilhem at debian.org
Sun Nov 15 19:16:53 GMT 2026


Hi,

On Thu, 12 Nov 2026 at 08:53:25 +0100, Salvatore Bonaccorso wrote:
> https://roundcube.net/news/2026/11/09/security-updates-1.6.21-and-1.7.6
> reports new security releases for roundcube:
> […]

Here is a tested debdiff for these issues.  As for the previous uploads, I
suggest to follow 1.6.x (upstream's current LTS release) for trixie-security.
The upstream diff [0] is targeted anyway.  Debusine result:
https://debusine.debian.net/debian/developers/work-request/1623116/

I reported the issue with `long2ip()` on 32-bits platforms to upstream by mail,
along with d/p/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch .

> The following comes earlier:
>
> | WARNING: The 1.6 branch is four years old. Please, plan your upgrade
> | to 1.7 soon. Backporting security patches became increasingly time
> | consuming, annoying and error prone. 1.6 will be discontinued rather
> | soon.
>
> Means probably for Debian trixie we are on our own for backporting
> fixes unless it is realistic to switch to another branch within a
> release.

Ack, it was the same with 1.4 and I think it'll be doable despite of surge is
security issues.  1.7 has a different build systems and dependencies which are
not in trixie, so I don't think upgrading to 1.7 in trixie is doable.  I should,
however, finish to work to put it into forky ASAP.

Cheers,
-- 
Guilhem.

[0] https://github.com/roundcube/roundcubemail/compare/1.6.20...1.6.21
-------------- next part --------------
diffstat for roundcube-1.6.20+dfsg roundcube-1.6.21+dfsg

 CHANGELOG.md                                                                |   20 +
 config/defaults.inc.php                                                     |    4 
 debian/changelog                                                            |   95 ++++--
 debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch         |  118 ++++++--
 debian/patches/Fix-FTBFS-with-phpunit-11.patch                              |  144 +++++-----
 debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch |   35 ++
 debian/patches/default-charset-utf8.patch                                   |    4 
 debian/patches/dont-force-set-session.gc_probability=1.patch                |    2 
 debian/patches/series                                                       |    1 
 debian/patches/use-enchant.patch                                            |    4 
 plugins/managesieve/Changelog                                               |    3 
 plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php                    |    2 
 plugins/managesieve/lib/Roundcube/rcube_sieve_script.php                    |   41 +-
 program/actions/mail/folder_expunge.php                                     |    5 
 program/actions/mail/folder_purge.php                                       |   18 -
 program/actions/mail/sendmdn.php                                            |    9 
 program/actions/utils/spell.php                                             |    7 
 program/actions/utils/spell_html.php                                        |    8 
 program/include/rcmail.php                                                  |   19 +
 program/include/rcmail_action.php                                           |    2 
 program/include/rcmail_attachment_handler.php                               |   30 --
 program/include/rcmail_sendmail.php                                         |   18 -
 program/lib/Roundcube/rcube.php                                             |    2 
 program/lib/Roundcube/rcube_image.php                                       |   18 +
 program/lib/Roundcube/rcube_imap_generic.php                                |  103 ++++---
 program/lib/Roundcube/rcube_message.php                                     |    3 
 program/lib/Roundcube/rcube_session.php                                     |    3 
 program/lib/Roundcube/rcube_utils.php                                       |  118 ++++++--
 public_html/plugins/managesieve/Changelog                                   |    3 
 public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php        |    2 
 public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php        |   41 +-
 tests/Actions/Mail/FolderExpunge.php                                        |   21 +
 tests/Actions/Mail/FolderPurge.php                                          |   19 +
 tests/Framework/Session.php                                                 |    4 
 tests/Framework/Utils.php                                                   |   14 
 tests/Rcmail/Rcmail.php                                                     |    4 
 tests/Rcmail/Sendmail.php                                                   |   38 ++
 37 files changed, 719 insertions(+), 263 deletions(-)

diff -Nru roundcube-1.6.20+dfsg/CHANGELOG.md roundcube-1.6.21+dfsg/CHANGELOG.md
--- roundcube-1.6.20+dfsg/CHANGELOG.md	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/CHANGELOG.md	2026-11-09 12:53:01.000000000 +0100
@@ -2,6 +2,26 @@
 
 ## Unreleased
 
+- Security: Fix open redirect via IMAP error recovery on attachment get
+- Security: Fix so Received: header includes only trusted hostname and forwarded IP from a trusted proxy
+- Security: Fix bug where some managesieve destructive actions could have been triggered cross-site via GET
+- Security: Fix Sieve script injection via a rule operator
+- Security: Fix Sieve script injection via set/include modifiers
+- Security: Fix bug where resolve_url() ignored trusted host setting
+- Security: Fix mail header injection via a MDN subject
+- Security: Fix HTTP request injection via the spellcheck ATD backend
+- Security: Fix IMAP command injection via CRLF in _uid parameter with messages_cache enabled
+- Security: Fix SSRF in CSS proxy via incomplete is_local_url() nip.io/sslip.io bypass
+- Security: Fix CSRF validation bypass for file-only POST requests
+- Security: Fix `disabled_actions` restriction bypass by writing '_' instead of '-' in the action name
+- Security: Fix CSRF validation bypass for mail purge/expunge commands
+- Security: Fix passing potentally unsafe attachment content into ImageMagick on image type conversion
+- Security: Fix Unbounded CPU loop/DoS in rcube_session::unserialize() via a negative length token
+- Security: Fix SSRF filter (is_local_url()) bypass via 6to4 (2002::/16) addresses
+- Security: Fix so IMAP host input is validated more strictly
+
+## Release 1.6.20
+
 - Security: Fix IMAP command injection via CRLF in `_uid` parameter of mail/headers and mail/viewsource action
 - Security: Fix bug where an alias login wasn't qualified by IMAP host
 - Security: Add a size limit to the CSS proxy content processing
diff -Nru roundcube-1.6.20+dfsg/config/defaults.inc.php roundcube-1.6.21+dfsg/config/defaults.inc.php
--- roundcube-1.6.20+dfsg/config/defaults.inc.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/config/defaults.inc.php	2026-11-09 12:53:01.000000000 +0100
@@ -728,7 +728,9 @@
 // paths are relative to the Roundcube root folder
 $config['generic_message_footer_html'] = '';
 
-// add a received header to outgoing mails containing the creators IP and hostname
+// Add a Received: header to outgoing mails containing the creators IP and hostname.
+// For security, only trusted hosts are used. It is recommended to use 'proxy_whitelist'
+// and 'trusted_host_patterns' to control this.
 $config['http_received_header'] = false;
 
 // Whether or not to encrypt the IP address and the host name
diff -Nru roundcube-1.6.20+dfsg/debian/changelog roundcube-1.6.21+dfsg/debian/changelog
--- roundcube-1.6.20+dfsg/debian/changelog	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/changelog	2026-11-15 19:45:19.000000000 +0100
@@ -1,37 +1,74 @@
+roundcube (1.6.21+dfsg-0+deb13u1) trixie-security; urgency=high
+
+  * New upstream security and bugfix release (closes: #1153803).
+    + Fix open redirect via IMAP error recovery on attachment get.
+    + Fix so Received: header includes only trusted hostname and forwarded IP
+      from a trusted proxy.
+    + Fix bug where some managesieve destructive actions could have been
+      triggered cross-site via GET.
+    + Fix Sieve script injection via a rule operator.
+    + Fix Sieve script injection via set/include modifiers.
+    + Fix bug where resolve_url() ignored trusted host setting.
+    + Fix mail header injection via a MDN subject.
+    + Fix HTTP request injection via the spellcheck ATD backend.
+    + Fix CVE-2026-126813: IMAP command injection via CRLF in _uid parameter
+      with messages_cache enabled.
+    + Fix SSRF in CSS proxy via incomplete is_local_url() nip.io/sslip.io
+      bypass.
+    + Fix CSRF validation bypass for file-only POST requests.
+    + Fix disabled_actions restriction bypass by writing ‘_’ instead of ‘-‘ in
+      the action name.
+    + Fix CSRF validation bypass for mail purge/expunge commands.
+    + Fix passing potentially unsafe attachment content into ImageMagick on
+      image type conversion.
+    + Fix Unbounded CPU loop/DoS in rcube_session::unserialize() via a
+      negative length token.
+    + Fix SSRF filter (is_local_url()) bypass via 6to4 (2002::/16) addresses.
+    + Fix so IMAP host input is validated more strictly.
+  * Refresh d/patches.
+  * Fix `self::xip_ip()` on 32-bits platforms.
+
+ -- Guilhem Moulin <guilhem at debian.org>  Sun, 15 Nov 2026 19:45:19 +0100
+
 roundcube (1.6.20+dfsg-0+deb13u1) trixie-security; urgency=high
 
   * New upstream security and bugfix release (closes: #1151279).
     + Fix CVE-2026-113386: IMAP command injection via CRLF in `_uid` parameter
       of mail/headers and mail/viewsource action.
-    + Fix bug where an alias login wasn't qualified by IMAP host.
-    + Add a size limit to the CSS proxy content processing.
-    + Fix SSRF filter (`is_local_url()`) bypass via NAT64 64:ff9b::/96.
-    + Fix remote content blocking bypass via SVG SMIL `by` attribute.
-    + Fix remote content blocking bypass via CSS escapes in FuncIRI attributes
-      (again).
-    + Fix passing potentially unsafe attachment content into ImageMagick on
-      image resize.
-    + Fix mail header injection via the From display-name in the Bounce (resend)
-      action.
-    + Fix mail header injection via References/In-Reply-To/Message-ID/From
-      parameters.
-    + Fix object injection primitive in rcube_session::unserialize() via
-      “!”-prefixed session keys.
-    + Fix ImageMagick resource limits bypass by GD fallback during thumbnail
-      generation.
-    + Fix CSS scoping bypass in HTML messages using at-rules.
-    + Fix bug where deprecated action aliases bypassed `disabled_actions`
-      setting.
-    + Fix IMAP command injection via CRLF in `_flag` parameter of mail/mark
-      action.
-    + Fix CSRF validation bypass in the mark-as-junk action.
-    + Fix XSS issue in handling of password driver error responses.
-    + Fix mail header injection via subject of a message forwarded as
-      attachment.
-    + Fix mail header injection via media type in an inline image data URI.
-    + Fix bug where Password Modoboa driver could change password for another
-      account.
-    + Fix unsafe use of a login name in SquirrelMail import file path.
+    + Fix CVE-2026-114732: bug where an alias login wasn't qualified by IMAP host.
+    + Fix CVE-2026-114731: Unbounded CSS proxy content processing.
+    + Fix CVE-2026-114730: SSRF filter (`is_local_url()`) bypass via NAT64
+      64:ff9b::/96.
+    + Fix CVE-2026-114729: Remote content blocking bypass via SVG SMIL `by`
+      attribute.
+    + Fix CVE-2026-114728: Remote content blocking bypass via CSS escapes in
+      FuncIRI attributes (again).
+    + Fix CVE-2026-114727: Passing potentially unsafe attachment content into
+      ImageMagick on image resize.
+    + Fix CVE-2026-114726: Mail header injection via the From display-name in
+      the Bounce (resend) action.
+    + Fix CVE-2026-114725: Mail header injection via References/In-Reply-To/
+      Message-ID/From parameters.
+    + Fix CVE-2026-114724: Object injection primitive in rcube_session::
+      unserialize() via “!”-prefixed session keys.
+    + Fix CVE-2026-114723: ImageMagick resource limits bypass by GD fallback
+      during thumbnail generation.
+    + Fix CVE-2026-114722: CSS scoping bypass in HTML messages using at-rules.
+    + Fix CVE-2026-114721: Bug where deprecated action aliases bypassed
+      `disabled_actions` setting.
+    + Fix CVE-2026-114720: IMAP command injection via CRLF in `_flag`
+      parameter of mail/mark action.
+    + Fix CVE-2026-114719: CSRF validation bypass in the mark-as-junk action.
+    + Fix CVE-2026-114718: XSS issue in handling of password driver error
+      responses.
+    + Fix CVE-2026-114717: Mail header injection via subject of a message
+      forwarded as attachment.
+    + Fix CVE-2026-114716: Mail header injection via media type in an inline
+      image data URI.
+    + Fix CVE-2026-114715: Bug where Password Modoboa driver could change
+      password for another account.
+    + Fix CVE-2026-114714: Unsafe use of a login name in SquirrelMail import
+      file path.
   * Refresh d/patches.
 
  -- Guilhem Moulin <guilhem at debian.org>  Tue, 20 Oct 2026 07:00:29 +0200
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch roundcube-1.6.21+dfsg/debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch
--- roundcube-1.6.20+dfsg/debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/Avoid-dependency-on-new-package-mlocati-ip-lib.patch	2026-11-15 19:45:19.000000000 +0100
@@ -11,9 +11,9 @@
 Forwarded: not-needed
 ---
  composer.json-dist                    |   3 +-
- program/lib/Roundcube/rcube_utils.php | 169 ++++++++++++++++++++++++++++------
- tests/Framework/Utils.php             |  85 +++++++++++++++++
- 3 files changed, 228 insertions(+), 29 deletions(-)
+ program/lib/Roundcube/rcube_utils.php | 217 ++++++++++++++++++++++++----------
+ tests/Framework/Utils.php             |  88 ++++++++++++++
+ 3 files changed, 242 insertions(+), 66 deletions(-)
 
 diff --git a/composer.json-dist b/composer.json-dist
 index 1807004..ca3de26 100644
@@ -30,19 +30,20 @@
      "require-dev": {
          "phpunit/phpunit": "^9"
 diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
-index 270a14f..94f0fc4 100644
+index 936de2e..d5aa80d 100644
 --- a/program/lib/Roundcube/rcube_utils.php
 +++ b/program/lib/Roundcube/rcube_utils.php
-@@ -1,8 +1,5 @@
+@@ -1,9 +1,5 @@
  <?php
  
+-use IPLib\Address\AddressInterface;
 -use IPLib\Factory;
 -use IPLib\ParseStringFlag;
 -
  /*
   +-----------------------------------------------------------------------+
   | This file is part of the Roundcube Webmail client                     |
-@@ -422,6 +419,116 @@ class rcube_utils
+@@ -423,6 +419,116 @@ class rcube_utils
          return asciiwords($str, true, '_');
      }
  
@@ -159,7 +160,7 @@
      /**
       * Check if an URL point to a local network location.
       *
-@@ -434,11 +541,6 @@ class rcube_utils
+@@ -435,43 +541,60 @@ class rcube_utils
          $host = parse_url($url, \PHP_URL_HOST);
  
          if (is_string($host)) {
@@ -170,9 +171,8 @@
 -
              $host = trim($host, '[].');
  
-             if (preg_match('/([0-9a-f.-]+)\.(nip|sslip)\.io$/i', $host, $matches)) {
-@@ -452,29 +554,42 @@ class rcube_utils
-                 }
+             if ($xip = self::xip_ip($host)) {
+                 $host = $xip;
              }
  
 +            if (strpos($host, ':') !== false && ($n = strpos($host, '%')) > 0) {
@@ -209,12 +209,19 @@
 +                    ['100.64.0.0',  '100.127.255.255'], // RFC6598: Shared Address Space (carrier-grade NAT)
                  ];
 +                if (defined('AF_INET6')) {
++                    $nets4 = $nets;
 +                    /* IPv4-compatible and IPv4-mapped IPv6 addresses (RFC4291 2.5.5) */
 +                    foreach (['::', '::ffff:'] as $prefix) {
-+                        foreach ($nets as [$range_start, $range_end]) {
++                        foreach ($nets4 as [$range_start, $range_end]) {
 +                            $nets[] = [ $prefix . $range_start, $prefix . $range_end ];
 +                        }
 +                    }
++                    /* 6to4 (2002::/16) */
++                    foreach ($nets4 as [$range_start, $range_end]) {
++                        $range_start = "\x20\x02" . @inet_pton($range_start) . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
++                        $range_end   = "\x20\x02" . @inet_pton($range_end)   . "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF" ;
++                        $nets[] = [ @inet_ntop($range_start), @inet_ntop($range_end) ];
++                    }
 +                    $nets[] = ['::1',    '::1'];
 +                    $nets[] = ['::',    '::'];
 +                    $nets[] = ['fc00::', 'fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'];
@@ -223,21 +230,77 @@
 +                    $nets[] = ['64:ff9b:1::', '64:ff9b:1:ffff:ffff:ffff:ffff:ffff']; // (RFC 8215 local-use NAT64)
 +                }
  
--                foreach ($nets as $net) {
--                    $range = Factory::parseRangeString($net);
--                    if ($range->contains($address)) {
+-                // Extract embedded IPv4 address
+-                if ($address instanceof \IPLib\Address\IPv6 && ($embedded = $address->toIPv4())) {
+-                    $address = $embedded;
 +                foreach ($nets as [$range_start, $range_end]) {
 +                    $range_start = @inet_pton($range_start);
 +                    $range_end   = @inet_pton($range_end);
 +                    if (strcmp($range_start, $address) <= 0 && strcmp($range_end, $address) >= 0) {
-                         return true;
-                     }
++                        return true;
++                    }
                  }
+ 
+-                return self::is_ip_in_range($address, $nets);
++                return false;
+             }
+ 
+             // FIXME: Should we accept any non-fqdn hostnames?
+@@ -482,38 +605,6 @@ class rcube_utils
+         return false;
+     }
+ 
+-    /**
+-     * Check if an IP address matches an entry in the given whitelist.
+-     * Entries may be exact IP addresses or CIDR ranges (e.g. '10.0.0.0/8', 'fc00::/7').
+-     *
+-     * @param string|AddressInterface $ip        IP address to check
+-     * @param array                   $whitelist List of IPs or CIDR ranges
+-     */
+-    private static function is_ip_in_range($ip, array $whitelist): bool
+-    {
+-        if (empty($whitelist)) {
+-            return false;
+-        }
+-
+-        if ($ip instanceof AddressInterface) {
+-            $address = $ip;
+-            $ip = (string) $ip;
+-        } else {
+-            $address = Factory::parseAddressString($ip);
+-        }
+-
+-        foreach ($whitelist as $entry) {
+-            if ($entry === $ip) {
+-                return true;
+-            }
+-            if ($address && ($range = Factory::parseRangeString($entry)) && $range->contains($address)) {
+-                return true;
+-            }
+-        }
+-
+-        return false;
+-    }
+-
+     /**
+      * Extract IP address from a nip.io/sslip.io-style fqdn
+      *
+@@ -564,9 +655,7 @@ class rcube_utils
+         // IPv6 hex
+         $ipv6REHex = '/(^|\.)([[:xdigit:]]{32})($|\.)/';
+         if (preg_match($ipv6REHex, $host, $m)) {
+-            $words = str_split($m[2], 2);
+-            $words = array_map('hex2bin', $words);
+-            return (string) \IPLib\Address\IPv6::fromWords($words);
++            return implode(':', str_split($m[2], 4));
+         }
+ 
+         return null;
 diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
-index 4325b0b..5769772 100644
+index d3208a0..ba7cda6 100644
 --- a/tests/Framework/Utils.php
 +++ b/tests/Framework/Utils.php
-@@ -588,6 +588,86 @@ class Framework_Utils extends TestCase
+@@ -590,6 +590,86 @@ class Framework_Utils extends TestCase
          }
      }
  
@@ -324,7 +387,7 @@
      /**
       * Test is_local_url()
       *
-@@ -607,12 +687,17 @@ class Framework_Utils extends TestCase
+@@ -609,12 +689,17 @@ class Framework_Utils extends TestCase
          return [
              // Local hosts
              ['https://127.0.0.1', true],
@@ -342,3 +405,20 @@
              ['//127.0.0.1', true],
              ['http://localhost', true],
              ['http://localhost.localdomain', true],
+@@ -637,6 +722,8 @@ class Framework_Utils extends TestCase
+             ['http://x.0a000001.nip.io/', true],
+             ['http://x.c0a80101.nip.io/', true],
+             ['http://x.a9fea9fe.nip.io/', true],
++            ['http://x.00000000000000000000000000000001.nip.io/', true],
++            ['http://x.fe80123456789abcdef0123456789abc.nip.io/', true],
+             ['http://x.0-0-0-0-0-0-0-0-1.sslip.io/', true],
+             ['http://0-0-0-0-0-0-0-0-1.sslip.io/', true],
+             ['http://metadata.google.internal', true],
+@@ -662,6 +749,7 @@ class Framework_Utils extends TestCase
+             ['http://20.0.0.1.nip.io.', false],
+             ['http://www-20-0-0-1.nip.io', false],
+             ['http://40b01609.nip.io/', false],
++            ['http://x.fed0123456789abcdef0123456789abc.nip.io/', false],
+         ];
+     }
+ 
diff -Nru roundcube-1.6.20+dfsg/debian/patches/default-charset-utf8.patch roundcube-1.6.21+dfsg/debian/patches/default-charset-utf8.patch
--- roundcube-1.6.20+dfsg/debian/patches/default-charset-utf8.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/default-charset-utf8.patch	2026-11-15 19:45:19.000000000 +0100
@@ -8,10 +8,10 @@
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/config/defaults.inc.php b/config/defaults.inc.php
-index 6e80aa9..36a5731 100644
+index 12d7287..05e4337 100644
 --- a/config/defaults.inc.php
 +++ b/config/defaults.inc.php
-@@ -1267,7 +1267,7 @@ $config['collected_senders'] = true;
+@@ -1269,7 +1269,7 @@ $config['collected_senders'] = true;
  // ----------------------------------
  
  // Use this charset as fallback for message decoding
diff -Nru roundcube-1.6.20+dfsg/debian/patches/dont-force-set-session.gc_probability=1.patch roundcube-1.6.21+dfsg/debian/patches/dont-force-set-session.gc_probability=1.patch
--- roundcube-1.6.20+dfsg/debian/patches/dont-force-set-session.gc_probability=1.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/dont-force-set-session.gc_probability=1.patch	2026-11-15 19:45:19.000000000 +0100
@@ -18,7 +18,7 @@
  1 file changed, 7 deletions(-)
 
 diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
-index fd278b1..27ac7d3 100644
+index 85877ac..a0736c3 100644
 --- a/program/lib/Roundcube/rcube.php
 +++ b/program/lib/Roundcube/rcube.php
 @@ -450,7 +450,6 @@ class rcube
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch roundcube-1.6.21+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch
--- roundcube-1.6.20+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/Fix-FTBFS-with-phpunit-11.patch	2026-11-15 19:45:19.000000000 +0100
@@ -41,7 +41,7 @@
  plugins/managesieve/tests/Forward.php              |  16 +-
  plugins/managesieve/tests/Managesieve.php          |  14 +-
  plugins/managesieve/tests/Script.php               |  17 +-
- plugins/managesieve/tests/Vacation.php             |  21 ++-
+ plugins/managesieve/tests/Vacation.php             |  21 +-
  plugins/markasjunk/tests/Markasjunk.php            |  22 ++-
  plugins/new_user_dialog/tests/NewUserDialog.php    |  14 +-
  .../new_user_identity/tests/NewUserIdentity.php    |  14 +-
@@ -76,9 +76,9 @@
  tests/Actions/Contacts/Qrcode.php                  |  17 +-
  tests/Actions/Contacts/Save.php                    |  27 +--
  tests/Actions/Contacts/Search.php                  |  18 +-
- tests/Actions/Contacts/SearchCreate.php            |  21 ++-
- tests/Actions/Contacts/SearchDelete.php            |  21 ++-
- tests/Actions/Contacts/Show.php                    |  21 ++-
+ tests/Actions/Contacts/SearchCreate.php            |  21 +-
+ tests/Actions/Contacts/SearchDelete.php            |  21 +-
+ tests/Actions/Contacts/Show.php                    |  21 +-
  tests/Actions/Contacts/Undo.php                    |  15 +-
  tests/Actions/Contacts/UploadPhoto.php             |  19 +-
  tests/Actions/Login/Oauth.php                      |  14 +-
@@ -93,13 +93,13 @@
  tests/Actions/Mail/Compose.php                     |  22 ++-
  tests/Actions/Mail/Copy.php                        |  25 +--
  tests/Actions/Mail/Delete.php                      |  10 +-
- tests/Actions/Mail/FolderExpunge.php               |  33 ++--
- tests/Actions/Mail/FolderPurge.php                 |  10 +-
+ tests/Actions/Mail/FolderExpunge.php               |  37 ++--
+ tests/Actions/Mail/FolderPurge.php                 |  11 +-
  tests/Actions/Mail/Get.php                         |  10 +-
  tests/Actions/Mail/Getunread.php                   |  10 +-
  tests/Actions/Mail/GroupExpand.php                 |  10 +-
  tests/Actions/Mail/Headers.php                     |  10 +-
- tests/Actions/Mail/Index.php                       | 106 ++++++-----
+ tests/Actions/Mail/Index.php                       | 106 +++++-----
  tests/Actions/Mail/List.php                        |  10 +-
  tests/Actions/Mail/ListContacts.php                |  10 +-
  tests/Actions/Mail/Mark.php                        |  10 +-
@@ -149,7 +149,7 @@
  tests/ExitException.php                            |   6 +-
  tests/Framework/Addressbook.php                    |  40 ++--
  tests/Framework/Addresses.php                      |  16 +-
- tests/Framework/BaseReplacer.php                   |  21 ++-
+ tests/Framework/BaseReplacer.php                   |  21 +-
  tests/Framework/Bootstrap.php                      |   8 +-
  tests/Framework/Browser.php                        |  34 ++--
  tests/Framework/Cache.php                          |  18 +-
@@ -201,9 +201,9 @@
  tests/Framework/Text2Html.php                      |  22 ++-
  tests/Framework/TnefDecoder.php                    |  18 +-
  tests/Framework/User.php                           |  30 +--
- tests/Framework/Utils.php                          | 209 +++++++++++----------
+ tests/Framework/Utils.php                          | 213 +++++++++++----------
  tests/Framework/VCard.php                          |  40 ++--
- tests/Framework/Washtml.php                        |  85 +++++----
+ tests/Framework/Washtml.php                        |  85 ++++----
  tests/OutputHtmlMock.php                           |   6 +-
  tests/OutputJsonMock.php                           |   6 +-
  tests/Rcmail/Action.php                            |  40 ++--
@@ -221,8 +221,8 @@
  tests/Rcmail/Utils.php                             |  22 ++-
  tests/StderrMock.php                               |  15 +-
  tests/StorageMock.php                              |   4 +-
- tests/bootstrap.php                                |  21 ++-
- 213 files changed, 2514 insertions(+), 1803 deletions(-)
+ tests/bootstrap.php                                |  21 +-
+ 213 files changed, 2519 insertions(+), 1807 deletions(-)
 
 diff --git a/plugins/acl/tests/Acl.php b/plugins/acl/tests/Acl.php
 index 94e0bd4..0ad987f 100644
@@ -3962,7 +3962,7 @@
      }
  }
 diff --git a/tests/Actions/Mail/FolderExpunge.php b/tests/Actions/Mail/FolderExpunge.php
-index 5ece885..5961527 100644
+index 01e7187..56f7194 100644
 --- a/tests/Actions/Mail/FolderExpunge.php
 +++ b/tests/Actions/Mail/FolderExpunge.php
 @@ -1,9 +1,12 @@
@@ -4061,16 +4061,28 @@
  
          $this->runAndAssert($action, OutputJsonMock::E_EXIT);
  
+@@ -111,8 +114,8 @@ class Actions_Mail_FolderExpunge extends ActionTestCase
+      */
+     public function test_run_empty_post()
+     {
+-        $action = new rcmail_action_mail_folder_expunge();
+-        $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'expunge');
++        $action = new \rcmail_action_mail_folder_expunge();
++        $output = $this->initOutput(\rcmail_action::MODE_AJAX, 'mail', 'expunge');
+ 
+         $this->assertTrue($action->checks());
+ 
 diff --git a/tests/Actions/Mail/FolderPurge.php b/tests/Actions/Mail/FolderPurge.php
-index a0785e0..17832ea 100644
+index bcefb64..d2bf9e3 100644
 --- a/tests/Actions/Mail/FolderPurge.php
 +++ b/tests/Actions/Mail/FolderPurge.php
-@@ -1,9 +1,11 @@
+@@ -1,9 +1,12 @@
  <?php
  
 +namespace Roundcube\Tests\Actions\Mail;
 +
 +use Roundcube\Tests\ActionTestCase;
++use Roundcube\Tests\OutputJsonMock;
 +
  /**
   * Test class to test rcmail_action_mail_folder_purge
@@ -4079,17 +4091,17 @@
   */
  class Actions_Mail_FolderPurge extends ActionTestCase
  {
-@@ -12,8 +14,8 @@ class Actions_Mail_FolderPurge extends ActionTestCase
+@@ -12,8 +15,8 @@ class Actions_Mail_FolderPurge extends ActionTestCase
       */
-     function test_class()
+     public function test_run_empty_post()
      {
--        $object = new rcmail_action_mail_folder_purge;
-+        $object = new \rcmail_action_mail_folder_purge();
+-        $action = new rcmail_action_mail_folder_purge();
+-        $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'purge');
++        $action = new \rcmail_action_mail_folder_purge();
++        $output = $this->initOutput(\rcmail_action::MODE_AJAX, 'mail', 'purge');
+ 
+         $this->assertTrue($action->checks());
  
--        $this->assertInstanceOf('rcmail_action', $object);
-+        $this->assertInstanceOf(\rcmail_action::class, $object);
-     }
- }
 diff --git a/tests/Actions/Mail/Get.php b/tests/Actions/Mail/Get.php
 index d32bd75..f0e9060 100644
 --- a/tests/Actions/Mail/Get.php
@@ -9341,7 +9353,7 @@
          $this->assertSame(true, $object->is_empty(), "Object is empty");
          $this->assertSame(false, $object->is_error(), "Object is error");
 diff --git a/tests/Framework/Session.php b/tests/Framework/Session.php
-index 6df2d4e..f1392f4 100644
+index 4d4003e..2aecb80 100644
 --- a/tests/Framework/Session.php
 +++ b/tests/Framework/Session.php
 @@ -1,26 +1,28 @@
@@ -10052,7 +10064,7 @@
          $idents = $user->list_identities();
  
 diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
-index 08d0880..4325b0b 100644
+index 6285052..d3208a0 100644
 --- a/tests/Framework/Utils.php
 +++ b/tests/Framework/Utils.php
 @@ -1,11 +1,15 @@
@@ -10387,11 +10399,13 @@
      }
  
      /**
-@@ -547,18 +557,18 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -547,20 +557,20 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       */
      function test_is_simple_string()
      {
 -        $this->assertTrue(rcube_utils::is_simple_string('some-thing.123_'));
+-        $this->assertTrue(rcube_utils::is_simple_string('AAAA.BBBB-cccc_ddd'));
+-        $this->assertFalse(rcube_utils::is_simple_string("test\n"));
 -        $this->assertFalse(rcube_utils::is_simple_string(''));
 -        $this->assertFalse(rcube_utils::is_simple_string(' '));
 -        $this->assertFalse(rcube_utils::is_simple_string('some–thing'));
@@ -10401,9 +10415,11 @@
 -        $this->assertFalse(rcube_utils::is_simple_string('%20'));
 -        $this->assertFalse(rcube_utils::is_simple_string('\0000'));
 -        $this->assertFalse(rcube_utils::is_simple_string(1));
--        $this->assertFalse(rcube_utils::is_simple_string(new stdClass()));
+-        $this->assertFalse(rcube_utils::is_simple_string(new \stdClass()));
 -        $this->assertFalse(rcube_utils::is_simple_string(null));
 +        $this->assertTrue(\rcube_utils::is_simple_string('some-thing.123_'));
++        $this->assertTrue(\rcube_utils::is_simple_string('AAAA.BBBB-cccc_ddd'));
++        $this->assertFalse(\rcube_utils::is_simple_string("test\n"));
 +        $this->assertFalse(\rcube_utils::is_simple_string(''));
 +        $this->assertFalse(\rcube_utils::is_simple_string(' '));
 +        $this->assertFalse(\rcube_utils::is_simple_string('some–thing'));
@@ -10418,7 +10434,7 @@
      }
  
      /**
-@@ -573,7 +583,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -575,7 +585,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $v) {
@@ -10427,7 +10443,7 @@
              $this->assertSame($v[2], $result);
          }
      }
-@@ -668,7 +678,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -680,7 +690,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $datetime => $ts) {
@@ -10436,7 +10452,7 @@
              $this->assertSame($ts, $result, "Error parsing date: $datetime");
          }
      }
-@@ -695,7 +705,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -707,7 +717,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $datetime => $ts) {
@@ -10445,7 +10461,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d') : false, "Error parsing date: $datetime");
          }
  
-@@ -705,7 +715,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -717,7 +727,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $datetime => $ts) {
@@ -10454,7 +10470,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s') : false, "Error parsing date: $datetime");
          }
  
-@@ -714,7 +724,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -726,7 +736,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $datetime => $ts) {
@@ -10463,7 +10479,7 @@
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i:s O') : false, "Error parsing date: $datetime");
          }
      }
-@@ -724,17 +734,17 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -736,17 +746,17 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       */
      function test_anytodatetime_timezone()
      {
@@ -10484,7 +10500,7 @@
              if ($result) $result->setTimezone($tz);  // move to target timezone for comparison
              $this->assertSame($ts, $result ? $result->format('Y-m-d H:i') : false, "Error parsing date: $datetime");
          }
-@@ -753,7 +763,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -765,7 +775,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $data) {
@@ -10493,7 +10509,7 @@
              $this->assertSame($data[2], $result, "Error formatting date: " . $data[0]);
          }
      }
-@@ -772,7 +782,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -784,7 +794,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $input => $output) {
@@ -10502,7 +10518,7 @@
              $this->assertSame($output, $result);
          }
      }
-@@ -797,7 +807,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -809,7 +819,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $input => $output) {
@@ -10511,7 +10527,7 @@
              $this->assertSame($output, $result, "Error normalizing '$input'");
          }
      }
-@@ -820,7 +830,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -832,7 +842,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          ];
  
          foreach ($test as $idx => $params) {
@@ -10520,7 +10536,7 @@
              $this->assertSame($params[2], $result, "words_match() at index $idx");
          }
      }
-@@ -846,7 +856,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -858,7 +868,7 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
          }
  
          foreach ($test as $input => $output) {
@@ -10529,7 +10545,7 @@
              $this->assertSame($output, $result);
          }
      }
-@@ -856,17 +866,17 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -868,17 +878,17 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       */
      function test_random_bytes()
      {
@@ -10553,7 +10569,7 @@
      {
  
          /*
-@@ -903,9 +913,10 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -915,9 +925,10 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       * @param string $encoded Encoded email address
       * @dataProvider data_idn_convert
       */
@@ -10565,7 +10581,7 @@
      }
  
      /**
-@@ -915,9 +926,10 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -927,9 +938,10 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       * @param string $encoded Encoded email address
       * @dataProvider data_idn_convert
       */
@@ -10577,7 +10593,7 @@
      }
  
      /**
-@@ -925,14 +937,14 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -937,14 +949,14 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       */
      function test_idn_to_ascii_special()
      {
@@ -10595,7 +10611,7 @@
      {
          return [
              ['%z', 'hostname', 'hostname'],
-@@ -947,15 +959,16 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -959,15 +971,16 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       *
       * @dataProvider data_parse_host
       */
@@ -10614,7 +10630,7 @@
      {
          return [
              [['hostname', null, null], ['hostname', null, null]],
-@@ -978,15 +991,16 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -990,15 +1003,16 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       *
       * @dataProvider data_parse_host_uri
       */
@@ -10633,7 +10649,7 @@
          return [
              ['both',    'Fwd: Re: Test subject both', 'Test subject both'],
              ['both',    'Re: Fwd: Test subject both', 'Test subject both'],
-@@ -1004,8 +1018,9 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -1016,8 +1030,9 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       * 
       * @dataProvider data_remove_subject_prefix
       */
@@ -10644,7 +10660,7 @@
      }
  
      /**
-@@ -1013,13 +1028,13 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -1025,13 +1040,13 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
       */
      function test_server_name()
      {
@@ -10661,7 +10677,7 @@
      }
  
      /**
-@@ -1029,31 +1044,31 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
+@@ -1041,31 +1056,31 @@ class Framework_Utils extends PHPUnit\Framework\TestCase
      {
          $_SERVER['test'] = 'test.com';
  
@@ -11876,7 +11892,7 @@
          $commands->setAccessible(true);
  
 diff --git a/tests/Rcmail/Rcmail.php b/tests/Rcmail/Rcmail.php
-index 4a16b38..c655336 100644
+index 889a785..60baf9c 100644
 --- a/tests/Rcmail/Rcmail.php
 +++ b/tests/Rcmail/Rcmail.php
 @@ -1,9 +1,14 @@
@@ -11956,9 +11972,9 @@
      {
 -        $rcmail = rcmail::get_instance();
 +        $rcmail = \rcmail::get_instance();
+         $rcmail->config->set('trusted_host_patterns', []);
  
          $this->assertEquals(
-             '/sub/?_task=cli&_action=test',
 @@ -210,9 +215,9 @@ class Rcmail_Rcmail extends ActionTestCase
      {
          self::initDB('contacts');
@@ -12050,7 +12066,7 @@
          $result = $mail->headers();
  
 diff --git a/tests/Rcmail/Sendmail.php b/tests/Rcmail/Sendmail.php
-index a29fcf2..7b61e95 100644
+index 31e1c2e..b921ab5 100644
 --- a/tests/Rcmail/Sendmail.php
 +++ b/tests/Rcmail/Sendmail.php
 @@ -1,11 +1,14 @@
@@ -12080,7 +12096,7 @@
          $headers = $sendmail->headers_input();
  
          $this->assertSame('Test1 Test2 Test3', $headers['Subject']);
-@@ -74,10 +77,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -110,10 +113,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
          self::initDB('identities');
          self::initUser();
  
@@ -12093,7 +12109,7 @@
  
          $result = $sendmail->get_identity($identity['identity_id']);
  
-@@ -115,7 +118,7 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -151,7 +154,7 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      /**
       * Data for test_convert()
       */
@@ -12102,7 +12118,7 @@
      {
          return [
              [
-@@ -174,9 +177,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -210,9 +213,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      /**
       * @dataProvider data_email_input_format
       */
@@ -12114,7 +12130,7 @@
          $sendmail->options['charset'] = $charset;
  
          $this->assertEquals($output, $sendmail->email_input_format($input));
-@@ -196,24 +200,24 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -232,24 +236,24 @@ class Rcmail_RcmailSendmail extends ActionTestCase
      function test_draftinfo_encode_and_decode()
      {
          $input  = ['test' => 'test'];
@@ -12147,7 +12163,7 @@
      }
  
      /**
-@@ -221,14 +225,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -257,14 +261,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_headers_output()
      {
@@ -12165,7 +12181,7 @@
          $sendmail->options['charset'] = RCUBE_CHARSET;
          $sendmail->options['message'] = $message;
  
-@@ -247,10 +251,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -283,10 +287,10 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_reply_subject()
      {
@@ -12180,7 +12196,7 @@
      }
  
      /**
-@@ -258,9 +262,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -294,9 +298,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_compose_subject()
      {
@@ -12192,7 +12208,7 @@
  
          $_POST = ['_subject' => 'test'];
  
-@@ -274,9 +278,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -310,9 +314,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_mdn_checkbox()
      {
@@ -12204,7 +12220,7 @@
  
          $result = $sendmail->mdn_checkbox([]);
  
-@@ -288,9 +292,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -324,9 +328,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_dsn_checkbox()
      {
@@ -12216,7 +12232,7 @@
  
          $result = $sendmail->dsn_checkbox([]);
  
-@@ -302,9 +306,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -338,9 +342,9 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_priority_selector()
      {
@@ -12228,7 +12244,7 @@
  
          $result = $sendmail->priority_selector([]);
  
-@@ -324,14 +328,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -360,14 +364,14 @@ class Rcmail_RcmailSendmail extends ActionTestCase
       */
      function test_identity_select()
      {
@@ -12246,7 +12262,7 @@
          $this->assertSame(null, $result);
  
          $identities = [
-@@ -367,26 +371,26 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -403,26 +407,26 @@ class Rcmail_RcmailSendmail extends ActionTestCase
          $message->headers->to = 'ident2 at domain.tld';
          $message->headers->from = 'from at other.domain.tld';
  
@@ -12277,7 +12293,7 @@
          $this->assertSame($identities[2], $result);
      }
  
-@@ -413,15 +417,15 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -449,15 +453,15 @@ class Rcmail_RcmailSendmail extends ActionTestCase
              ],
          ];
  
@@ -12297,7 +12313,7 @@
  
          $this->assertSame($identities[1], $res);
      }
-@@ -454,23 +458,23 @@ class Rcmail_RcmailSendmail extends ActionTestCase
+@@ -490,23 +494,23 @@ class Rcmail_RcmailSendmail extends ActionTestCase
              ],
          ];
  
diff -Nru roundcube-1.6.20+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch roundcube-1.6.21+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch
--- roundcube-1.6.20+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch	1970-01-01 01:00:00.000000000 +0100
+++ roundcube-1.6.21+dfsg/debian/patches/Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch	2026-11-15 19:45:19.000000000 +0100
@@ -0,0 +1,35 @@
+From: Guilhem Moulin <guilhem at debian.org>
+Date: Sat, 14 Nov 2026 18:11:34 +0100
+Subject: Fix IPv4 hex nip.io-style parsing on 32-bits platforms.
+
+long2ip() fails on 32-bits platforms when the the input long exceeds
+2³¹-1, for instance for 0xC0A80001 (the hexadecimal representation of
+IPv4 address 192.168.0.1).
+
+    PHP Fatal error:  Uncaught TypeError: long2ip(): Argument #1 ($ip) must be of type int, string given
+
+Forwarded: msgid=<avd1UFgGIccNlYYd at fripost.org>
+---
+ program/lib/Roundcube/rcube_utils.php | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
+index d5aa80d..27329a5 100644
+--- a/program/lib/Roundcube/rcube_utils.php
++++ b/program/lib/Roundcube/rcube_utils.php
+@@ -631,7 +631,14 @@ class rcube_utils
+         // IPv4 hex
+         $ipv4REHex = '/(^|[.-])([[:xdigit:]]{8})($|[.-])/';
+         if (preg_match($ipv4REHex, $host, $m)) {
+-            return long2ip(base_convert($m[2], 16, 10));
++            $hi = hexdec(substr($m[2], 0, -4));
++            $li = hexdec(substr($m[2], -4));
++            $address = "\x00\x00\x00\x00";
++            $address[0] = chr( intdiv($hi, 1 << 8) );
++            $address[1] = chr( $hi % (1 << 8) );
++            $address[2] = chr( intdiv($li, 1 << 8) );
++            $address[3] = chr( $li % (1 << 8) );
++            return @inet_ntop($address);
+         }
+ 
+         // IPv6 dash-separated
diff -Nru roundcube-1.6.20+dfsg/debian/patches/series roundcube-1.6.21+dfsg/debian/patches/series
--- roundcube-1.6.20+dfsg/debian/patches/series	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/series	2026-11-15 19:45:19.000000000 +0100
@@ -21,3 +21,4 @@
 Fix-FTBFS-with-phpunit-11.patch
 Fix-flaky-test.patch
 Avoid-dependency-on-new-package-mlocati-ip-lib.patch
+Fix-IPv4-hex-nip.io-style-parsing-on-32-bits-platforms.patch
diff -Nru roundcube-1.6.20+dfsg/debian/patches/use-enchant.patch roundcube-1.6.21+dfsg/debian/patches/use-enchant.patch
--- roundcube-1.6.20+dfsg/debian/patches/use-enchant.patch	2026-10-20 07:00:29.000000000 +0200
+++ roundcube-1.6.21+dfsg/debian/patches/use-enchant.patch	2026-11-15 19:45:19.000000000 +0100
@@ -10,10 +10,10 @@
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/config/defaults.inc.php b/config/defaults.inc.php
-index 285a62c..6e80aa9 100644
+index 111ab15..12d7287 100644
 --- a/config/defaults.inc.php
 +++ b/config/defaults.inc.php
-@@ -948,7 +948,8 @@ $config['spellcheck_dictionary'] = false;
+@@ -950,7 +950,8 @@ $config['spellcheck_dictionary'] = false;
  // Since Google shut down their public spell checking service, the default settings
  // connect to https://spell.roundcube.net which is a hosted service provided by Roundcube.
  // You can connect to any other googie-compliant service by setting 'spellcheck_uri' accordingly.
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/Changelog roundcube-1.6.21+dfsg/plugins/managesieve/Changelog
--- roundcube-1.6.20+dfsg/plugins/managesieve/Changelog	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/Changelog	2026-11-09 12:53:01.000000000 +0100
@@ -8,6 +8,9 @@
 - Fix infinite loop when parsing a malformed script (#9562)
 - Fix current script state after initial scripts creation in managesieve_kolab_master mode
 - Fix match-type selector (remove unsupported options) in delete header action (#9610)
+- Fix bug where some managesieve destructive actions could have been triggered cross-site via GET
+- Fix Sieve script injection via a rule operator
+- Fix Sieve script injection via set/include modifiers
 
 * version 9.4 [2021-06-06]
 -----------------------------------------------------------
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
--- roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php	2026-11-09 12:53:01.000000000 +0100
@@ -279,7 +279,7 @@
 
         // Handle user requests
         if ($action = rcube_utils::get_input_string('_act', rcube_utils::INPUT_GPC)) {
-            $fid = (int) rcube_utils::get_input_value('_fid', rcube_utils::INPUT_POST);
+            $fid = rcube_utils::get_input_string('_fid', rcube_utils::INPUT_POST);
 
             if ($action == 'delete' && !$error) {
                 if (!in_array('delete_filter', $this->disabled_actions)) {
diff -Nru roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
--- roundcube-1.6.20+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php	2026-11-09 12:53:01.000000000 +0100
@@ -22,7 +22,10 @@
 
 class rcube_sieve_script
 {
-    public $content = [];      // script rules array
+    public const SET_OPTIONS = ['lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length', 'encodeurl'];
+    public const INCLUDE_OPTIONS = ['once', 'optional', 'global', 'personal'];
+
+    public $content = []; // script rules array
 
     private $vars      = [];   // "global" variables
     private $prefix    = '';   // script header (comments)
@@ -480,19 +483,13 @@
 
                     case 'include':
                         array_push($exts, 'include');
-                        $action_script .= 'include ';
-                        foreach (array_diff(array_keys($action), ['target', 'type']) as $opt) {
-                            $action_script .= ":$opt ";
-                        }
+                        $action_script .= 'include ' . $this->bool_options($action, self::INCLUDE_OPTIONS);
                         $action_script .= self::escape_string($action['target']);
                         break;
 
                     case 'set':
                         array_push($exts, 'variables');
-                        $action_script .= 'set ';
-                        foreach (array_diff(array_keys($action), ['name', 'value', 'type']) as $opt) {
-                            $action_script .= ":$opt ";
-                        }
+                        $action_script .= 'set ' . $this->bool_options($action, self::SET_OPTIONS);
                         $action_script .= self::escape_string($action['name']) . ' ' . self::escape_string($action['value']);
                         break;
 
@@ -969,7 +966,6 @@
                 $action  = ['type' => $token, 'target' => array_pop($tokens)];
                 $args    = ['copy'];
                 $action += $this->action_arguments($tokens, $args);
-
                 $result[] = $action;
                 break;
 
@@ -978,7 +974,6 @@
                 $args    = ['mime'];
                 $vargs   = ['seconds', 'days', 'addresses', 'subject', 'handle', 'from'];
                 $action += $this->action_arguments($tokens, $args, $vargs);
-
                 $result[] = $action;
                 break;
 
@@ -1007,16 +1002,14 @@
 
             case 'include':
                 $action  = ['type' => 'include', 'target' => array_pop($tokens)];
-                $args    = ['once', 'optional', 'global', 'personal'];
-                $action += $this->action_arguments($tokens, $args);
+                $action += $this->action_arguments($tokens, self::INCLUDE_OPTIONS);
 
                 $result[] = $action;
                 break;
 
             case 'set':
                 $action  = ['type' => 'set', 'value' => array_pop($tokens), 'name' => array_pop($tokens)];
-                $args    = ['lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length'];
-                $action += $this->action_arguments($tokens, $args);
+                $action += $this->action_arguments($tokens, self::SET_OPTIONS);
 
                 $result[] = $action;
                 break;
@@ -1139,7 +1132,7 @@
      */
     private function add_operator($test, &$out, &$exts)
     {
-        if (empty($test['type'])) {
+        if (empty($test['type']) || !preg_match('/^[a-z-]+$/', $test['type'])) {
             return;
         }
 
@@ -1161,6 +1154,22 @@
     }
 
     /**
+     * Create command options string
+     */
+    private function bool_options($options, $keys)
+    {
+        $out = '';
+
+        foreach ($keys as $opt) {
+            if (isset($options[$opt])) {
+                $out .= ":{$opt} ";
+            }
+        }
+
+        return $out;
+    }
+
+    /**
      * Extract test tokens
      */
     private function test_tokens(&$tokens)
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/folder_expunge.php roundcube-1.6.21+dfsg/program/actions/mail/folder_expunge.php
--- roundcube-1.6.20+dfsg/program/actions/mail/folder_expunge.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/folder_expunge.php	2026-11-09 12:53:01.000000000 +0100
@@ -32,6 +32,11 @@
         $rcmail = rcmail::get_instance();
         $mbox   = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true);
 
+        if ($mbox === '') {
+            $rcmail->output->show_message('internalerror', 'error');
+            $rcmail->output->send();
+        }
+
         $success = $rcmail->storage->expunge_folder($mbox);
 
         // reload message list if current mailbox
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/folder_purge.php roundcube-1.6.21+dfsg/program/actions/mail/folder_purge.php
--- roundcube-1.6.20+dfsg/program/actions/mail/folder_purge.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/folder_purge.php	2026-11-09 12:53:01.000000000 +0100
@@ -29,11 +29,19 @@
      */
     public function run($args = [])
     {
-        $rcmail       = rcmail::get_instance();
-        $storage      = $rcmail->get_storage();
-        $delimiter    = $storage->get_hierarchy_delimiter();
-        $mbox         = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true);
-        $trash_mbox   = $rcmail->config->get('trash_mbox');
+        $rcmail = rcmail::get_instance();
+        $mbox = rcube_utils::get_input_string('_mbox', rcube_utils::INPUT_POST, true);
+
+        if ($mbox === '') {
+            $rcmail->output->show_message('internalerror', 'error');
+            $rcmail->output->send();
+        }
+
+        $storage = $rcmail->get_storage();
+        $delimiter = $storage->get_hierarchy_delimiter();
+        $trash_mbox = (string) $rcmail->config->get('trash_mbox');
+        $junk_mbox = (string) $rcmail->config->get('junk_mbox');
+        $delete_junk = $rcmail->config->get('delete_junk');
         $trash_regexp = '/^' . preg_quote($trash_mbox . $delimiter, '/') . '/';
 
         // we should only be purging trash (or their subfolders)
diff -Nru roundcube-1.6.20+dfsg/program/actions/mail/sendmdn.php roundcube-1.6.21+dfsg/program/actions/mail/sendmdn.php
--- roundcube-1.6.20+dfsg/program/actions/mail/sendmdn.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/mail/sendmdn.php	2026-11-09 12:53:01.000000000 +0100
@@ -121,7 +121,14 @@
                 $report .= "Reporting-UA: $agent\r\n";
             }
 
-            $to   = rcube_mime::decode_mime_string($message->headers->to, $charset);
+            // For security reasons do not allow new-line characters in headers
+            foreach ($headers as $idx => $value) {
+                if (is_string($value)) {
+                    $headers[$idx] = trim(preg_replace('/[\r\n\t\s]+/', ' ', $value));
+                }
+            }
+
+            $to = rcube_mime::decode_mime_string($message->headers->to, $charset);
             $date = $rcmail->format_date($message->headers->date, $rcmail->config->get('date_long'));
             $body = $rcmail->gettext("yourmessage") . "\r\n\r\n" .
                 "\t" . $rcmail->gettext("to") . ": {$to}\r\n" .
diff -Nru roundcube-1.6.20+dfsg/program/actions/utils/spell_html.php roundcube-1.6.21+dfsg/program/actions/utils/spell_html.php
--- roundcube-1.6.20+dfsg/program/actions/utils/spell_html.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/utils/spell_html.php	2026-11-09 12:53:01.000000000 +0100
@@ -32,6 +32,14 @@
         $rcmail = rcmail::get_instance();
         $method = rcube_utils::get_input_string('method', rcube_utils::INPUT_POST);
         $lang   = rcube_utils::get_input_string('lang', rcube_utils::INPUT_POST);
+
+        if (!rcube_utils::is_simple_string($lang)) {
+            rcube::raise_error('Spellcheck error: Invalid language code', true);
+
+            echo json_encode(['error' => $rcmail->gettext('internalerror')]);
+            exit;
+        }
+
         $result = [];
 
         $spellchecker = new rcube_spellchecker($lang);
diff -Nru roundcube-1.6.20+dfsg/program/actions/utils/spell.php roundcube-1.6.21+dfsg/program/actions/utils/spell.php
--- roundcube-1.6.20+dfsg/program/actions/utils/spell.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/actions/utils/spell.php	2026-11-09 12:53:01.000000000 +0100
@@ -31,6 +31,13 @@
     {
         // read input
         $lang = rcube_utils::get_input_string('lang', rcube_utils::INPUT_GET);
+
+        if (!rcube_utils::is_simple_string($lang)) {
+            rcube::raise_error('Spellcheck error: Invalid language code', true);
+            http_response_code(500);
+            exit;
+        }
+
         $data = file_get_contents('php://input');
 
         $learn_word = strpos($data, '<learnword>');
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_action.php roundcube-1.6.21+dfsg/program/include/rcmail_action.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_action.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_action.php	2026-11-09 12:53:01.000000000 +0100
@@ -894,7 +894,7 @@
                 if ($uid == '*') {
                     $result[$mbox] = $uid;
                 }
-                else if (preg_match('/^[0-9:.]+$/', $uid)) {
+                elseif (preg_match('/^[0-9:.]+\z/', $uid)) {
                     $result[$mbox][] = $uid;
                 }
             }
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_attachment_handler.php roundcube-1.6.21+dfsg/program/include/rcmail_attachment_handler.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_attachment_handler.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_attachment_handler.php	2026-11-09 12:53:01.000000000 +0100
@@ -343,34 +343,24 @@
      */
     public static function check_storage_status()
     {
-        $error = rcmail::get_instance()->storage->get_error_code();
+        $rcmail = rcmail::get_instance();
+        $error = $rcmail->storage->get_error_code();
 
         // Check if we have a connection error
         if ($error == rcube_imap_generic::ERROR_BAD) {
             ob_end_clean();
 
-            // Get action is often executed simultaneously.
-            // Some servers have MAXPERIP or other limits.
-            // To workaround this we'll wait for some time
-            // and try again (once).
-            // Note: Random sleep interval is used to minimize concurrency
-            // in getting message parts
+            // Get action is often executed simultaneously. Some servers have MAXPERIP or other limits.
+            // To workaround this we'll wait for some time and try again (once).
 
-            if (!isset($_GET['_redirected'])) {
-                usleep(rand(10, 30) * 100000); // 1-3 sec.
-                header('Location: ' . $_SERVER['REQUEST_URI'] . '&_redirected=1');
-            }
-            else {
-                rcube::raise_error([
-                        'code' => 500, 'file' => __FILE__, 'line' => __LINE__,
-                        'message' => 'Unable to get/display message part. IMAP connection error'
-                    ],
-                    true, true
-                );
+            if (!empty($_GET['_redirected'])) {
+                $rcmail->raise_error('Unable to get/display message part. IMAP connection error', true, true);
             }
 
-            // Don't kill session, just quit (#1486995)
-            exit;
+            // Note: Random sleep interval is used to minimize concurrency in getting message parts
+            usleep(rand(10, 30) * 100000); // 1-3 sec.
+            parse_str($_SERVER['QUERY_STRING'], $req);
+            $rcmail->output->redirect($req + ['_redirected' => '1']);
         }
     }
 
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail.php roundcube-1.6.21+dfsg/program/include/rcmail.php
--- roundcube-1.6.20+dfsg/program/include/rcmail.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail.php	2026-11-09 12:53:01.000000000 +0100
@@ -244,8 +244,7 @@
         $task = $task == 'addressbook' ? 'contacts' : $task;
 
         // check access to disabled actions
-        $disabled_actions = (array) $this->config->get('disabled_actions');
-        if (in_array($task . '.' . ($this->action ?: 'index'), $disabled_actions)) {
+        if ($this->is_action_disabled($task, $this->action ?: 'index')) {
             self::raise_error(['code' => 404, 'message' => 'Action disabled'], true, true);
         }
 
@@ -256,7 +255,7 @@
 
             // check access to disabled actions (resolve an alias)
             if ($this->action && !empty($task_handler::$aliases[$this->action])) {
-                if (in_array($task . '.' . $task_handler::$aliases[$this->action], $disabled_actions)) {
+                if ($this->is_action_disabled($task, $task_handler::$aliases[$this->action])) {
                     self::raise_error(['code' => 404, 'message' => 'Action disabled'], true, true);
                 }
             }
@@ -318,6 +317,17 @@
     }
 
     /**
+     * Check if the action is disabled
+     */
+    public function is_action_disabled(string $task, string $action)
+    {
+        $disabled_actions = (array) $this->config->get('disabled_actions');
+
+        return in_array($task . '.' . str_replace('_', '-', $action), $disabled_actions)
+            || in_array($task . '.' . str_replace('-', '_', $action), $disabled_actions);
+    }
+
+    /**
      * Return instance of the internal address book class
      *
      * @param string $id        Address book identifier. It accepts also special values:
@@ -1010,6 +1020,9 @@
         }
         else if (empty($default_host)) {
             $host = rcube_utils::get_input_string('_host', rcube_utils::INPUT_POST);
+            if (!preg_match('~^((imap|imaps|tls|ssl)://)?[\w.-]+(:[0-9]+)?\z~', $host)) {
+                $host = null;
+            }
         }
         else {
             $host = rcube_utils::parse_host($default_host);
diff -Nru roundcube-1.6.20+dfsg/program/include/rcmail_sendmail.php roundcube-1.6.21+dfsg/program/include/rcmail_sendmail.php
--- roundcube-1.6.20+dfsg/program/include/rcmail_sendmail.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/include/rcmail_sendmail.php	2026-11-09 12:53:01.000000000 +0100
@@ -588,25 +588,29 @@
     public function header_received()
     {
         if ($this->rcmail->config->get('http_received_header')) {
-            $nldlm       = "\r\n\t";
             $http_header = 'from ';
+            $host = rcube_utils::server_name('HTTP_HOST');
+
+            // Only trusted hosts
+            if (!$this->rcmail->config->get('trusted_host_patterns')) {
+                $host = 'localhost';
+            }
 
             // FROM/VIA
-            if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-                $hosts        = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'], 2);
-                $http_header .= $this->received_host($hosts[0]) . $nldlm . ' via ';
+            if (($addr = rcube_utils::remote_addr()) && $addr != $_SERVER['REMOTE_ADDR']) {
+                $http_header .= $this->received_host($addr) . ' via ';
             }
 
             $http_header .= $this->received_host($_SERVER['REMOTE_ADDR']);
 
             // BY
-            $http_header .= $nldlm . 'by ' . rcube_utils::server_name('HTTP_HOST');
+            $http_header .= ' by ' . $host;
 
             // WITH
-            $http_header .= $nldlm . 'with HTTP (' . $_SERVER['SERVER_PROTOCOL']
+            $http_header .= ' with HTTP (' . $_SERVER['SERVER_PROTOCOL']
                 . ' ' . $_SERVER['REQUEST_METHOD'] . '); ' . date('r');
 
-            return wordwrap($http_header, 69, $nldlm);
+            return wordwrap($http_header, 69, "\r\n\t");
         }
     }
 
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_image.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_image.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_image.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_image.php	2026-11-09 12:53:01.000000000 +0100
@@ -318,6 +318,14 @@
         $rcube   = rcube::get_instance();
         $convert = self::getCommand('im_convert_path');
 
+        $props = $this->props();
+
+        // Note: We don't support types like svg or eps for security reasons
+        $valid_types = 'bmp,gif,ico,jp2,jpg,jpeg,png,png8,png24,png32,tif,tiff,webp';
+        if (!in_array($props['type'] ?? '', explode(',', $valid_types))) {
+            return false;
+        }
+
         if (!$filename) {
             $filename = $this->image_file;
 
@@ -362,8 +370,6 @@
         }
 
         // use GD extension (TIFF isn't supported)
-        $props = $this->props();
-
         // do we have enough memory? (#1489937)
         if (!$this->mem_check($props)) {
             return false;
@@ -413,6 +419,14 @@
     public static function is_convertable($mimetype = null)
     {
         $rcube = rcube::get_instance();
+        $mimetype = preg_replace('|^image/|i', '', $mimetype);
+        $mimetype = strtoupper($mimetype);
+        $mimetype = strtr($mimetype, ['PS' => 'EPS', 'EPT' => 'EPS']);
+
+        // For security reasons we do not support SVG and EPS
+        if ($mimetype == 'EPS' || $mimetype == 'SVG') {
+            return false;
+        }
 
         // @TODO: check if specified mimetype is really supported
         return class_exists('Imagick', false) || self::getCommand('im_convert_path');
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_imap_generic.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_imap_generic.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_imap_generic.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_imap_generic.php	2026-11-09 12:53:01.000000000 +0100
@@ -139,51 +139,54 @@
             return false;
         }
 
-        if ($endln) {
-            $string .= "\r\n";
-        }
-
         $res = 0;
-        if ($parts = preg_split('/(\{[0-9]+\}\r\n)/m', $string, -1, PREG_SPLIT_DELIM_CAPTURE)) {
-            for ($i = 0, $cnt = count($parts); $i < $cnt; $i++) {
-                if ($i + 1 < $cnt && preg_match('/^\{([0-9]+)\}\r\n$/', $parts[$i+1], $matches)) {
-                    // LITERAL+/LITERAL- support
-                    $literal_plus = false;
-                    if (
-                        !empty($this->prefs['literal+'])
-                        || (!empty($this->prefs['literal-']) && $matches[1] <= 4096)
-                    ) {
-                        $parts[$i+1] = sprintf("{%d+}\r\n", $matches[1]);
-                        $literal_plus = true;
-                    }
+        $position = 0;
+        $len = 0;
 
-                    $bytes = $this->putLine($parts[$i].$parts[$i+1], false, $anonymized);
-                    if ($bytes === false) {
-                        return false;
-                    }
+        while (preg_match('/\{([0-9]+)\}\r\n/m', $string, $matches, \PREG_OFFSET_CAPTURE, $position + $len) === 1) {
+            $match = $matches[0][0]; // the whole match
+            $match_position = $matches[0][1]; // position of the match
+            $match_len = strlen($match); // length of the whole match
+            $len = (int) $matches[1][0]; // length of the next literal
 
-                    $res += $bytes;
+            // LITERAL+/LITERAL- support
+            $literal_plus = !empty($this->prefs['literal+']) || (!empty($this->prefs['literal-']) && $len <= 4096);
 
-                    // don't wait if server supports LITERAL+ capability
-                    if (!$literal_plus) {
-                        $line = $this->readLine(1000);
-                        // handle error in command
-                        if (!isset($line[0]) || $line[0] != '+') {
-                            return false;
-                        }
-                    }
+            if ($literal_plus) {
+                $match = str_replace('}', '+}', $match);
+            }
 
-                    $i++;
-                }
-                else {
-                    $bytes = $this->putLine($parts[$i], false, $anonymized);
-                    if ($bytes === false) {
-                        return false;
-                    }
+            $line = substr($string, $position, $match_position - $position) . $match;
+
+            $bytes = $this->putLine($line, false, $anonymized);
+            if ($bytes === false) {
+                return false;
+            }
+
+            $res += $bytes;
 
-                    $res += $bytes;
+            if (!$literal_plus) {
+                $line = $this->readLine(1000);
+                // handle error in command
+                if (!isset($line[0]) || $line[0] != '+') {
+                    return false;
                 }
             }
+
+            $position = $match_position + $match_len;
+        }
+
+        if ($endln) {
+            $string .= "\r\n";
+        }
+
+        if ($position < strlen($string)) {
+            $bytes = $this->putLine($position ? substr($string, $position) : $string, false, $anonymized);
+            if ($bytes === false) {
+                return false;
+            }
+
+            $res += $bytes;
         }
 
         return $res;
@@ -1927,10 +1930,9 @@
         }
 
         $encoding = $encoding ? trim($encoding) : 'US-ASCII';
-        $criteria = $criteria ? 'ALL ' . trim($criteria) : 'ALL';
 
         list($code, $response) = $this->execute($return_uid ? 'UID SORT' : 'SORT',
-            ["($field)", $encoding, $criteria]);
+            ["({$field})", $encoding, $criteria ?: 'ALL']);
 
         if ($code != self::ERROR_OK) {
             $response = null;
@@ -1965,10 +1967,9 @@
 
         $encoding  = $encoding ? trim($encoding) : 'US-ASCII';
         $algorithm = $algorithm ? trim($algorithm) : 'REFERENCES';
-        $criteria  = $criteria ? 'ALL '.trim($criteria) : 'ALL';
 
         list($code, $response) = $this->execute($return_uid ? 'UID THREAD' : 'THREAD',
-            [$algorithm, $encoding, $criteria]);
+            [$algorithm, $encoding, $criteria ?: 'ALL']);
 
         if ($code != self::ERROR_OK) {
             $response = null;
@@ -2007,7 +2008,6 @@
         }
 
         $esearch  = empty($items) ? false : $this->getCapability('ESEARCH');
-        $criteria = trim($criteria);
         $params   = '';
 
         // RFC4731: ESEARCH
@@ -2082,7 +2082,7 @@
                 return false;
             }
         }
-        else if (empty($message_set)) {
+        elseif (empty($message_set) || preg_match('/[^0-9:,*]/', (string) $message_set)) {
             return false;
         }
         else if (strpos($message_set, ':')) {
@@ -2829,6 +2829,10 @@
      */
     public function fetchMIMEHeaders($mailbox, $uid, $parts, $mime = true)
     {
+        if (preg_match('/[^0-9:,*]/', (string) $uid)) {
+            return false;
+        }
+
         if (!$this->select($mailbox)) {
             return false;
         }
@@ -2840,7 +2844,8 @@
 
         // format request
         foreach ($parts as $part) {
-            $peeks[] = "BODY.PEEK[$part.$type]";
+            $part = preg_replace('/[\r\n]+/', ' ', (string) $part); // sanitize input
+            $peeks[] = "BODY.PEEK[{$part}.{$type}]";
         }
 
         $request = "$key UID FETCH $uid (" . implode(' ', $peeks) . ')';
@@ -2885,12 +2890,20 @@
     public function handlePartBody($mailbox, $id, $is_uid = false, $part = '', $encoding = null, $print = null,
         $file = null, $formatted = false, $max_bytes = 0)
     {
+        if (preg_match('/[^0-9:,*]/', (string) $id)) {
+            return false;
+        }
+
         if (!$this->select($mailbox)) {
             return false;
         }
 
         $binary    = true;
         $initiated = false;
+        $result = false;
+        $found = false;
+        $mode = 0;
+        $part = preg_replace('/[\r\n]+/', ' ', (string) $part); // sanitize input
 
         do {
             if (!$initiated) {
@@ -2912,7 +2925,7 @@
                 }
 
                 // Use BINARY extension when possible (and safe)
-                $binary     = $binary && $mode && preg_match('/^[0-9.]+$/', (string) $part) && $this->hasCapability('BINARY');
+                $binary     = $binary && $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY');
                 $fetch_mode = $binary ? 'BINARY' : 'BODY';
                 $partial    = $max_bytes ? sprintf('<0.%d>', $max_bytes) : '';
 
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_message.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_message.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_message.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_message.php	2026-11-09 12:53:01.000000000 +0100
@@ -82,6 +82,9 @@
      */
     function __construct($uid, $folder = null, $is_safe = false)
     {
+        // Sanitize the input for security
+        $uid = preg_replace('/[\r\n]+/', ' ', (string) $uid);
+
         // decode combined UID-folder identifier
         if (preg_match('/^[0-9.]+-.+/', $uid)) {
             list($uid, $folder) = explode('-', $uid, 2);
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube.php	2026-11-09 12:53:01.000000000 +0100
@@ -1052,7 +1052,7 @@
         }
 
         // skip empty requests
-        if (($mode == rcube_utils::INPUT_POST && empty($_POST))
+        if (($mode == rcube_utils::INPUT_POST && empty($_POST) && empty($_FILES))
             || ($mode == rcube_utils::INPUT_GET && empty($_GET))
         ) {
             return true;
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_session.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_session.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_session.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_session.php	2026-11-09 12:53:01.000000000 +0100
@@ -562,6 +562,9 @@
                         for ($length=''; ($q < $endptr) && ($str[$q] != ':'); $q++) {
                             $length .= $str[$q];
                         }
+                        if (((int) $length) < 0) {
+                            throw new \Exception('Invalid session data');
+                        }
                         $q+=2;
                         $q+= (int)$length + 2;
                         $serialized .= substr($str, $p, $q - $p);
diff -Nru roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_utils.php roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_utils.php
--- roundcube-1.6.20+dfsg/program/lib/Roundcube/rcube_utils.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/program/lib/Roundcube/rcube_utils.php	2026-11-09 12:53:01.000000000 +0100
@@ -1,5 +1,6 @@
 <?php
 
+use IPLib\Address\AddressInterface;
 use IPLib\Factory;
 use IPLib\ParseStringFlag;
 
@@ -301,7 +302,7 @@
      */
     public static function is_simple_string($input)
     {
-        return is_string($input) && !!preg_match('/^[\w.-]+$/i', $input);
+        return is_string($input) && strlen($input) && !preg_match('/[^\w.-]/i', $input);
     }
 
     /**
@@ -441,15 +442,8 @@
 
             $host = trim($host, '[].');
 
-            if (preg_match('/([0-9a-f.-]+)\.(nip|sslip)\.io$/i', $host, $matches)) {
-                $host = $matches[1];
-                if (preg_match('/([0-9]{1,3}([.-][0-9]{1,3}){3})$/', $host, $m)) {
-                    $host = str_replace('-', '.', $m[1]); // IPv4
-                } elseif (preg_match('/^([0-9a-f]{8})$/i', $host, $m)) {
-                    $host = long2ip(base_convert($m[1], 16, 10)); // Hexadecimal
-                } else {
-                    $host = str_replace('-', ':', $host); // IPv6
-                }
+            if ($xip = self::xip_ip($host)) {
+                $host = $xip;
             }
 
             // TODO: This is pretty fast, but a single message can contain multiple links
@@ -472,14 +466,12 @@
                     '64:ff9b:1::/48'  // (RFC 8215 local-use NAT64) 
                 ];
 
-                foreach ($nets as $net) {
-                    $range = Factory::parseRangeString($net);
-                    if ($range->contains($address)) {
-                        return true;
-                    }
+                // Extract embedded IPv4 address
+                if ($address instanceof \IPLib\Address\IPv6 && ($embedded = $address->toIPv4())) {
+                    $address = $embedded;
                 }
 
-                return false;
+                return self::is_ip_in_range($address, $nets);
             }
 
             // FIXME: Should we accept any non-fqdn hostnames?
@@ -491,6 +483,96 @@
     }
 
     /**
+     * Check if an IP address matches an entry in the given whitelist.
+     * Entries may be exact IP addresses or CIDR ranges (e.g. '10.0.0.0/8', 'fc00::/7').
+     *
+     * @param string|AddressInterface $ip        IP address to check
+     * @param array                   $whitelist List of IPs or CIDR ranges
+     */
+    private static function is_ip_in_range($ip, array $whitelist): bool
+    {
+        if (empty($whitelist)) {
+            return false;
+        }
+
+        if ($ip instanceof AddressInterface) {
+            $address = $ip;
+            $ip = (string) $ip;
+        } else {
+            $address = Factory::parseAddressString($ip);
+        }
+
+        foreach ($whitelist as $entry) {
+            if ($entry === $ip) {
+                return true;
+            }
+            if ($address && ($range = Factory::parseRangeString($entry)) && $range->contains($address)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Extract IP address from a nip.io/sslip.io-style fqdn
+     *
+     * @return ?string IP address if found
+     */
+    private static function xip_ip(string $host)
+    {
+        if (!preg_match('/\.(backname\.io|fdns\.uk|ipq\.co|nip\.io|sslip\.io|traefik\.me)$/i', $host)) {
+            return null;
+        }
+
+        // IPv4 dash-separated
+        $ipv4REDashes = '/(^|[.-])(((25[0-5]|(2[0-4]|1\d|[1-9])?\d)\-){3}(25[0-5]|(2[0-4]|1\d|[1-9])?\d))($|[.-])/';
+        if (preg_match($ipv4REDashes, $host, $m)) {
+            return str_replace('-', '.', $m[2]);
+        }
+
+        // IPv4 dot-separated
+        $ipv4REDots = '/(^|[.-])(((25[0-5]|(2[0-4]|1\d|[1-9])?\d)\.){3}(25[0-5]|(2[0-4]|1\d|[1-9])?\d))($|[.-])/';
+        if (preg_match($ipv4REDots, $host, $m)) {
+            return str_replace('-', '.', $m[2]);
+        }
+
+        // IPv4 hex
+        $ipv4REHex = '/(^|[.-])([[:xdigit:]]{8})($|[.-])/';
+        if (preg_match($ipv4REHex, $host, $m)) {
+            return long2ip(base_convert($m[2], 16, 10));
+        }
+
+        // IPv6 dash-separated
+        $ipv6RE = '/(^|[.-])(([[:xdigit:]]{1,4}-){7}[[:xdigit:]]{1,4}|([[:xdigit:]]{1,4}-){1,7}-'
+            . '|([[:xdigit:]]{1,4}-){1,6}-[[:xdigit:]]{1,4}|([[:xdigit:]]{1,4}-){1,5}(-[[:xdigit:]]{1,4}){1,2}'
+            . '|([[:xdigit:]]{1,4}-){1,4}(-[[:xdigit:]]{1,4}){1,3}|([[:xdigit:]]{1,4}-){1,3}(-[[:xdigit:]]{1,4}){1,4}'
+            . '|([[:xdigit:]]{1,4}-){1,2}(-[[:xdigit:]]{1,4}){1,5}|[[:xdigit:]]{1,4}-((-[[:xdigit:]]{1,4}){1,6})'
+            . '|-((-[[:xdigit:]]{1,4}){1,7}|-)|fe80-(-[[:xdigit:]]{0,4}){0,4}%[\da-zA-Z]+'
+            . '|--(ffff(-0{1,4})?-)?((25[0-5]|(2[0-4]|1?\d)?\d)\.){3}(25[0-5]|(2[0-4]|1?\d)?\d)'
+            . '|([[:xdigit:]]{1,4}-){1,4}-((25[0-5]|(2[0-4]|1?\d)?\d)\.){3}(25[0-5]|(2[0-4]|1?\d)?\d))($|[.-])/';
+        if (preg_match($ipv6RE, $host, $m)) {
+            return str_replace('-', ':', $m[2]);
+        }
+
+        // IPv6 dot-separated (backname.io)
+        $ipv6REDots = '/(^|\.)(([[:xdigit:]]{1,4}\.){7}[[:xdigit:]]{1,4})($|\.)/';
+        if (preg_match($ipv6REDots, $host, $m)) {
+            return str_replace('.', ':', $m[2]);
+        }
+
+        // IPv6 hex
+        $ipv6REHex = '/(^|\.)([[:xdigit:]]{32})($|\.)/';
+        if (preg_match($ipv6REHex, $host, $m)) {
+            $words = str_split($m[2], 2);
+            $words = array_map('hex2bin', $words);
+            return (string) \IPLib\Address\IPv6::fromWords($words);
+        }
+
+        return null;
+    }
+
+    /**
      * Replace all css definitions with #container [def]
      * and remove css-inlined scripting, make position style safe
      *
@@ -1643,8 +1725,8 @@
                 $default_port = 443;
             }
 
-            $host = $_SERVER['HTTP_HOST'] ?? '';
-            $port = $_SERVER['SERVER_PORT'] ?? 0;
+            $host = self::server_name('HTTP_HOST', false);
+            $port = parse_url($host, \PHP_URL_PORT);
 
             $prefix = $schema . '://' . preg_replace('/:\d+$/', '', $host);
             if ($port && $port != $default_port && $port != 80) {
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/Changelog roundcube-1.6.21+dfsg/public_html/plugins/managesieve/Changelog
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/Changelog	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/Changelog	2026-11-09 12:53:01.000000000 +0100
@@ -8,6 +8,9 @@
 - Fix infinite loop when parsing a malformed script (#9562)
 - Fix current script state after initial scripts creation in managesieve_kolab_master mode
 - Fix match-type selector (remove unsupported options) in delete header action (#9610)
+- Fix bug where some managesieve destructive actions could have been triggered cross-site via GET
+- Fix Sieve script injection via a rule operator
+- Fix Sieve script injection via set/include modifiers
 
 * version 9.4 [2021-06-06]
 -----------------------------------------------------------
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php	2026-11-09 12:53:01.000000000 +0100
@@ -279,7 +279,7 @@
 
         // Handle user requests
         if ($action = rcube_utils::get_input_string('_act', rcube_utils::INPUT_GPC)) {
-            $fid = (int) rcube_utils::get_input_value('_fid', rcube_utils::INPUT_POST);
+            $fid = rcube_utils::get_input_string('_fid', rcube_utils::INPUT_POST);
 
             if ($action == 'delete' && !$error) {
                 if (!in_array('delete_filter', $this->disabled_actions)) {
diff -Nru roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php
--- roundcube-1.6.20+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/public_html/plugins/managesieve/lib/Roundcube/rcube_sieve_script.php	2026-11-09 12:53:01.000000000 +0100
@@ -22,7 +22,10 @@
 
 class rcube_sieve_script
 {
-    public $content = [];      // script rules array
+    public const SET_OPTIONS = ['lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length', 'encodeurl'];
+    public const INCLUDE_OPTIONS = ['once', 'optional', 'global', 'personal'];
+
+    public $content = []; // script rules array
 
     private $vars      = [];   // "global" variables
     private $prefix    = '';   // script header (comments)
@@ -480,19 +483,13 @@
 
                     case 'include':
                         array_push($exts, 'include');
-                        $action_script .= 'include ';
-                        foreach (array_diff(array_keys($action), ['target', 'type']) as $opt) {
-                            $action_script .= ":$opt ";
-                        }
+                        $action_script .= 'include ' . $this->bool_options($action, self::INCLUDE_OPTIONS);
                         $action_script .= self::escape_string($action['target']);
                         break;
 
                     case 'set':
                         array_push($exts, 'variables');
-                        $action_script .= 'set ';
-                        foreach (array_diff(array_keys($action), ['name', 'value', 'type']) as $opt) {
-                            $action_script .= ":$opt ";
-                        }
+                        $action_script .= 'set ' . $this->bool_options($action, self::SET_OPTIONS);
                         $action_script .= self::escape_string($action['name']) . ' ' . self::escape_string($action['value']);
                         break;
 
@@ -969,7 +966,6 @@
                 $action  = ['type' => $token, 'target' => array_pop($tokens)];
                 $args    = ['copy'];
                 $action += $this->action_arguments($tokens, $args);
-
                 $result[] = $action;
                 break;
 
@@ -978,7 +974,6 @@
                 $args    = ['mime'];
                 $vargs   = ['seconds', 'days', 'addresses', 'subject', 'handle', 'from'];
                 $action += $this->action_arguments($tokens, $args, $vargs);
-
                 $result[] = $action;
                 break;
 
@@ -1007,16 +1002,14 @@
 
             case 'include':
                 $action  = ['type' => 'include', 'target' => array_pop($tokens)];
-                $args    = ['once', 'optional', 'global', 'personal'];
-                $action += $this->action_arguments($tokens, $args);
+                $action += $this->action_arguments($tokens, self::INCLUDE_OPTIONS);
 
                 $result[] = $action;
                 break;
 
             case 'set':
                 $action  = ['type' => 'set', 'value' => array_pop($tokens), 'name' => array_pop($tokens)];
-                $args    = ['lower', 'upper', 'lowerfirst', 'upperfirst', 'quotewildcard', 'length'];
-                $action += $this->action_arguments($tokens, $args);
+                $action += $this->action_arguments($tokens, self::SET_OPTIONS);
 
                 $result[] = $action;
                 break;
@@ -1139,7 +1132,7 @@
      */
     private function add_operator($test, &$out, &$exts)
     {
-        if (empty($test['type'])) {
+        if (empty($test['type']) || !preg_match('/^[a-z-]+$/', $test['type'])) {
             return;
         }
 
@@ -1161,6 +1154,22 @@
     }
 
     /**
+     * Create command options string
+     */
+    private function bool_options($options, $keys)
+    {
+        $out = '';
+
+        foreach ($keys as $opt) {
+            if (isset($options[$opt])) {
+                $out .= ":{$opt} ";
+            }
+        }
+
+        return $out;
+    }
+
+    /**
      * Extract test tokens
      */
     private function test_tokens(&$tokens)
diff -Nru roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderExpunge.php roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderExpunge.php
--- roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderExpunge.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderExpunge.php	2026-11-09 12:53:01.000000000 +0100
@@ -105,4 +105,25 @@
         $this->assertSame('expunge', $result['action']);
         $this->assertSame('this.display_message("Unable to perform operation. Folder is read-only.","error",0);', trim($result['exec']));
     }
+
+    /**
+     * Test security check (folder is required)
+     */
+    public function test_run_empty_post()
+    {
+        $action = new rcmail_action_mail_folder_expunge();
+        $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'expunge');
+
+        $this->assertTrue($action->checks());
+
+        $_POST = [];
+
+        $this->runAndAssert($action, OutputJsonMock::E_EXIT);
+
+        $result = $output->getOutput();
+
+        $this->assertContains('Content-Type: application/json; charset=UTF-8', $output->headers);
+        $this->assertSame('expunge', $result['action']);
+        $this->assertStringContainsString('this.display_message("An internal error occurred', $result['exec']);
+    }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderPurge.php roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderPurge.php
--- roundcube-1.6.20+dfsg/tests/Actions/Mail/FolderPurge.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Actions/Mail/FolderPurge.php	2026-11-09 12:53:01.000000000 +0100
@@ -8,12 +8,23 @@
 class Actions_Mail_FolderPurge extends ActionTestCase
 {
     /**
-     * Class constructor
+     * Test security check (folder is required)
      */
-    function test_class()
+    public function test_run_empty_post()
     {
-        $object = new rcmail_action_mail_folder_purge;
+        $action = new rcmail_action_mail_folder_purge();
+        $output = $this->initOutput(rcmail_action::MODE_AJAX, 'mail', 'purge');
 
-        $this->assertInstanceOf('rcmail_action', $object);
+        $this->assertTrue($action->checks());
+
+        $_POST = [];
+
+        $this->runAndAssert($action, OutputJsonMock::E_EXIT);
+
+        $result = $output->getOutput();
+
+        $this->assertContains('Content-Type: application/json; charset=UTF-8', $output->headers);
+        $this->assertSame('purge', $result['action']);
+        $this->assertStringContainsString('this.display_message("An internal error occurred', $result['exec']);
     }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Framework/Session.php roundcube-1.6.21+dfsg/tests/Framework/Session.php
--- roundcube-1.6.20+dfsg/tests/Framework/Session.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Framework/Session.php	2026-11-09 12:53:01.000000000 +0100
@@ -42,5 +42,9 @@
             ['ok' => true, 'name' => 'me', 'int' => 34],
             $session->unserialize('ok|b:1;name|s:2:"me";int|i:34;')
         );
+
+        // Infinit loop fix
+        $this->expectException(\Exception::class);
+        $this->assertSame([], $session->unserialize('k1|s:-100:"x";'));
     }
 }
diff -Nru roundcube-1.6.20+dfsg/tests/Framework/Utils.php roundcube-1.6.21+dfsg/tests/Framework/Utils.php
--- roundcube-1.6.20+dfsg/tests/Framework/Utils.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Framework/Utils.php	2026-11-09 12:53:01.000000000 +0100
@@ -548,6 +548,8 @@
     function test_is_simple_string()
     {
         $this->assertTrue(rcube_utils::is_simple_string('some-thing.123_'));
+        $this->assertTrue(rcube_utils::is_simple_string('AAAA.BBBB-cccc_ddd'));
+        $this->assertFalse(rcube_utils::is_simple_string("test\n"));
         $this->assertFalse(rcube_utils::is_simple_string(''));
         $this->assertFalse(rcube_utils::is_simple_string(' '));
         $this->assertFalse(rcube_utils::is_simple_string('some–thing'));
@@ -557,7 +559,7 @@
         $this->assertFalse(rcube_utils::is_simple_string('%20'));
         $this->assertFalse(rcube_utils::is_simple_string('\0000'));
         $this->assertFalse(rcube_utils::is_simple_string(1));
-        $this->assertFalse(rcube_utils::is_simple_string(new stdClass()));
+        $this->assertFalse(rcube_utils::is_simple_string(new \stdClass()));
         $this->assertFalse(rcube_utils::is_simple_string(null));
     }
 
@@ -619,6 +621,14 @@
             ['http://127-0-0-1.nip.io', true],
             ['http://127-0-0-1.nip.io.', true],
             ['http://7F000001.nip.io/', true],
+            ['http://127.0.0.1.2.nip.io', true], // 127.0.0.1
+            ['http://0.0.0.0.0.ffff.7f00.1.backname.io', true],
+            ['http://x.127.0.0.1.nip.io', true],
+            ['http://x.0a000001.nip.io/', true],
+            ['http://x.c0a80101.nip.io/', true],
+            ['http://x.a9fea9fe.nip.io/', true],
+            ['http://x.0-0-0-0-0-0-0-0-1.sslip.io/', true],
+            ['http://0-0-0-0-0-0-0-0-1.sslip.io/', true],
             ['http://metadata.google.internal', true],
             ['http://127.0.0.1.sslip.io/', true],
             ['http://[0:0:0:0:0:ffff:127.0.0.1]/', true],
@@ -633,6 +643,8 @@
             ['http://[64:ff9b:1::]/', true],
             ['http://[64:ff9b::a9fe:a9fe]/', true],
             ['http://[64:ff9b::7f00:1]/', true],
+            ['http://[2002:a9fe:a9fe::]/', true],
+            ['http://[2002:7f00:1::]/', true],
             // Non-local hosts
             ['http://[2001:470::76:0:0:0:2]', false],
             ['http://domain.tld', false],
diff -Nru roundcube-1.6.20+dfsg/tests/Rcmail/Rcmail.php roundcube-1.6.21+dfsg/tests/Rcmail/Rcmail.php
--- roundcube-1.6.20+dfsg/tests/Rcmail/Rcmail.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Rcmail/Rcmail.php	2026-11-09 12:53:01.000000000 +0100
@@ -125,6 +125,7 @@
     function test_url()
     {
         $rcmail = rcmail::get_instance();
+        $rcmail->config->set('trusted_host_patterns', []);
 
         $this->assertEquals(
             '/sub/?_task=cli&_action=test',
@@ -187,9 +188,8 @@
         $rcmail->config->set('request_path', null);
 
         $_SERVER['HTTPS'] = false;
-        $_SERVER['SERVER_PORT'] = '8080';
         $this->assertEquals(
-            'http://mail.example.org:8080/?_task=cli&_action=test&_mode=ABS',
+            'http://mail.example.org/?_task=cli&_action=test&_mode=ABS',
             $rcmail->url(['_action' => 'test', '_mode' => 'ABS'], true, true),
             "Full URL with port"
         );
diff -Nru roundcube-1.6.20+dfsg/tests/Rcmail/Sendmail.php roundcube-1.6.21+dfsg/tests/Rcmail/Sendmail.php
--- roundcube-1.6.20+dfsg/tests/Rcmail/Sendmail.php	2026-10-19 08:49:43.000000000 +0200
+++ roundcube-1.6.21+dfsg/tests/Rcmail/Sendmail.php	2026-11-09 12:53:01.000000000 +0100
@@ -63,7 +63,43 @@
      */
     function test_header_received()
     {
-        $this->markTestIncomplete();
+        $_SERVER['REMOTE_ADDR'] = '1.2.3.4';
+        $_SERVER['HTTP_X_FORWARDED_FOR'] = '203.0.113.5';
+        $_SERVER['HTTP_X_REAL_IP'] = '';
+        $_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0';
+        $_SERVER['REQUEST_METHOD'] = 'GET';
+
+        $sendmail = new \rcmail_sendmail();
+        $config = \rcmail::get_instance()->config;
+
+        $config->set('http_received_header', false);
+        $config->set('http_received_header_encrypt', false);
+        $config->set('proxy_whitelist', []);
+
+        // Disabled option
+        $header = $sendmail->header_received();
+        $this->assertNull($header);
+
+        // Enabled option
+        $config->set('http_received_header', true);
+        $this->assertStringStartsWith(
+            'from [1.2.3.4] by localhost with HTTP (HTTP/1.0 GET);',
+            $sendmail->header_received()
+        );
+
+        // With whitelisted proxy
+        $config->set('proxy_whitelist', ['1.2.3.4']);
+        $this->assertStringStartsWith(
+            "from [203.0.113.5] via [1.2.3.4] by localhost with HTTP (HTTP/1.0\r\n\tGET);",
+            $sendmail->header_received()
+        );
+
+        // Encrypted
+        $config->set('http_received_header_encrypt', true);
+        $this->assertMatchesRegularExpression(
+            '|^from [0-9a-zA-Z=/+]+ via [0-9a-zA-Z=/+]+ by\r\n\tlocalhost with HTTP|',
+            $sendmail->header_received()
+        );
     }
 
     /**
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-roundcube-maintainers/attachments/20261115/fa8fde3e/attachment-0001.sig>


More information about the Pkg-roundcube-maintainers mailing list