Issue Description
In v1.0.0 an expired main credential (password expiresAt in the past) correctly stops an OIDC sign-in to a registered client (“Your password has expired. Change it in the account portal, then sign in again.”). This was the fix for t/1933.
But when an administrator marks a registered OAuthClient as firstParty: true, the same expired password signs in and the client receives an authorization code. The description of firstParty only says that tokens carry the account’s full permissions and that the user is still asked for consent – it does not mention that password expiry is skipped.
Reproduced in a test instance (see steps). The cause seems to be in crates/http/src/auth/oauth/auth.rs (around line 688) and token.rs: the check is skipped with !client.is_first_party(), and ResolvedClient::is_first_party() is true both for Stalwart’s own web applications and for any registered client with first_party = true (this part checked in the source only). The exemption makes sense for the account portal, so the user can change the expired password there, but it also applies to third-party apps an admin marked as trusted.
Expected Behavior
An expired password stops OIDC sign-in to every client except Stalwart’s own web applications (account portal, admin UI), regardless of firstParty on a registered client – or the firstParty description documents that it also skips password expiry.
Actual Behavior
With firstParty: true on a registered client, a user whose password has expired completes the OIDC sign-in and the client receives an authorization code. With firstParty: false the same sign-in is refused with “Your password has expired. Change it in the account portal, then sign in again.” (as expected). IMAP login with the expired password is refused in both cases.
Reproduction Steps
- Register an OAuthClient (confidential, authorization code + PKCE, redirect URI of a webmail),
scopesmail/contacts/calendars/files,firstParty: false. - Set
credentials/0/expiresAtof a user to a date in the past. - Open the authorization URL for this client (Stalwart’s own login page), allow the consent, sign in with the expired password → “Your password has expired …”, no code (correct).
- Set
firstParty: trueon the same client and reload the settings. - Repeat step 3 with the same user → the browser is redirected to the client’s redirect URI with an authorization code.
Relevant Log Output
Both sign-ins (firstParty false → refused, firstParty true → code issued) only log at info level:
INFO Authentication successful (auth.success) listenerId = “http”, accountName = “[email protected]”
No credential-expired event appears at info level in either case.
Stalwart Version
v1.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
Additional Context
Tested in a test environment after migrating from v0.16.27 with stalwart-migrate 1.0.0. Our workaround: firstParty only for stalwart-webui, not for our webmail and identity broker. Related: t/1933, t/2047.
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on