mercredi 13 mai 2020

Require high level code architecture understand: React, Nodejs - revalidate data on submission if previously validated?

Disclaimer: I don't work at a development shop so I am trying to understand how I should implement an upload portal. As well, learn about the best practices.

What is it:

Front-End: React.js Back-End: Node.js + AWS s3,RDS,lambda

The application takes a CSV file, parses and validates it based on set data value requirements. Then if validation passes, sends a confirmation and the parsed data as object back to the front-end.

If the validation fails, then another component will render showing the error message, and as well allow the user to go back to main screen (Screenshot A) and select another file.

Throughout the entire process, as long as user does not delete the file in dropzone or refresh the screen I am keeping a copy of the actual raw file data in my redux store.

First point of validation: When user selects the file from react dropzone and clicks next

Screenshot A - first step of upload step enter image description here

The problem

Considering I already have a copy of the raw file in redux store, on submission (Screenshot B) should I take that raw data and validate it again before proceeding to submit it to s3 etc?

Screenshot B - confirm page before submission

enter image description here

Why I ask

Is there security implications to me keeping the raw file data in redux throughout the process? Would it get manipulated? What is the best practice in terms of validation, should it always be validated before inserting into DB etc even if previously validated?

Aucun commentaire:

Enregistrer un commentaire