Skip to content

fix(errors): say when the server's certificate is the problem - #80

Merged
fullynocturnal merged 2 commits into
mainfrom
fix/certificate-error-messages
Sep 19, 2026
Merged

fullynocturnal merged 2 commits into
mainfrom
fix/certificate-error-messages

Conversation

@fullynocturnal

Copy link
Copy Markdown
Collaborator

A TLS failure is an IOException, so it was reported as "Network error, check your connection". Someone whose server uses a private CA, a certificate for another name, or an expired one would go off to debug their network when the answer was on the server.

Release builds now name the three certificate cases:

  • Not trusted. Says so, and that certificates installed on the device are not used. That is the obvious next question from anyone who installed their own CA and wonders why it made no difference.
  • Issued for another address. The classic case: entering a server by IP when its certificate names a hostname.
  • Expired or not yet valid. Points at the device clock as well as the certificate, since a wrong clock produces the same error.

The check reads the handshake exception's cause chain and only uses a certificate message when a certificate really is the cause. A handshake that fails for another reason, such as the server dropping the connection, keeps the network message. None of this shows on debug builds, which accept any certificate.

This changes wording only. What the app trusts is exactly what it was.

Checked

  • Unit tests for each case, shaped like what Android throws (the validator's verdict wrapped a level or two down), plus one holding that a non-certificate handshake failure still reads as a network error.
  • Full unit suite and assembleOpenDebug on this branch.

A TLS failure is an IOException, so it was reported as "Network error, check
your connection". Someone whose server uses a private CA, a certificate for a
different name, or an expired one went off to debug their network when the
answer was on the server.

Release builds now name the three certificate cases:

- **Not trusted**: says so, and that certificates installed on the device are
  not used, which is the obvious next question from anyone who installed
  their own CA and wonders why it made no difference.
- **Issued for another address**: the classic case of entering a server by
  IP when its certificate names a hostname.
- **Expired or not yet valid**: points at the device clock as well as the
  certificate, since a wrong clock produces the same error.

The check reads the handshake exception's cause chain, and only uses a
certificate message when a certificate is actually the cause. A handshake
that fails for another reason, such as the server dropping the connection,
keeps the network message, and a test holds that line. Debug builds accept
any certificate, so none of this shows there.
@fullynocturnal
fullynocturnal merged commit 78c69ea into main Sep 19, 2026
1 check passed
@fullynocturnal
fullynocturnal deleted the fix/certificate-error-messages branch September 19, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant