-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Unhandled error in vault read_secret
for anonymous users
#15779
Comments
read_secret
for anonymous users
@nuwang is this what you had in mind ? diff --git a/lib/galaxy/managers/context.py b/lib/galaxy/managers/context.py
index 5c8839f576..de34668609 100644
--- a/lib/galaxy/managers/context.py
+++ b/lib/galaxy/managers/context.py
@@ -214,7 +214,7 @@ class ProvidesUserContext(ProvidesAppContext):
@property
def user_vault(self):
"""Provide access to a user's personal vault."""
- return UserVaultWrapper(self.app.vault, self.user)
+ return UserVaultWrapper(self.app.vault, self.user) if self.user else defaultdict(lambda: None)
@property
def anonymous(self) -> bool:
|
I've tested your suggestion Marius, but now I get this:
(And found a way to reproduce on .fr: just uploading a file as anonymous user) |
I've updated the diff, but I'll let @nuwang comment on this |
I think we should apply the original change you proposed as a safeguard (unless we go for the last fix detailed below). I think a defaultdict will still fail because it will try to call read_secret on it. @abretaud Can you post a snippet of how your filesources conf is using the vault? Usually it would be something like The fix may be to either conditionally access the secret in your template, or we could introduce a NoOpVault where all operations will return null values just to make it easier to deal with the anonymous user case. |
I think something like this in your filesources template might work:
|
I have to go, I can test more tomorrow, but at least here's my file_sources_conf.yml:
|
Yep, tested, that's what happens Tested also with this (adapting your suggestion, I guess we can't access user_vault directly right?)
Getting this:
The NoOpVault seems like a good idea, having to write an |
Hmm... It's not clear to me why that doesn't work, maybe I've forgotten Cheetah syntax, but I agree, it is very awkward. I'll look into adding a NoOpVault, with some suitable log messages as a replacement. |
Hi! Any news on this @nuwang ? It is blocking all our anonymous jobs at the moment on .fr, but a bit too busy to try writing a patch on our own :/ |
#15858 should have fixed that. Thanks @abretaud & @tchaussepied! |
Describe the bug
We're getting this kind of errors in handlers logs:
We have some specific file sources configured, with vault storage, and I suspect this error happens on anonymous users (not 100% sure)
Galaxy Version and/or server at which you observed the bug
Galaxy Version: 22.05
Commit: fa21013
To Reproduce
Steps to reproduce the behavior:
The text was updated successfully, but these errors were encountered: