Repository navigation
velociraptor: get_client_flow_results - optional artifact, no IndexError on multi-source artifacts (fixes #458) - #461
Open
chiefghost47 wants to merge 1 commit into
Conversation
…ce artifacts (Shuffle#458) Optional artifact parameter (Artifact or Artifact/Source, validated) is passed to flow_results(); without it the previous return value is kept, but an empty result returns [] instead of raising IndexError.
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
get_client_flow_resultsraisesIndexError: list index out of rangefor artifacts with more thanone source, e.g.
Generic.Client.Info(#458). Without anartifact=argument,flow_results()returns no rows for those, and the method returns
results[0].Fix
api.yaml: an optionalartifactparameter onget_client_flow_results(an artifact name, orArtifact/Source, e.g.Generic.Client.Info/BasicInformation).src/app.py:artifactis set, it is passed toflow_results()and all rows are returned;returns
[]instead of raisingIndexError.artifactis checked against[A-Za-z0-9_.]+(/[A-Za-z0-9_.]+)?before it is placed in the query,so the new input cannot alter the VQL.
There is no behaviour change for existing workflows that get results today.
Testing
Against Velociraptor 0.77.3, calling the app's own methods in an image built with the repo's
Dockerfile:
Generic.Client.Info), noartifactIndexError[], no exceptionartifact='Generic.Client.Info/BasicInformation'artifactvaluex') FROM scope() --ValueErrorbefore any queryLinux.Sys.Users), noartifactThe test image also carried #457 (org_id) so the calls could run in a non-root org. Both PRs change
the
get_client_flow_resultssignature, so whichever is merged second needs a one-line rebase. I'mhappy to do that.
Fixes #458