Validate constructor parameters for dynamically instantiated list views - #6708
Open
SoftCreatR wants to merge 1 commit into
Open
Validate constructor parameters for dynamically instantiated list views#6708SoftCreatR wants to merge 1 commit into
SoftCreatR wants to merge 1 commit into
Conversation
Map query parameters against list view constructor signatures before instantiating the selected view. This consistently validates parameters across the filter action and both list view endpoints, preventing malformed tag IDs and other constructor arguments from reaching downstream code.
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.
List views were instantiated by unpacking unvalidated query parameters directly into their constructors. Scalar values could therefore reach constructor properties and downstream methods with incorrect types.
This caused malformed
tagIDsparameters to reachTagEngine::getSubselectForObjectsByTagIDs(), resulting in aTypeError:This change/PR:
Helper::mapQueryParametersToClass()to map query parameters against a class constructor signature;ListViewFilterAction,GetItem, andGetItems;TaggedArticleListView::$tagIDsas anon-empty-list<positive-int>.Invalid parameters now result in the existing HTTP 400 mapping error instead of reaching the list view or its downstream services with invalid types.