i'm using Azure blob storage for storing data from clients.
Clients are given with shared access signature with NO 'Delete' permission.
Nevertheless, i can delete a blob content without 'Delete' permission with the following code:
// sharedKey doesn't contain 'Delete' permission
var credentials = new StorageCredentials(sharedKey);
var blob = new CloudBlockBlob(blobPath, credentials);
var blockIds = new List<string>();
// If not getting all current blocks ids, all current data will be lost.
// if (blob.Exists())
// {
// blockIds.AddRange(blob.DownloadBlockList().Select(b => b.Name));
// }
var blockId =
Convert.ToBase64String(
Encoding.Default.GetBytes(blockIds.Count.ToString("d6", CultureInfo.InvariantCulture)));
blockIds.Add(blockId);
byte[] eventInBytes = Encoding.Default.GetBytes(string.Format(CultureInfo.InvariantCulture, "{0}\n", formattedEvent));
using (var eventStream = new MemoryStream(eventInBytes))
{
blob.PutBlock(blockId, eventStream, null);
}
blob.PutBlockList(blockIds);
Is this an Azure defect (or i am missing the concept of the shared access signature?. any way to overcome this issue ?
thanks!