Skip to content

Always use system certificates #13052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/mix/lib/mix/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,14 @@ defmodule Mix.Utils do
request = {:binary.bin_to_list(path), headers}

# Use the system certificates
ssl_options = :httpc.ssl_verify_host_options(true)
# Currently we inline what `:httpc.ssl_verify_host_options/1` is doing, because it is not present
# on OTP < 25.1.
# TODO: just use `ssl_options = :httpc.ssl_verify_host_options(true)` once OTP >= 26.0 is required.
ssl_options = [
verify: :verify_peer,
cacerts: :public_key.cacerts_get(),
customize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]
]
Comment on lines +660 to +664
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original for comparison:

ssl_verify_host_options(WildcardHostName) ->
    WildCard = case WildcardHostName of
                   true ->
                       Fun = public_key:pkix_verify_hostname_match_fun(https),
                       [{customize_hostname_check,[{match_fun, Fun}]}];
                   false ->
                       []
               end,
    [{verify, verify_peer}, {cacerts, public_key:cacerts_get()} | WildCard].


# We are using relaxed: true because some servers is returning a Location
# header with relative paths, which does not follow the spec. This would
Expand Down