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

Windows SSL #138

Merged
merged 26 commits into from
Mar 5, 2024
Merged

Windows SSL #138

merged 26 commits into from
Mar 5, 2024

Conversation

Luc45
Copy link
Member

@Luc45 Luc45 commented Mar 5, 2024

PHP on Windows comes by default without a Certificate Authority file, which prevents it from making any network request to URLs with https:// (or maybe, to only a few, as it seems it succeeds at https://google.com)

This PR adds a fallback to use a CA file on Windows if a request fails.

I've opened a feature request on PHP asking for this to be fixed: php/php-src#13601

And also did some isolated tests on a dedicated repo.

@Luc45
Copy link
Member Author

Luc45 commented Mar 5, 2024

We can see it working in this test: https://github.com/woocommerce/qit-cli/actions/runs/8162261104 (Updated)

What we do here is:

  • Using windows in CI, for each PHP version (7.2 to 8.3)
  • We try to sync without any Certificate Authority and see it fails
  • Then we allow it to download the CA file (on a Windows desktop we would ask the user)
  • We repeat the request and assert it works
  • We repeat it again to test a cache hit (CA file already downloaded) and assert it works

This logic only triggers when running on Windows. (I've used the "QIT Environment Test - Linux" workflow just to do my tests on this branch)

@Luc45 Luc45 marked this pull request as ready for review March 5, 2024 19:16
@Luc45 Luc45 requested a review from a team March 5, 2024 19:16
@Luc45 Luc45 marked this pull request as draft March 5, 2024 19:20
@@ -0,0 +1,78 @@
name: QIT Windows
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, thanks for adding in this test workflow!

@Luc45
Copy link
Member Author

Luc45 commented Mar 5, 2024

Manual test on native Windows (Second yes is cached)

image

@Luc45 Luc45 marked this pull request as ready for review March 5, 2024 20:09
@Luc45 Luc45 self-assigned this Mar 5, 2024
@Luc45 Luc45 requested a review from zhongruige March 5, 2024 20:09
Copy link
Contributor

@zhongruige zhongruige left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for getting this in @Luc45! I ran some tests locally and things continued to work as expected on macOS.

@Luc45 Luc45 merged commit e1a592d into trunk Mar 5, 2024
@Luc45 Luc45 deleted the 24-03/windows-ssl branch March 5, 2024 20:21
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.

curl: Fallback to using Certificate Authority from Windows Certificate Store
2 participants