validating meta fields to prevent SQL injection#3511
Open
davidsbatista wants to merge 1 commit into
Open
Conversation
Contributor
Coverage report (oracle)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||
bogdankostic
approved these changes
Jul 1, 2026
bogdankostic
left a comment
Contributor
There was a problem hiding this comment.
Looks good, just one minor suggestion, I'm also okay with merging it as is.
| def _validate_field_path(field_path: str) -> None: | ||
| if not _SAFE_FIELD_PATH.match(field_path): | ||
| msg = f"Invalid metadata field name: {field_path!r}" | ||
| raise ValueError(msg) |
Contributor
There was a problem hiding this comment.
Suggestion: I know we used ValueError also before, but while we're at it maybe we chould change this to FilterError?
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.
Related Issues
FilterTranslator._field_to_sqlwas interpolating filter field names directly intoJSON_VALUE()SQL expressions without any validationProposed Changes:
_SAFE_FIELD_PATHand_validate_field_pathfromdocument_store.pyintofilters.pydocument_store.pyalready imports FilterTranslator from filters.py_validate_field_pathinside_field_to_sqlbefore any interpolationHow did you test it?
test_filter_translator.pycovering the use cases raised in the issueChecklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.