velociraptor: guard auth() against get_file() returning None - #455
Open
chiefghost47 wants to merge 1 commit into
Open
velociraptor: guard auth() against get_file() returning None#455chiefghost47 wants to merge 1 commit into
chiefghost47 wants to merge 1 commit into
Conversation
When the worker cannot reach the Shuffle files API (distributed / multi-org runtimes), get_file() returns None and auth() crashed with "'NoneType' object is not subscriptable". Guard it, fall back to treating api_config as the credential contents, and raise a clear error otherwise.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Velociraptor.auth()reads the API credential with:When
get_file()returnsNone— which happens when the worker cannot reachthe Shuffle files API (this is the case on distributed workers and in some
multi-org / suborg runtimes, where the runtime token only permits
/streams/results) — this line raises the opaque:Every velociraptor action then fails with that traceback and no indication of
the real cause, which makes it very hard to diagnose from the execution log.
Fix
Guard the
get_file()result. If it returns usable data, use it as before.Otherwise fall back to treating
api_configas the credential contentsthemselves (so the
api.config.yamlcan be supplied inline in theauthentication field), and raise a clear, actionable error if neither path
yields a credential:
No behavior change for the normal case (files API reachable); it only adds a
fallback and a clear error for the environments where
get_file()returnsNone.Testing
auth()behaves exactly as before.get_file()returnsNonewith inline YAML in the auth field: credentialloads from
api_configand actions run.get_file()returnsNonewith no usable credential: raises the descriptiveValueErrorinstead of theNoneTypeTypeError.