Skip to content

Commit

Permalink
fix(provider/azure): SECURITY VULNERABILITY, stop making containers p…
Browse files Browse the repository at this point in the history
…ublic

This is an attempt to fix:

- spinnaker/spinnaker#5892
- spinnaker/spinnaker#6218

The following PRs attempted to address this issue, and appear to be
orphaned:

- #900 - Failing checks.
- #1002 - Fixing more than one
  thing.  Should be two (2) PRs.
  • Loading branch information
pedrohdz committed Aug 24, 2021
1 parent 23c27d1 commit 449c2a3
Showing 1 changed file with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,24 @@ private CloudBlobClient getBlobClient() {
private CloudBlobContainer getBlobContainer() {
if (storageAccount != null && blobContainer == null) {
try {
blobContainer = getBlobClient().getContainerReference(this.containerName);
blobContainer.createIfNotExists();
BlobContainerPermissions permissions = new BlobContainerPermissions();
permissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
blobContainer.uploadPermissions(permissions);
CloudBlobContainer localBlobContainer =
getBlobClient().getContainerReference(this.containerName);
// Do not modify the blob containers permissions if it already exists.
// This should keep things backwards compatible.
if (localBlobContainer.createIfNotExists()) {
// Default to private access if creating.
BlobContainerPermissions permissions = new BlobContainerPermissions();
permissions.setPublicAccess(BlobContainerPublicAccessType.OFF);
localBlobContainer.uploadPermissions(permissions);
}
this.blobContainer = localBlobContainer;
} catch (Exception e) {
// log exception
blobContainer = null;
log.error(
"Exception occurred getting/creating the blob container: {} ",
value("exception", e.getMessage()));
}
}
return blobContainer;
return this.blobContainer;
}

public AzureStorageService(String connectionString, String containerName) {
Expand Down

0 comments on commit 449c2a3

Please sign in to comment.