@@ -441,9 +441,9 @@ func LoadConfig(configFiles []string, deploymentId int) (*Config, error) {
441
441
// the Semgrep AppSec Platform fetches repository contents using the git smart transfer protocol
442
442
// which requests resources which don't have an api suffix, e.g. /api/v3/
443
443
// see https://git-scm.com/book/be/v2/Git-Internals-Transfer-Protocols
444
- githubBaseUrlWithoutApiSuffix , err := url .Parse (strings . TrimSuffix ( gitHub . BaseURL , "/api/v3" ) )
444
+ githubRootUrl , err := url .Parse (gitHubBaseUrl . Scheme + "://" + gitHubBaseUrl . Host )
445
445
if err != nil {
446
- return nil , fmt .Errorf ("failed to parse github base URL without api suffix : %v" , err )
446
+ return nil , fmt .Errorf ("failed to build github root URL: %v" , err )
447
447
}
448
448
449
449
var headers map [string ]string
@@ -651,13 +651,13 @@ func LoadConfig(configFiles []string, deploymentId int) (*Config, error) {
651
651
},
652
652
// discover refs
653
653
AllowlistItem {
654
- URL : githubBaseUrlWithoutApiSuffix .JoinPath ("/:org/:repo/info/refs" ).String (),
654
+ URL : githubRootUrl .JoinPath ("/:org/:repo/info/refs" ).String (),
655
655
Methods : ParseHttpMethods ([]string {"GET" }),
656
656
SetRequestHeaders : headers ,
657
657
},
658
658
// download repo contents
659
659
AllowlistItem {
660
- URL : githubBaseUrlWithoutApiSuffix .JoinPath ("/:org/:repo/git-upload-pack" ).String (),
660
+ URL : githubRootUrl .JoinPath ("/:org/:repo/git-upload-pack" ).String (),
661
661
Methods : ParseHttpMethods ([]string {"POST" }),
662
662
SetRequestHeaders : headers ,
663
663
},
0 commit comments