-
Notifications
You must be signed in to change notification settings - Fork 64
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
GSClient auth fails with token-based application credentials.json #390
Comments
Thanks for the detailed report. From what I read, looks like this wouldn't be a breaking change for users that rely on the way things work now, so happy to take the fix you suggested. Do you know if there is a good way to get and test the workload identity credentials? |
You can set up workload identity federation by following this guide: Adding a CI workflow that authenticates using the github action shown in that blog and then runs the live GCS tests should do the trick. Unsure if there's a simpler way to test. |
Any timeline on implementing this? |
@beazerj I don't have a timeline for this—have a few higher priority items I am working on. From my reading, I think the fix might be simpler. Remove this block: cloudpathlib/cloudpathlib/gs/gsclient.py Lines 80 to 81 in 6bce0f9
I think that if that is done, when we call We just need someone to confirm this fix works and submit a PR. I think we probably won't explicitly test the live scenario since getting the config right to do so looks too complicated. |
Just ran into this bug today. Hoping for a fix. |
The following
fails with
This is because the logic in the GSClient init assumes that if a GOOGLE_APPLICATION_CREDENTIALS file exists, it is in the format of a service account JSON key (i.e. the call to from_service_account_json).
When using workload identity federation GOOGLE_APPLICATION_CREDENTIALS is in a different format (see here).
It is possible to work around this with existing functionality, e.g. explicitly creating a google.storage.client.Client or credentials object. However it would be nice if GSClient and GSPath "just work" with workload identity federation. I've been monkeypatching GSClient and GSPath to achieve this in a few projects.
The simplest workaround is probably to replace the call to
from_service_account_json
with a call togoogle.auth.load_credentials_from_file
.The text was updated successfully, but these errors were encountered: