Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need server side as well as client side validation for Web applications?

Is there any high level reason to have both client side and server side validations for a web application ?

like image 552
Puru Avatar asked Nov 02 '10 10:11

Puru


2 Answers

Because your client side validation may be subverted.

For example - on the web, if you are using javascript for validation, it is very easy to either turn javascript off, or change how it works using tools such as FireBug.

Event with other client/server methods, it is possible for the data link to be subverted and the "validated" data can be changed on the way to the server (Man In The Middle attack).

In general, the maxim "never trust the client" is the reason that you need to always validate on the server.

You may ask in that case, why validate on the client? In order to provide immediate feedback.

like image 147
Oded Avatar answered Nov 22 '22 07:11

Oded


User can modify the validation javascript locally (save the page and do anything with it) or javascript can be turned off in browser. So in this case client-side validation is useless. Hence, you should verify on server too

like image 38
fedotoves Avatar answered Nov 22 '22 06:11

fedotoves