Azure / Azure/azure-storage-python
Server failed to authenticate error when metadata values contain trailing whitespace
- Ngôn ngữ chính
- Python
- Star
- 343
- Fork
- 243
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
### Which service(blob, file, queue) does this issue concern?
blob
### Which version of the SDK was used? Please provide the output of `pip freeze`.
azure-common==1.1.23
azure-storage-blob==2.1.0
azure-storage-common==2.1.0
### What problem was encountered?
Call to ` create_blob_from_bytes()` throws an error [azure.common.AzureHttpError] when any of the metadata values have leading or trailing whitespace.
```
azure.common.AzureHttpError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. ErrorCode: AuthenticationFailed
AuthenticationFailedServer failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:78143b83-701e-0007-57a6-53ca4f000000
Time:2019-08-15T20:14:22.7942254ZThe MAC signature found in the HTTP request '(redacted base64 string)' is not the same as any computed signature. Server used following string to sign: 'PUT 61932 ...'
```
### Have you found a mitigation/solution?
Yes, trim all values in the metadata dict.
Old metadata (throws error):
```
metadata = {'LDate': '6/19/2018 12:15:16 PM', 'DocName': 'Utah Contracts 1 ', 'FileExtension': 'docx'}
service.create_blob_from_bytes(container, name, content, content_settings=content_settings, metadata=metadata)
```
New metadata (no error):
```
metadata = {'LDate': '6/19/2018 12:15:16 PM', 'DocName': 'Utah Contracts 1', 'FileExtension': 'docx'}
service.create_blob_from_bytes(container, name, content, content_settings=content_settings, metadata=metadata)
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Reproduce the failure through create_blob_from_bytes() using metadata with leading or trailing whitespace, as shown in the issue. Trace how the Azure Storage SDK authenticates and signs this request, then verify that uploads with such metadata succeed while the existing example without trailing whitespace continues to work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- cloud
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100