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

[Fix] GithubVulnerability2V3 use only HTTPS #10292

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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