Repository navigation
fix(platform): mirror the IMAP login into the mailbox From - #2924
Merged
Merged
Conversation
An IMAP/SMTP credential had no way to publish its own address: `config.fromAddress` was never a declared field, so `normalizeConfig` rejected it and nothing could set it. Everything that reads a mailbox's address therefore fell back or gave up — the Inbox could not say which mailbox a thread belonged to, and the compose sender never resolved. SMTP already sends From the login username (`natives/imap-smtp.ts`), so the two are the same value by construction. Declare the field and mirror it server-side on create and update; the login is a secret, the From is not, and the UI needs the public half. - hide the field on the credential form: From and Username are one answer, and a second input invites them to disagree - carry an existing mirror through a config replace that omits it — the field is server-owned and never rendered, so a caller cannot resupply - heal older credentials on mailbox sync, but only when the public config resolves nothing: the steady state costs an indexed read, not a credential decrypt per mailbox per pass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An IMAP/SMTP credential had no way to publish its own address.
config.fromAddresswas read in three places but was never a declared config field, andnormalizeConfigrejects undeclared keys — so nothing could ever set it. Every consumer silently degraded:metadata.to)resolveConnectorAccountEmailalways fell through to its fallback, weakening sent-mail direction classificationsupportsDynamicSenderwas dead codeSMTP already derives From from the login username (
lib/connectors/natives/imap-smtp.ts), so From and Username are the same value by construction. This declares the field and mirrors it server-side.Changes
connector.yml: declarefromAddress, documented as set automatically from the login.imap_from_address.ts:withImapFromAddress(mirror on write) andstoredImapFromAddress(carry an existing mirror).createCredential/updateCredentialmirror the username into config. A config replace that omitsfromAddresskeeps the stored value rather than dropping it — the field is server-owned and never rendered, so a programmatic caller has no way to resupply it.fromAddress: From and Username are one answer, and a second input only invites them to disagree. The value still round-trips through form state, so an edit cannot wipe it.sync_mailbox.tsheals credentials written before the mirror existed — but only when the public config resolves nothing, so the steady state costs one indexed read rather than a credential decrypt per mailbox per sync pass.Tests
imap_from_address.test.tscovers the mirror, the overwrite-on-drift case, the non-email login, other connectors, and the carry-over helper.config-fields.test.tsxkeeps its existing coverage (a field per declared setting; nothing at all when none are declared; the declared default stays a placeholder), adds the hidden-field assertion, and adds a round-trip guard proving the hidden value survives an edit.