Skip to content

public_key: Fix crash when no OS CA certificates are found - #11378

Merged
IngelaAndin merged 1 commit into
erlang:maintfrom
maennchen:jm/public_key/fix-no_cacerts_found-crash
Aug 18, 2026
Merged

public_key: Fix crash when no OS CA certificates are found#11378
IngelaAndin merged 1 commit into
erlang:maintfrom
maennchen:jm/public_key/fix-no_cacerts_found-crash

Conversation

@maennchen

@maennchen maennchen commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

When no OS CA certificate bundle can be found, for example on a minimal system where none of the default paths exist, or when the configured path is an empty directory, pubkey_os_cacerts:get/0 is supposed to raise a descriptive {failed_load_cacerts, Reason} error. Instead it crashed with a function_clause error in the internal error conversion helper, masking the real problem:

** exception error: no function clause matching
   pubkey_os_cacerts:conv_error_reason(no_cacerts_found)

This can also be triggered indirectly through httpc's default verify_peer setup (httpc:ssl_verify_host_options/1).

format_error/2 had the same gap, so error formatting would have crashed in the same way instead of producing a message.

Add the missing no_cacerts_found clauses so that the intended {failed_load_cacerts, no_cacerts_found} error is raised and formatted properly, and extend the cacerts_load test case to cover this.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

  2 files   18 suites   3m 47s ⏱️
313 tests 305 ✅ 8 💤 0 ❌
330 runs  322 ✅ 8 💤 0 ❌

Results for commit f9d841d.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@u3s u3s added the team:PS Assigned to OTP team PS label Jul 21, 2026
@dgud dgud added the testing currently being tested, tag is used by OTP internal CI label Aug 5, 2026
dgud
dgud previously approved these changes Aug 5, 2026
@IngelaAndin

Copy link
Copy Markdown
Contributor

@maennchen @dgud This is obviously ready for inclusion, should we not base and target it for maint as a bugfix?

@maennchen

Copy link
Copy Markdown
Contributor Author

@IngelaAndin I can target maint, I'll rebase it.

When no OS CA certificate bundle can be found, for example on a
minimal system where none of the default paths exist, or when the
configured path is an empty directory, pubkey_os_cacerts:get/0 is
supposed to raise a descriptive {failed_load_cacerts, Reason} error.
Instead it crashed with a function_clause error in the internal error
conversion helper, masking the real problem:

    ** exception error: no function clause matching
       pubkey_os_cacerts:conv_error_reason(no_cacerts_found)

This can also be triggered indirectly through httpc's default
verify_peer setup (httpc:ssl_verify_host_options/1).

format_error/2 had the same gap, so error formatting would have
crashed in the same way instead of producing a message.

Add the missing no_cacerts_found clauses so that the intended
{failed_load_cacerts, no_cacerts_found} error is raised and formatted
properly, and extend the cacerts_load test case to cover this.
@maennchen
maennchen force-pushed the jm/public_key/fix-no_cacerts_found-crash branch from ddddcbf to f9d841d Compare August 18, 2026 10:02
@maennchen
maennchen changed the base branch from master to maint August 18, 2026 10:02
@maennchen
maennchen dismissed dgud’s stale review August 18, 2026 10:02

The base branch was changed.

@maennchen

Copy link
Copy Markdown
Contributor Author

@IngelaAndin / @dgud Rebased.

@IngelaAndin
IngelaAndin merged commit fca5dc1 into erlang:maint Aug 18, 2026
34 checks passed
@maennchen
maennchen deleted the jm/public_key/fix-no_cacerts_found-crash branch August 18, 2026 11:04
@IngelaAndin IngelaAndin added this to the OTP-29.1 milestone Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants