feat: add created_by filter to ReadAllFlowObjects#1164
Merged
Tati1701 merged 2 commits intogoogle:masterfrom Apr 16, 2026
Merged
feat: add created_by filter to ReadAllFlowObjects#1164Tati1701 merged 2 commits intogoogle:masterfrom
Tati1701 merged 2 commits intogoogle:masterfrom
Conversation
Extend ReadAllFlowObjects with an optional created_by parameter that filters flows at the database level instead of requiring callers to fetch all flows and filter in Python. Implemented in both MySQL and in-memory backends, with input validation in the ValidatingDB wrapper. Includes dedicated test coverage.
Tati1701
requested changes
Apr 16, 2026
Collaborator
Tati1701
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround!
| max_create_time: Optional[rdfvalue.RDFDatetime] = None, | ||
| include_child_flows: bool = True, | ||
| not_created_by: Optional[Iterable[str]] = None, | ||
| created_by: Optional[str] = None, |
Collaborator
There was a problem hiding this comment.
Let's make this one Iterable too, like in other methods.
Contributor
Author
There was a problem hiding this comment.
Done. Changed to Optional[Iterable[str]] across all four files, with IN %s in MySQL and list() membership in the in-memory backend. Test updated to cover multi-user filtering.
Match the convention used by not_created_by: accept an iterable of usernames so callers can filter by multiple creators in a single query. Uses IN/NOT IN symmetry in the MySQL backend and list membership checks in the in-memory backend. Test updated to cover multi-user filtering.
Tati1701
approved these changes
Apr 16, 2026
TristanInSec
pushed a commit
to TristanInSec/grr
that referenced
this pull request
Apr 16, 2026
Now that ReadAllFlowObjects supports a created_by parameter (google#1164), use it to filter flows at the database level instead of fetching all flows and iterating in Python.
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.
Summary
created_byparameter toReadAllFlowObjectsfor filtering flows by creator at the database levelValidatingDBCompanion to #1162, which currently iterates all flows in Python to find one owned by the requesting user.
Test plan
testReadAllFlowObjectsWithCreatedBycovers match, single-match, and no-match casestestReadAllFlowObjectsWithNotCreatedByandtestReadAllFlowObjectsWithAllConditionsunaffected