Repository navigation
feat: reply from the address mail was sent to - #328
Conversation
KyPost-Server #665 reports where native mail was delivered, so a reply to a plus or masked address must not reveal the primary. Reply now defaults its From to that address, and when the server cannot tell, Compose makes the user choose before it sends or saves. Part of #324 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process: ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪🧪 PR contains tests🔒 No security concerns identified⚡ Recommended focus areas for reviewReply Delay, Double Open The Reply click handler now awaits Advisory only: this comment never gates the pull request. |
Security review - clearedDetail withheld: this repository is public, and posting an unfixed finding here would be public disclosure. The full report was posted to the hand-off board at https://myslop.urlxl.us/f/pr-reviewer-busnes-app-kypost-for-android-328, where it is readable by the operator and expires seven days after the last post. gpt-6.1-sol using security-audit on behalf of Yoshi |
Autonomous review - 1/1 personas cleared
Merging remains a human decision; this bot never approves. gpt-6.1-sol using security-audit on behalf of Yoshi |
/api/mail/draft stores no From, so a server-held-key draft saved with a masked or tagged From reopened as the primary address. Save draft is now refused there unless From is blank or the primary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With an empty address list (a relay without native mailboxes) a required From blocked Send, Save draft and the handoff, and the picker had nothing to offer. fromPickPending now lets the account default stand, and the picker clears the requirement instead of a bare toast. plainDraftKeepsFrom kept refusing on that empty list too; it now keeps the From. An unloaded list is loaded before Save draft decides, rather than refused, so a masked From is still never saved as the primary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude-opus-5-5 using pull-request on behalf of Yoshi |
Both features kept: Compose sends carry the chosen From and the sendDelay flag, MailSource and MailRepository gain ownAddresses and sendDelaySeconds side by side, and the docs list /api/mailboxes with /api/mail/send-delay and /api/scheduled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts were side-by-side additions; both kept: - CHANGELOG.md: conversations entry, then the reply From entry. - app/AGENTS.md: relay endpoint list gains /api/inbox/conversations, /api/settings/mail and /api/mailboxes. - MailRepository/MailSource/RelayMailSource: conversation fetch and mail-settings calls next to ownAddresses() and replyFrom(). - RelayModels: conversation and mail-settings DTOs next to the mailboxes DTOs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #324 (part 4: reply identity. Conversations is #326, send delay is #327. The optional masked-address management screen is not in this PR.)
In one line: Reply and Reply all now send from the address the message was delivered to (a
you+tag@or masked address). When the server cannot tell which one, the user must pick a From before the reply can be sent or saved. It never falls back to the main address.What changed
GET /api/mail/bodyfordeliveredTo(the receipt's addresses, Bcc included) andGET /api/mailboxesfor the primary mailbox's addresses (masked ones included). It then applies the web client's rule (replyFromAddressinfrontend/src/pages/read/compose.ts):Mail with no receipt (external IMAP) uses your own To/Cc address, or the account default as before.
CachedDraft). Edit draft reopens with the draft's own From, or asks if it has none.fromon/api/mail/send, and as the From of client-encrypted deliveries and encrypted drafts. The server still checks that the address belongs to the account.Review this
replyFromAddressandMailRepository.replyFrom. Every "the server can't tell" path must come out null, never "". The one exception is the deliberate no-receipt case.ComposeActivity.fromChosenand its callers (send, Save draft, web handoff). This is the gate that keeps the primary address out.Checked: the repository's required checks all pass locally (commands below). There are new unit tests and one new instrumentation test.
Not checked: I did not run the instrumentation tests. The Android emulator segfaults on Major, so GitHub CI runs them. Nothing was tested against a live server with masked addresses.
Decided for you
/api/mail/draft, server-held key) have nofromfield on the server, so they reopen as the primary address. Save draft is therefore refused there unless From is blank or the primary address: "Drafts can't keep this From address. Send it now, or switch From to your main address to save it." The security reviewer found this gap and the second commit closes it. Storing the From with plain drafts needs a server change. Encrypted drafts carry their From.You need to: nothing.
Detail
By area
deliveredToonRelayMessageBodyDtoandMailMessageBody(null when absent).ownAddressesreads the primary mailbox from/api/mailboxes; a 404 or an empty list means none.replyFrom. Without a receipt, an unknown address list falls back to the default, because nothing there can be masked. With a receipt it gives null.plusBaseandreplyFromAddressinAddressText.kt.EXTRA_FROMandEXTRA_FROM_REQUIREDare read only from in-app launches (ComposePrefill), so another app cannot choose the From. Added statecomposeFrom/fromRequired/ownAddresses, the From row and the picker.app/src/main/AGENTS.md(contract), theapp/AGENTS.mdendpoint list, and CHANGELOG.Tests
AddressTextTest(+5):plusBase; keeps the tag the sender used; masked delivered as Bcc; null when no delivered address is yours, never the primary; with no receipt, your header address or the default.MailRepositoryTest(+1): delivered gives the tagged From; a failed body fetch gives null; unknown addresses with a receipt give null; no receipt gives "".RelayMailSourceTest(+2):deliveredToread, blank entries dropped, absent read as null; the primary mailbox's addresses, none without native mail, 404 gives none, 503 is a failure.PlainDraftFromTest(3): blank or primary is kept; a masked or tagged From is refused; unknown addresses refuse.ComposeDraftCacheTest(+1): a restored draft still owes its From.ComposeIntentParserTest(instrumentation, +1): From and its requirement come from in-app launches only.Commands (Major, each batch capped with
systemd-run -p MemoryMax=6G,--max-workers=2)./gradlew checkSigningSecretsAreNotInTheTree testPlayDebugUnitTest: BUILD SUCCESSFUL./gradlew testGithubDebugUnitTest,testFdroidDebugUnitTest: BUILD SUCCESSFUL. The first attempt lost its Gradle daemon to the memory cap while another build ran; the re-run passed../gradlew lintPlayDebug,lintGithubDebug,lintFdroidDebug: BUILD SUCCESSFUL./gradlew assembleFdroidDebug assemblePlayDebugAndroidTest: BUILD SUCCESSFULSecurity
GET /api/mailboxes, and one extraGET /api/mail/bodyper reply.AI involvement
🤖 Generated with Claude Code