Skip to content
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

Honor R_LIBCURL_SSL_REVOKE_BEST_EFFORT #1624

Merged
merged 2 commits into from Aug 7, 2023

Conversation

zeehio
Copy link
Contributor

@zeehio zeehio commented Aug 3, 2023

R_LIBCURL_SSL_REVOKE_BEST_EFFORT was introduced in R on R-4.2 at wch/r-source@f1ec503.

If that environment variable is set to TRUE, then curl relaxes the certificate revocation checks. This is needed on Windows systems using curl with the schannel backend on environments with man in the middle https certificates (typically corporate environments), since those certificate revocation checks otherwise fail.

The curl package already disables those checks on windows as discussed at jeroen/curl#306.

To avoid having to declare a custom configuration for each package, I suggest to honor that same environment variable in renv as well.

I manually verified (on a Windows system with a MITM certificate authority) that renv was giving certificate revocation check errors and that with this fix the errors are gone. Besides, I did the following command line curl tests on such system:

The command:

curl.exe -X GET https://cloud.r-project.org/src/contrib/PACKAGES

failed for the reasons described above (certificate revocation check failed).

The proposed solution:

curl.exe -X GET --ssl-revoke-best-effort  https://cloud.r-project.org/src/contrib/PACKAGES

worked without any issue.

I also considered that a user may have set the --ssl-revoke-best-effort parameter manually for renv, and with this patch the user would be passing the parameter twice. Therefore I tested passing that option to curl twice. curl did not care, so no backwards compatibility issue is expected. In other words, this worked:

curl.exe -X GET --ssl-revoke-best-effort   --ssl-revoke-best-effort  https://cloud.r-project.org/src/contrib/PACKAGES

Thanks for your consideration reviewing this PR and for your time working on renv. It is really useful.

R_LIBCURL_SSL_REVOKE_BEST_EFFORT was introduced in R on R-4.2 as documented in wch/r-source@f1ec503.

If the environment variable is set to TRUE, then curl relaxes the certificate revocation checks. This is needed on Windows systems using curl with the schannel backend on environments with man in the middle https certificates (typically corporate environments), since those certificate revocation checks otherwise fail.

To avoid duplicating custom configurations for all packages, I suggest to honor that environment variable here as well.

I tested the command:

curl.exe -X GET https://cloud.r-project.org/src/contrib/PACKAGES

on a system where it failed for the reasons described above. I tested the proposed solution and it worked.

curl.exe -X GET --ssl-revoke-best-effort  https://cloud.r-project.org/src/contrib/PACKAGES

I also considered that a user may have set the '--ssl-revoke-best-effort' parameter manually, and with my patch the user would be passing the parameter twice. I tested passing that option twice and curl did not care, so no backwards issue is expected. In other words, this worked:

curl.exe -X GET --ssl-revoke-best-effort   --ssl-revoke-best-effort  https://cloud.r-project.org/src/contrib/PACKAGES
Copy link
Collaborator

@kevinushey kevinushey left a comment

Choose a reason for hiding this comment

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

LGTM -- thank you very much for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants