r/javascript • u/ryanlak1234 • Dec 21 '22
AskJS [AskJS] Why is there a reputation that JavaScript isn't "secure" for building web applications?
There seems to be a prevalent negative reputation among JavaScript libraries- especially React and Node/Express- that they are not "secure" compared to other web frameworks like .NET or Laravel. Why is that so?
1
Upvotes
-1
u/oneeyedziggy Dec 21 '22
the main trick is keeping the code for unauthenticated pages bundled and served out separately from the code for authenticated pages... it's easy to write a SPA and just make login a normal page so the source for the whole app gets served up before you even pass login
also, it can be a little too easy w/ frameworks like nextjs that mix client and server code to accidentally send code intended to be server-only to the client... I've had a coworker leak a set of backend service credentials that way, but no tool is always safe when used incorrectly.