News for hackers. Stuff that matters.
Re:A Real World React – Htmx Port by ksbrooksjr on Saturday October 15, 2022 @09:33PM (#33220316)
If I were using htmx I would still want to validate data on the client and the server. If you don't validate data on the client, then you're effectively allowing clients to DDOS your server with invalid data.
Re:A Real World React – Htmx Port by deniz-a on Sunday October 16, 2022 @04:59AM (#33222222)
Client side validation does not protect against that. You can't prevent people from making requests to your server without your client, i.e. `curl https://example.com/api --data 'dkfjrgoegvjergv'`.
Re:A Real World React – Htmx Port by ksbrooksjr on Sunday October 16, 2022 @05:20AM (#33222318)
Well yeah obviously. You don't even need curl for that, you can open the dev console in your browser and paste in a fetch request i.e. `fetch('https://example.com/api ', {method: 'get', body: 'dkfjrgoegvjergv'})`. That's not my point.

Client side validation doesn't prevent a malicious user from sending invalid requests, but it can prevent legitimate users from sending invalid data to your server accidentally. In fact, if I see validation failures showing up in my server logs for something I know should have been filtered out via client side validation, I can mark that user as being potentially malicious and rate-limit their future requests.

And as a user I would rather find out about validation issues immediately instead of waiting for a network round trip to the server. If I'm typing in a password for example and it doesn't meet the website's length/complexity requirements, I'd rather know as I'm typing instead of waiting for an HTTP request to complete. That extra HTTP request is wasting the user's bandwidth and the server's resources.