Fix validation of REST array parameters. #1768
Merged
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.
Description
This PR fixes a bug in the validation of REST parameters in the
getParam()
method ofBaseControllerProvider
in which array parameters were not properly caught as being invalid.filter_var()
was returningfalse
but only being checked fornull
.This PR also fixes a bug in
XdmodApplicationFactory
with processing array POST data that was exposed when testing the bug above; if non-string data was sent in a POST, it would still attempt tojson_decode
it. Now, instead, it decodes that data as null.This PR also adds the ability to make
PUT
requests withXdmodTestHelper
, which is needed by ubccr/xdmod-appkernels#95.Tests performed
This PR adds integration tests of array parameters for endpoints that call
getParam()
.Additional integration tests are added in ubccr/xdmod-appkernels#95 and ubccr/xdmod-supremm#350.
I developed the tests incrementally while running in the
tools-ext-01.ccr.xdmod.org/xdmod10.0:rockylinux8.5-0.5
Docker container upgraded to the latest XDMoD.Also, in a Docker container running
tools-ext-01.ccr.xdmod.org/xdmod-10.5.0-x86_64:rockylinux8.5-0.3
:/before.txt
and/after.txt
and make sure the differences are correct:ControllerTest::testEnumTargetAddresses
.MetricExplorerTest::testCreateQueryParamValidation
.MetricExplorerTest::testUpdateQueryByIdParamValidation
.UserControllerProviderTest::testUpdateCurrentUser
.AuthenticationControllerProviderTest::testGetIdpRedirect
.DashboardControllerProviderTest::testSetLayout
.DashboardControllerProviderTest::testGetStatisticsParamValidation
.WarehouseControllerProviderTest::testCreateSearchHistory
.WarehouseControllerProviderTest::testGetHistoryById
.WarehouseControllerProviderTest::testUpdateHistory
.WarehouseControllerProviderTest::testDeleteHistory
.WarehouseControllerProviderTest::testDeleteAllHistory
.WarehouseControllerProviderTest::testGetDimensions
.WarehouseExportControllerProviderTest::testCreateRequestParamValidation
.AdminControllerProviderTest::testResetUserTourViewed
.DashboardControllerProviderTest::testSetViewedUserTour
.WarehouseControllerProviderTest::testGetSearchHistory
.WarehouseControllerProviderTest::testSearchJobs
.WarehouseControllerProviderTest::testSearchJobsByPeers
.WarehouseControllerProviderTest::testSearchJobsByTimeseries
.WarehouseControllerProviderTest::testGetAggregateDataMalformedRequests
.WarehouseControllerProviderTest::testGetDimensionValues
.WarehouseControllerProviderTest::testGetRawData
.Checklist: