Don't show certificate error when pushing to self-hosted repositories #19149
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.
Closes #18991
Description
Some self-hosted repositories may not have a valid SSL certificate and that could be ok. Git offers the
http.sslverify
option to disable SSL verification for all git operations, or only for git operations on certain hosts. We could use that here, but we don't want to duplicate that logic to match domains, order of preference of different options...Instead, we'll just reject all requests to
/meta
that fail SSL verification. The reasoning for that is:undefined
in this function means "we don't know if this is a GitHub host or not".If we used
fetch
for this, in the case of an invalid SSL certificate Electron would dispatch a 'certificate-error' event on the main process that we must handle to allow the request to finish (in this case, by rejecting it). However, we're usinghttps.request
here, so we don't need to handle that and can get rid of the complexity of dealing with stuff happening on the main process.Release notes
Notes: [Fixed] Don't show certificate error when pushing to self-hosted repositories