robinrodricks / FluentStorage

A polycloud .NET cloud storage abstraction layer. Provides Blob storage (AWS S3, GCP, FTP, SFTP, Azure Blob/File/Event Hub/Data Lake) and Messaging (AWS SQS, Azure Queue/ServiceBus). Supports .NET 5+ and .NET Standard 2.0+. Pure C#.
MIT License
263 stars 33 forks source link

Creation of Azure storage from connection string failed for shared key credentials #66

Open AloisMaierhofer opened 2 months ago

AloisMaierhofer commented 2 months ago

the creation of a Azure file or blob storage instance failes if doing so via StorageFactory.Blobs.FromConnectionString

Reason: The factory uses FluentStorage.ConnectionString.StorageConnectionString internally to parse the connection string. For each property value the method UrlDecode is called by the Parse method. This makes a lot of sense to be able to pass special characters in passwords.

The Azure account key is Base64 encoded, though. If it contains + characters, those get replaced by spaces, other characters might also get replaced falsely. Therefore the Azure account key must not be tampered with.

One workaround would be to store the account key urlencoded in the connection string in the application configuration - not very user friendly, its base64 already...

The StorageConnectionString on the other hand side has no knowledge if the secret key is urlencoded or base64 encoded... not sure how to solve this.

Maybe it would make sense to mention the url-encoding for passwords in the documentation.