Forwarded message sends the WRONG attachment after changing the sender
I maintainer di solito rispondono entro 1 giorno
@GretaD ci sta già lavorando.
Dal 30/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Steps to reproduce
Forward an email that has attachments, then change the sender (alias) before sending.
The message is sent with a different attachment than the one displayed — a file
the user never selected, attached, or downloaded. This is a data-confidentiality
issue: the wrong file (potentially another message's attachment) can be transmitted
to the recipient.
- Open a received email that has one or more attachments.
- Forward it. The original attachments are shown attached to the forward.
- Change the From / sender alias on the compose form.
- Send.
- The sent message (check Sent folder) carries a different attachment than the one shown in the composer.
Expected behavior
The correct Attachment(s) should be sent
Actual behavior
Observed on this instance (server-side evidence)
From nextcloud.log, a forward (subject "Fwd: …", account_id 13) during an active
sender change:
| Time (UTC) | Request | Result |
|---|---|---|
| 12:30:41 | POST /api/drafts |
InvalidArgumentException: Attachment does not have a type (LocalMessage 131) |
| 12:31:10 | POST /api/drafts |
same error (LocalMessage 132) |
The draft auto-save threw (same type-missing path as Bug #1), but the send path is
separate and did not error, so the message was sent anyway — with a substituted
attachment.
Root cause (analysis)
Forwarded attachments are not copied at forward time. They are stored as a
reference and fetched lazily from IMAP at draft-save / send time:
// AttachmentService::handleForwardedAttachment (lines 376-401)
$mailbox = $this->mailManager->getMailbox($account->getUserId(), $attachment['mailboxId']);
$imapAttachment = $this->messageMapper->getAttachment(
$client,
$mailbox->getName(),
(int)$attachment['uid'], // source IMAP UID
$attachment['id'], // MIME part id
$account->getUserId(),
);
The reference is {mailboxId, uid, part-id}. IMAP UIDs and MIME part-ids are not
content-pinned: they identify a coordinate, not a file. When the sender/alias is
changed, the whole local message is re-serialized and these references are re-resolved
against IMAP. If the re-sent reference points at a different UID/part than the original
(stale frontend state, UIDVALIDITY change, part-id collision, or the same type-loss
corruption from Bug #1 mangling the attachment descriptor), getAttachment() returns
whatever file currently lives at that coordinate — which may be an unrelated
message's attachment. That file is then attached and sent.
Impact
- Confidentiality: a file the sender never selected can be transmitted to a third
party. If the substituted file belongs to a different message, this is an
unintended disclosure. - Silent: the send path does not surface the draft-save error to the user.
Suggested fixes
- Materialize forwarded attachments into local storage at forward time (as Bug #1's
local uploads are), rather than resolving an IMAP coordinate at send time; or pin the
reference to an immutable identifier (UIDVALIDITY + UID + part, validated before
fetch). - Make
handleAttachments()tolerant of a missingtypefor already-persisted
attachments instead of throwing, and treat any unresolved reference as a hard send
failure (never silently substitute). - Do not let a draft-save attachment error be bypassed by the send path.
Workaround
Do not change the sender/alias on a forward (or any message) that carries attachments.
On this instance the Mail app has been disabled pending a fix.
Mail app version
5.10.3
Nextcloud version
34.0.0.12
Mailserver or service
Exim4 and Dovecot
Operating system
Debian (Linux 6.12) / Docker (nextcloud:34-apache)
PHP engine version
Other
Nextcloud memory caching
Memcache
Web server
Apache (supported)
Database
MariaDB
Additional info
PHP 8.4.22, Apache
Accounts authenticated via IMAP/SMTP (app-password); LDAP backend for user accounts
MariaDB 11.8
- Lingua principale
- JavaScript
- Stelle
- 1.1k
- Fork
- 373
- Merge medio
- 1g 8h
- PR unite (30g)
- 108
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nextcloud/mail
-
Global Mail search fails for Message-IDs containing '/' when generating deep linksForse già presa @SoleroTG l’ha presa oggi. Aperta1. to develop bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
nextcloud/mail#13970 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
1. to develop bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nextcloud/mail#13950 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
1. to develop bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
nextcloud/mail#13922 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
1. to develop enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
nextcloud/mail#13903 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: Need a close preview button/option in mail viewForse già presa @steven-mpawulo l’ha presa 14 giorni fa. Aperta1. to develop enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
nextcloud/mail#13841 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di nextcloud/mail
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
riverqueue/river#1576 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
modrollstudio/Modroll-Studio-Website#80 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
mafzalkalwardev/mailforge#21 ·
-
good first issue help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100