Skip to content

Extension uses HTTP when URL has HTTPS for Privately Hosted GitLab Repos

Checklist

Summary

When using a self-hosted version of GitLab in AWS, such as https://aws5-gitlab01.mycompany.com, despite the URL using HTTPS, commands issued from the GitLab extension are issued using HTTP.

This behavior may be recreated by using an AWS VM to host a current version of GitLab Community Edition using a wildcard SSL certificate (e.g. "*.mycompany.com") provided by a public CA such as Sectigo.

Create an access token checking only the "API" option on GitLab.

In Visual Studio Code use the "GitLab: Add" command to add the AWS self-hosted GitLab server similar to this:

Server = https://aws5-gitlab01.mycompany.com
Token  = <insert_access_token_here>

Then attempt to clone a repo such as "myrepo" - the output window will show the following:

2023-10-10 13:52:53.630 [info] Log level: Info
2023-10-10 13:52:53.630 [info] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2023-10-10 13:52:53.630 [info] Validating found git in: "C:\Program Files (x86)\Git\cmd\git.exe"
2023-10-10 13:52:53.630 [info] Validating found git in: "C:\Program Files\Git\cmd\git.exe"
2023-10-10 13:52:53.630 [info] Validating found git in: "C:\Users\KaufmanN\AppData\Local\Programs\Git\cmd\git.exe"
2023-10-10 13:52:53.721 [info] Using git "2.42.0.windows.2" from "C:\Users\KaufmanN\AppData\Local\Programs\Git\cmd\git.exe"
2023-10-10 13:53:19.850 [info] > git clone http://aws5-gitlab01.mycompany.com/myrepo.git c:\Users\KaufmanN\Source code\myrepo --progress [294ms]
2023-10-10 13:53:19.850 [info] Cloning into 'c:\Users\KaufmanN\Source code\myrepo'...
fatal: unable to access 'http://aws5-gitlab01.mycompany.com/myrepo.git/': Empty reply from server

What is the current bug behavior?

The current buggy behavior is shown in the log here:

2023-10-10 13:53:19.850 [info] > git clone HTTP://aws5-gitlab01.mycompany.com/myrepo.git c:\Users\KaufmanN\Source code\myrepo --progress [294ms]

...despite entering the URL as HTTPS the GitLab Extension passes an HTTP URL to git instead of the HTTPS URL which causes the command to fail.  

What is the expected correct behavior?

What should have happened is that the GitLab Extension should have issued this git command:

git clone HTTPS://aws5-gitlab01.mycompany.com/myrepo.git c:\Users\KaufmanN\Source code\myrepo --progress

Relevant logs and/or screenshots

The following was in the extension logs:

2023-10-10T13:52:54:524 [info]: Extracted urls: []
2023-10-10T13:52:54:526 [info]: Extracted urls: []
2023-10-10T13:52:54:528 [info]: More recent project update in progress, discarding findings for urls: []
2023-10-10T13:52:54:528 [info]: Found 0 projects for urls: []
2023-10-10T13:53:23:097 [error]: Could not intialise API client, falling back to legacy code suggestions API

Possible fixes

Edited by Noah Kaufman