Skip to content

Conversation

@eafer
Copy link
Contributor

@eafer eafer commented Dec 12, 2024

One more patch from the original pull request at #14379. I'm sending this one on its own because it was controversial the last time (@ityuhui). At my company we need the C api to verify ssl certificates by default. We already apply this patch ourselves, but I think a safer default like this should be better for everyone. Of course I'll appreciate any feedback on the matter.

@wing328 @ityuhui @zhemant @michelealbano

} else {
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, 1L);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious if apiClient->sslConfig == NULL, where is the SSL configuraion for verification ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's up to curl. According to their docs about the certificate authority here:

This option is by default set to the system path where libcurl's CA certificate bundle is assumed to be stored, as established at build time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can see the value if you run curl-config --ca. In my system it's /etc/ssl/certs/ca-certificates.crt.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. and agree with this change now.

User can set apiClient->sslConfig->insecureSkipTlsVerify if needed.

@wing328 wing328 added this to the 7.11.0 milestone Dec 14, 2024
@wing328 wing328 merged commit 1a3d7d4 into OpenAPITools:master Dec 14, 2024
19 checks passed
@eafer
Copy link
Contributor Author

eafer commented Dec 14, 2024

Excellent, thank you both. I just sent a new pull request here: #20332.

timon-sbr pushed a commit to timon-sbr/openapi-generator that referenced this pull request Mar 13, 2025
* [C] Default to requiring valid SSL

* Update samples

---------

Co-authored-by: Sam Bingner <sam@corellium.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants