Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
07d22dc
GO1: model: own identity provider (OAuth) settings
linuxrrze Nov 22, 2026
462b487
GO2: proto: SASL OAUTHBEARER for IMAP and SMTP
linuxrrze Nov 22, 2026
ad719c0
GO3-GO5, GO7: own identity provider: discovery, sign-in, mechanism, s…
linuxrrze Nov 22, 2026
f247826
GO6, GO8, GO9: own identity provider: commands, OAuth settings, autoc…
linuxrrze Nov 22, 2026
8762acb
GO7: give an own identity provider its refresh token back on Remove A…
linuxrrze Nov 22, 2026
3b61708
GO10: docs: signing in with your own identity provider
linuxrrze Nov 22, 2026
e99a3a8
#1831: remember an own identity provider's client secret
linuxrrze Nov 22, 2026
9468dae
A client secret now goes to the token and revocation addresses in the
linuxrrze Nov 22, 2026
5f6a14c
An account whose client has a secret, with none on this computer (a file
linuxrrze Nov 22, 2026
d6cd154
#1831: list the client-secret check among the secret cache's readers
linuxrrze Nov 22, 2026
6a25ced
#1831: log the steps of a renewal and the hand-off to the browser
linuxrrze Nov 22, 2026
a3c84d7
#1831: short-lived tokens are used, not renewed in a loop
linuxrrze Nov 22, 2026
438f2cc
#1831: a token refused during a run is renewed and the run tried once…
linuxrrze Nov 22, 2026
1fcaaec
#1831: an own provider's addresses are naming params for agents, its …
linuxrrze Nov 22, 2026
c211cd3
#1831: the revocation address binds a remembered sign-in; only the st…
linuxrrze Nov 22, 2026
f2d628a
Sign-in and secrets:
linuxrrze Nov 22, 2026
d05ce73
#1831: own identity provider: fixes from the second review of #1844
linuxrrze Nov 22, 2026
90bb69b
#1831: the OAuth settings list where only an own provider's sign-in g…
linuxrrze Nov 23, 2026
91029cb
- fuzz/Cargo.lock lists serde_json for mailcraft-proto (cargo deny
linuxrrze Nov 23, 2026
ee76a5f
#1831: fixes from CodeRabbit's review of b90ec5f
linuxrrze Nov 23, 2026
d90096d
#1831: translation catalogues sorted again after the rebase onto main
linuxrrze Nov 23, 2026
2d3cbc8
#1831: fixes from the review of d90096d
linuxrrze Nov 24, 2026
c980d62
#1831: fixes from the review of 2d3cbc8
linuxrrze Nov 24, 2026
5a6fd72
#1831: merge main
linuxrrze Nov 26, 2026
4f496d6
#1831: translation catalogue refreshed after merging main
linuxrrze Nov 26, 2026
3cf10e3
#1831: a retry run called off to go on renews no second time
linuxrrze Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
PR: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
all="assuan dav_xml dav_answers dav_apply dav_discovery dav_document mime html sheet ical vcard charset link imap smtp po jmap_address jmap_discovery jmap_response jmap_session ews ews_autodiscover ews_ntlm pst rtf mailbox_file header_block openpgp smime pkcs12 tnef"
all="assuan dav_xml dav_answers dav_apply dav_discovery dav_document mime html sheet ical vcard charset link imap smtp po jmap_address jmap_discovery jmap_response jmap_session ews ews_autodiscover ews_ntlm pst rtf mailbox_file header_block openpgp smime pkcs12 tnef sasl_failure"
paths_of() {
case "$1" in
assuan) echo crates/assuan/ ;;
Expand All @@ -51,7 +51,7 @@ jobs:
ical) echo crates/ical/ ;;
vcard) echo crates/vcard/ ;;
link) echo crates/link/ ;;
imap|smtp) echo crates/proto/ ;;
imap|smtp|sasl_failure) echo crates/proto/ ;;
po) echo crates/i18n/src/ ;;
jmap_*) echo crates/jmap/ ;;
pst|rtf) echo crates/pst/ ;;
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions PRIVACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ MailCraft connects only to these, over encrypted connections:
| A JMAP server you add an account for (the session address you gave it, and the addresses at the same server that its session names) | Send/Receive, on the timer you set, a few seconds after you mark, move or delete a message of the account or send one from it, and when you open a message that isn't downloaded yet; only in a build that connects to JMAP servers (the browser build, from the version that adds it) | What a mail program sends: your password or access token, and what you change in your mail: the marks you set on a message (read, flagged, answered, forwarded), the messages you move between the server's folders and those you delete for good are told to that server, and to nobody else. Mail you send from the account goes to that server to be sent, and to nobody else: the message whole, and the addresses it goes to, those in Bcc among them (the message itself names no Bcc); the server keeps its copy, in the account's Sent folder where it has one. A password or token you type is kept in memory only, until the program closes, the server turns it down or the account's server changes; it is never remembered in the credential store, the mailbox file, the settings or the browser's storage. Where the page you use signed you in itself, the program asks it for the credential at each Send/Receive or download (once more if the server turns it down), and keeps none of it beyond that |
| Microsoft's sign-in pages and Microsoft Graph, for an account that signs in with Microsoft | When you sign in; for calendar, contacts, tasks (Microsoft To Do), sending mail, working hours, categories (read, and made, recoloured and deleted there: their names and colours; after a rename, the mail and events that carry the old name are asked for by that name and given the new one), automatic replies, the rules kept on the server and Outlook's Favorites | Your sign-in happens on Microsoft's page in your browser; the program receives tokens, never your password |
| Google's sign-in page (`accounts.google.com/o/oauth2/v2/auth`) and token endpoint (`oauth2.googleapis.com/token`), for an account that signs in with Google | When you sign in, switch an existing account to Google sign-in or reconnect; the token endpoint is also used when a saved sign-in is renewed | The browser's sign-in request carries the application's client ID, the permissions requested, your account address as a login hint, a random state value, a PKCE challenge and a return address on your own computer. The token endpoint receives the authorization code and PKCE verifier, or the refresh token, together with the application's client ID and Desktop client-secret registration value. Google returns tokens and identifies the signed-in address in the identity token; MailCraft makes no separate user-info request. You enter your Google password on Google's page: MailCraft never sees it. |
| Your own identity provider (an OpenID Connect or OAuth 2.0 server you name), for an IMAP account you set up to sign in with it | When you press Discover in its OAuth settings (its description, at its own address); when you sign in or a saved sign-in is renewed (its sign-in page in your browser, and its token address); when you remove the account, if it names where a refresh token is given back | For Discover, a request for the provider's own description and nothing of yours: not your address, not the client id. The browser's sign-in request carries the client ID you entered, the permissions requested, your address as a hint, a one-time check value and the address on your own computer the page sends you back to; the token address gets the one-time code or the saved sign-in, the client ID, and the client secret only if you entered one. The sign-in is used only with your account's own mail servers |
| Gmail's API (`gmail.googleapis.com`), for an account that signs in with Google, to move mail between Gmail's inbox categories | Not in this version: moving mail between Gmail's categories is switched off until Google has reviewed MailCraft's use of the API. Once it is switched on, only at the Send/Receive after you move a message of the Inbox from one Gmail category to another; never for an account that signs in with an app password | Gmail's own id of each message you moved, the category it goes to (the labels to add and take off), and the account's sign-in token, which Gmail's API takes as it is; nothing else of the message or of you |
| The Exchange server of an Exchange server account (your organisation's own Exchange Server, Grommunio or SmarterMail), for its address list | When you press Check Names (Ctrl+K) in a message written from that account and a name you typed matches none or more than one of your contacts; and when you search the account's address list in People (its Address Book, chosen at the top of the list), for what you type in the search box, from two characters on, once you pause. Never while you type a recipient, never while you work offline, and never for a script or an agent | The names as you typed them (ten a request, at most fifty for one Check Names), with your sign-in, over the account's own connection. Who it finds (a name, an address, the job title, department and company, and in the Address Book the work and mobile numbers and the office) is kept in the window while you choose or look, and in the recipients you choose, and nowhere else: not in the mailbox file, not on disk, not in a log. Add to Contacts makes a contact on this computer of the person shown, on your press |
| A public DNS-over-HTTPS resolver (Cloudflare, then Google) | When you press Connect while adding an account at a domain the program does not know: once for the domain's mail exchangers and twice for where its Exchange automatic setup is (the `_autodiscover._tcp` record and `autodiscover.<domain>`), and, when the exchangers name no provider the program knows, up to four times more for the DNS records that say where the domain's mail servers are (its `_imaps`, `_imap`, `_submissions` and `_submission` SRV records); and while an Exchange server account is set up | The domain of your address (the part after the @), never the mailbox name |
Expand Down
30 changes: 26 additions & 4 deletions apps/mailcraft-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ USAGE:
Send/Receive with the account's mail server; the
password is read from MAILCRAFT_PASSWORD. An account
that signs in on its provider's page prints the
page to open (application id: MAILCRAFT_MS_CLIENT_ID),
or takes a token from MAILCRAFT_ACCESS_TOKEN
page to open (application id: MAILCRAFT_MS_CLIENT_ID;
an own provider's client secret:
MAILCRAFT_CLIENT_SECRET), or takes a token from
MAILCRAFT_ACCESS_TOKEN
mailcraft-cli detect <address> [--offline] the mail servers and sign-in an address usually
takes; for a domain it doesn't know it asks the
DNS who takes the domain's mail (only the domain
Expand Down Expand Up @@ -222,6 +224,10 @@ fn write_stdout(write: impl FnOnce(&mut std::io::StdoutLock<'static>) -> std::io

/// What `sync` says when the owner signed in on the provider's page as somebody other than the
/// account (#103): nothing of that sign-in is used. (It names nobody: this is printed.)
/// Why a sign-in at an own identity provider whose client has a secret doesn't start: the command
/// line takes the secret from the environment only.
const CLIENT_SECRET_NEEDED: &str = "sync: this account's identity provider wants its client secret: set MAILCRAFT_CLIENT_SECRET to it";

const SOMEONE_ELSE: &str = "sync: you signed in as somebody other than this account; sign in again with the account's own address";

/// `sync` for an account kept in step through Microsoft Graph: the folder changes made here go
Expand Down Expand Up @@ -596,8 +602,12 @@ fn run(args: &[String]) -> Result<(), Failure> {
mailcraft_model::OAuthProvider::Google => {
("MAILCRAFT_GOOGLE_CLIENT_ID", option_env!("MAILCRAFT_GOOGLE_CLIENT_ID").unwrap_or_default())
}
// (Its client id is the account's own setting: there is no other.)
mailcraft_model::OAuthProvider::Custom => ("", ""),
};
oauth.client_id = std::env::var(variable).unwrap_or_else(|_| built_in.to_string());
if !variable.is_empty() {
oauth.client_id = std::env::var(variable).unwrap_or_else(|_| built_in.to_string());
}
}
let open = |url: &str| {
eprintln!(
Expand All @@ -610,6 +620,16 @@ fn run(args: &[String]) -> Result<(), Failure> {
mailcraft_model::OAuthProvider::Microsoft => {
mailcraft_net::oauth::sign_in(&oauth, &request.account.email, &open, &cancel)
}
// An own provider's client secret, when its client has one, comes
// from the environment as the other secrets do (the desktop
// program keeps it in the system's credential store).
mailcraft_model::OAuthProvider::Custom => {
let secret = std::env::var("MAILCRAFT_CLIENT_SECRET").unwrap_or_default();
if oauth.has_secret && secret.is_empty() {
return Err(CLIENT_SECRET_NEEDED.into());
}
mailcraft_net::oauth::sign_in_custom(&oauth, &secret, &request.account.email, &open, &cancel)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
}
mailcraft_model::OAuthProvider::Google => {
let default = option_env!("MAILCRAFT_GOOGLE_CLIENT_SECRET").unwrap_or_default();
let secret = std::env::var("MAILCRAFT_GOOGLE_CLIENT_SECRET").unwrap_or_else(|_| default.to_string());
Expand All @@ -624,7 +644,9 @@ fn run(args: &[String]) -> Result<(), Failure> {
}
};
let tokens = signed_in.map_err(|e| format!("sync: {e}"))?;
if tokens.someone_else(&request.account.email, &request.account.username) {
// (As the window judges it: an own provider's names needn't be the
// account's; the mail servers judge its token, #1844 review.)
if mailcraft_engine::sync_driver::signed_in_as_other(&request.account, &tokens) {
return Err(SOMEONE_ELSE.to_string().into());
}
tokens.access
Expand Down
2 changes: 1 addition & 1 deletion apps/mailcraft/src/approval_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn sign_in_request(cancel: &Arc<AtomicBool>) -> SignInRequest {
oauth: settings(),
email: "avery@lumen.example".into(),
refresh: String::new(),
google_client_secret: String::new(),
client_secret: String::new(),
cancel: cancel.clone(),
quiet: false,
graph: false,
Expand Down
Loading