Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: azure sas key url encoding #1036

Merged
merged 2 commits into from
Dec 21, 2022
Merged

fix: azure sas key url encoding #1036

merged 2 commits into from
Dec 21, 2022

Conversation

roeap
Copy link
Collaborator

@roeap roeap commented Dec 21, 2022

Description

The object store crate encode the sas key values internally. When passing in an already encoded sas key, they would get double encoded. Since sas keys acquired from the azure portal and azure storage explorer are encoded, and this is "ususally" how a user would get them we decode them before passign them to object store.

I was not completely sure what the desired bahvior should be, alternatively we could update the documentation, to show a sas keys from the portal should be handled.

import deltalake
from urllib.parse import unquote

storage_options = dict(account_name=storage_account, sas_token=unquote(sas))
dt = deltalake.DeltaTable(azure_uri, storage_options=storage_options)

Related Issue(s)

closes #910

Documentation

@dominik7680
Copy link

The proposed workaround

import deltalake
from urllib.parse import unquote

storage_options = dict(account_name=storage_account, sas_token=unquote(sas))
dt = deltalake.DeltaTable(azure_uri, storage_options=storage_options)

does not properly work in latest deltalake-0.6.4.
SIG section in the SAS token ends with %3D, which is = URL encoded

In result, PyDeltaTable is trying to access the URL with removed = from the end.
Ex.:
Original URL Suffix:
image

URL Suffix from the PyDeltaTableError: Signature fields not well formed. exception
image

@roeap
Copy link
Collaborator Author

roeap commented Dec 21, 2022

That is correct. THis issue has been fixed in a previous PR that is on main, but not yet in the released python bindings. #1007

rust/src/builder/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Will Jones <willjones127@gmail.com>
@roeap roeap merged commit ca32496 into delta-io:main Dec 21, 2022
@roeap roeap deleted the azure-sas branch December 21, 2022 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure SAS authorization fails with <AuthenticationErrorDetail>Signature fields not well formed.
3 participants