public_key: Fix crash when no OS CA certificates are found - #11378
Merged
IngelaAndin merged 1 commit intoAug 18, 2026
Merged
Conversation
Contributor
CT Test Results 2 files 18 suites 3m 47s ⏱️ 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 |
dgud
previously approved these changes
Aug 5, 2026
Contributor
|
@maennchen @dgud This is obviously ready for inclusion, should we not base and target it for maint as a bugfix? |
Contributor
Author
|
@IngelaAndin I can target |
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
force-pushed
the
jm/public_key/fix-no_cacerts_found-crash
branch
from
August 18, 2026 10:02
ddddcbf to
f9d841d
Compare
Contributor
Author
|
@IngelaAndin / @dgud Rebased. |
IngelaAndin
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/0is supposed to raise a descriptive{failed_load_cacerts, Reason}error. Instead it crashed with afunction_clauseerror in the internal error conversion helper, masking the real problem:This can also be triggered indirectly through
httpc's defaultverify_peersetup (httpc:ssl_verify_host_options/1).format_error/2had the same gap, so error formatting would have crashed in the same way instead of producing a message.Add the missing
no_cacerts_foundclauses so that the intended{failed_load_cacerts, no_cacerts_found}error is raised and formatted properly, and extend thecacerts_loadtest case to cover this.