Reputation: 6019
Many tutorials say to place some code in lib/file.js where it can run on both client and server.
Does that also allow the client to modify the code as they like? Thanks
Upvotes: 0
Views: 67
Reputation: 4049
Updating my answer to clarify what David is saying below:
You can change the definitions of any client-side accessible code you want. Server code itself cannot be changed while it's running unless you're using eval()
or are able to mess with the file system from the client. This is important because even if you change the client code to do something that would potentially look malicious, the server code wouldn't execute that code as such since they are defined in two completely separate places (your machine on the client versus the actual server) If you mean can the client can see the code being executed, then yes, they'll be able to see the minified version of anything in lib/file.js.
Upvotes: 1