Skip to content

Commit ef1455c

Browse files
authored
Disable public blob access on search containers (#10136)
1 parent 666b91d commit ef1455c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/NuGet.Services.AzureSearch/BlobContainerBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) .NET Foundation. All rights reserved.
1+
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
@@ -59,7 +59,7 @@ public async Task CreateAsync(bool retryOnConflict)
5959
{
6060
try
6161
{
62-
await Container.CreateAsync(enablePublicAccess: true);
62+
await Container.CreateAsync(enablePublicAccess: false);
6363
containerCreated = true;
6464
}
6565
catch (CloudBlobConflictException) when (retryOnConflict)
@@ -108,4 +108,4 @@ public async Task<bool> DeleteIfExistsAsync()
108108
return containerDeleted;
109109
}
110110
}
111-
}
111+
}

tests/NuGet.Services.AzureSearch.Tests/IndexBuilderFacts.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public async Task CreatesIndex(bool retryOnConflict)
3434
await _target.CreateAsync(retryOnConflict);
3535

3636
VerifyGetContainer();
37-
_cloudBlobContainer.Verify(x => x.CreateAsync(true), Times.Once);
37+
_cloudBlobContainer.Verify(x => x.CreateAsync(false), Times.Once);
3838
_cloudBlobContainer.Verify(x => x.CreateIfNotExistAsync(It.IsAny<bool>()), Times.Never);
3939
_cloudBlobContainer.Verify(x => x.DeleteIfExistsAsync(), Times.Never);
4040
}
@@ -46,7 +46,7 @@ public async Task CanRetryOnConflict()
4646

4747
await _target.CreateAsync(retryOnConflict: true);
4848

49-
_cloudBlobContainer.Verify(x => x.CreateAsync(true), Times.Exactly(2));
49+
_cloudBlobContainer.Verify(x => x.CreateAsync(false), Times.Exactly(2));
5050
}
5151

5252
[Fact]
@@ -72,7 +72,7 @@ public async Task CreatesIndexIfNotExists()
7272
await _target.CreateIfNotExistsAsync();
7373

7474
VerifyGetContainer();
75-
_cloudBlobContainer.Verify(x => x.CreateAsync(true), Times.Once);
75+
_cloudBlobContainer.Verify(x => x.CreateAsync(false), Times.Once);
7676
_cloudBlobContainer.Verify(x => x.CreateIfNotExistAsync(It.IsAny<bool>()), Times.Never);
7777
_cloudBlobContainer.Verify(x => x.DeleteIfExistsAsync(), Times.Never);
7878
}

0 commit comments

Comments
 (0)