For example, if the length and type are done in the frontend, is it necessary to verify them in the backend?
For example, if the length and type are done in the frontend, is it necessary to verify them in the backend?
Doing it on the front end can improve the user experience and reduce unnecessary network overhead when the content is illegal, but doing it on the back end is the most important. Only back-end verification can ensure security and reliability. If we take a step back, we don’t have to do the front-end, but the back-end must also do it.
Never trust user input.
Special backend must filter when interacting with the database.
Since I came into contact with web development, what the experts have told me the most is “永远不要相信用户的输入”
, so back-end verification is an inevitable event
The backend must do it, the frontend does not need to do it, but for the sake of user experience, the frontend still needs to do some filtering
The back-end program should never trust the data input by the front-end user
SQL injection and stored XSS are all produced in this way
The back-end must filter and limit the data passed by the front-end and then process the business logic and store it in the database
Front-end filtering can be bypassed by users, but back-end filtering is necessary
Front-end filtering is to improve the user experience, and this is not necessary
Front-end filtering is to be user-friendly and let users know if they have filled in incorrectly.
Background filtering is to enhance security. Who knows what data hackers will stuff into you.
Don’t think that all the people who come to visit are good users. Hackers also come. They try to detect that your data check is only on the front end, and the back end is not fortified. It is not certain when they will take down all your servers.
In fact, if you are not afraid of high server pressure and poor user experience, you don’t have to do it on the front end, but you must do it on the backend!
The background is done for program logic and data security
The front-end is done to improve the user experience
The background must be done, but the front-end does not need to be done