Closed coreymckrill closed 5 years ago
I've added data validation and sanitization in ctx_save_invoice_details
. I didn't use filter_input_array due to the multidimensional aspect of the input data. Please @coreymckrill check the code again and let me know if I need to fix anything 👍
@avillegasn Thanks, this looks good to me. There are still two $_POST
parameters that are called directly before checking if they exist, $_POST['order']
and $_POST['invoice_metas']
. You could probably just add them to the isset
check at the top, though.
This function uses several raw values directly from
$_POST
, most without checking to see if they exist first. It also saves some of these$_POST
values to the database without doing any kind of sanitization first.filter_input_array
to retrieve all of the needed$_POST
values and then bail if any of them are missing.absint
orsanitize_text_field
beforehand. Even if the values are all escaped properly on output, it's better to ensure that the database doesn't contain anything broken or malicious in the first place.