Skip to content

fix(smime): surface unparseable stored certificates instead of crashing#12956

Open
ChristophWurst wants to merge 1 commit into
mainfrom
fix/smime-unparseable-cert
Open

fix(smime): surface unparseable stored certificates instead of crashing#12956
ChristophWurst wants to merge 1 commit into
mainfrom
fix/smime-unparseable-cert

Conversation

@ChristophWurst
Copy link
Copy Markdown
Member

PageController and SmimeCertificatesController called enrichCertificate() for all stored S/MIME certificates without catching SmimeCertificateParserException. One unparseable certificate (e.g. a TLS certificate accidentally imported before stricter email validation was added in b3d7c9a) would crash the entire page load or the certificate list API call.

Catch the exception in both controllers and return an error-state EnrichedSmimeCertificate (info: null, error: message) so the certificate still appears in the management UI and can be deleted by the user.

Assisted-by: Claude:claude-sonnet-4-6

Tested with a bogus cert smuggled into the db. Error is reproducible on main and not here. Cert correctly listed as invalid:

Bildschirmfoto vom 2026-05-20 19-51-21

Fixes #12954

PageController and SmimeCertificatesController called enrichCertificate()
for all stored S/MIME certificates without catching
SmimeCertificateParserException. One unparseable certificate (e.g. a TLS
certificate accidentally imported before stricter email validation was
added in b3d7c9a) would crash the entire page load or the certificate
list API call.

Catch the exception in both controllers and return an error-state
EnrichedSmimeCertificate (info: null, error: message) so the certificate
still appears in the management UI and can be deleted by the user.

Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
@ChristophWurst ChristophWurst self-assigned this May 20, 2026
@ChristophWurst ChristophWurst added bug 3. to review feature:smime For all tasks related to S/MIME labels May 20, 2026
@ChristophWurst
Copy link
Copy Markdown
Member Author

/backport to stable5.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error: Certificate does not contain an email address

1 participant