Answer:
You can’t do anything about HTML, against someone who opens the firebug and comes out modifying things.
Explanation:
You can only have security if you validate on the Server, because any method you use with javascript or html the same method the "firebug guy" can also do. IE, there is no way, have to validate in Server, then you will have security.
However, you should do the validation in the client (with javascript) and also in the Server, it is always safer this way.
Tip: You can use "trickery" to make it difficult on the client side, for example:
Let’s say every field has a certain "attribute required for submission" that would be something you invented. Then you would validate each field with its respective "attribute required for submission" for example:
<input type=text data-required="HFG2#4DF@">
This would be a valid field for having the one data-required
, then we would have a disabled field:
<input type=text disabled>
Even if the firebug user goes to it and removes the disabled attribute, it will not work because, you check if all fields have this data-required using:
if ($(seuInput).attr('data-required') == "HFG2#4DF@")
//submete o formulário
else
//não submete o formulário.
Then it would be impossible to send such a field if you do not put the invented attribute.
Note: this HFG2#4DF@
is just one example that you can make life difficult for someone by having them dig through and understand their javascript codes in order to submit this field.
There are also several ways to do these things, for example you can put a different ID for each field and use one data-required
different for each one that could be the MD5 Code of the ID of each one, or else a Base64 of the ID of each one.
But of course, this will affect performance a bit and is only used if you really want to make it difficult to submit the form at this point, it’s not that it is recommended to do this, it’s just optional.
because you do not remove the html button?
– Maicon Carraro
@Maiconcarraro even hiding the button the malicious user can submit the form by JS.
– Philippe Gioseffi
@Philippegioseffi did not say hide, but remove, because he is sending an HTML to the client with the button?
– Maicon Carraro
@Maiconcarraro hide or remove the button is the least of the problems, because hidden or removed from the screen the form can be sent via JS by a malicious user.
– Philippe Gioseffi
@Philippegioseffi but if removed as the guy knows he has to send something?
– Maicon Carraro
@Maiconcarraro to have some malicious interaction only by submitting the form to the server.
– Philippe Gioseffi