Skip to content

Commit

Permalink
[Fix] GithubVulnerability2V3 use only HTTPS (#10292)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyjdev authored Nov 27, 2024
1 parent 27bc6a6 commit 3e6294d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public async Task FlushAsync(string outputFileName = null)

var currentTime = DateTime.UtcNow.ToString(TimeFormat);
var indexStorageUri = _storage.ResolveUri(_configuration.IndexFileName);
StringBuilder updateUriPathBuilder = new StringBuilder();
updateUriPathBuilder.Append(_configuration.V3VulnerabilityContainerName + "/");

if (runMode == RunMode.Update && !await _storage.ExistsAsync(indexStorageUri.ToString(), CancellationToken.None))
{
Expand Down
2 changes: 1 addition & 1 deletion src/GitHubVulnerabilities2v3/Job.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ protected void ConfigureCollectorServices(ContainerBuilder containerBuilder, ICo
ctx.Resolve<BlobServiceClientFactory>(),
ctx.Resolve<GitHubVulnerabilities2v3Configuration>().V3VulnerabilityContainerName,
enablePublicAccess: true,
ctx.Resolve<ILogger<AzureStorage>>());
azureStorageLogger: ctx.Resolve<ILogger<AzureStorage>>());
})
.As<StorageFactory>()
.As<IStorageFactory>();
Expand Down
8 changes: 1 addition & 7 deletions src/NuGet.Services.Storage/AzureStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,7 @@ public bool CompressContent

static Uri GetDirectoryUri(BlobContainerClient directory)
{
Uri uri = new UriBuilder(directory.Uri)
{
Scheme = "http",
Port = 80
}.Uri;

return uri;
return directory.Uri;
}

//Blob exists
Expand Down
8 changes: 1 addition & 7 deletions src/NuGet.Services.Storage/AzureStorageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@ public AzureStorageFactory(

if (baseAddress == null)
{
Uri blobEndpoint = new UriBuilder(account.Uri)
{
Scheme = "http", // Convert base address to http. 'https' can be used for communication but is not part of the names.
Port = 80
}.Uri;

BaseAddress = new Uri(blobEndpoint, containerName + "/" + _path ?? string.Empty);
BaseAddress = new Uri(account.Uri, containerName + "/" + _path ?? string.Empty);
}
else
{
Expand Down

0 comments on commit 3e6294d

Please sign in to comment.