Lucene search

K
osvGoogleOSV:GHSA-7MV4-4XPG-XQ44
HistoryMar 26, 2022 - 12:14 a.m.

FormField with square brackets in field name skips validation

2022-03-2600:14:34
Google
osv.dev
4
filefield
square brackets
validation
saveinto
php
silverstripe
file upload
controller logic

EPSS

0.002

Percentile

51.7%

FileField with array notation skips validation

The FileField class is commonly used for file upload in custom code on a Silverstripe website. This field is designed to be used with a single file upload.

PHP allows for submitting multiple values by adding square brackets to the field name. When this is done to a FileField, it will be coerced into allowing multiple files by using this notation. This is not a supported feature, though nothing is done to prevent this.

In this scenario, validation such as limiting allowed extensions is not applied, and the FileField->saveInto() behaviour is not triggered. If custom controller logic is used to process the file uploads, it might implicitly rely on validation to be provided by the Form system, which is not the case.

EPSS

0.002

Percentile

51.7%