r/shittyprogramming • • Jan 16 '20

JavaScript: it's a security risk

Overheard on a call one of my colleagues just got off of:

Colleague: "So why aren't you able to add our JavaScript to your checkout page?"

Client: "Oh, we disable JavaScript on our entire checkout page."

Colleague: "...why?"

Client: "It's a security risk."

Colleague: <head explodes>

136 Upvotes

72 comments sorted by

View all comments

Show parent comment

1

u/shatteredarm1 Jan 18 '20

It may not make a difference from a browser performance standpoint, but it could lower your bandwidth costs. And if they have the script cached, there's no need for a TCP connection.

I would argue that if the script is expected to change, you really shouldn't be using it at all. It has nothing to do with whether you trust the cdn; they can always be compromised. If the script has to change, the new version should have a separate URL.

Really though, if you're using a bundler, like every modern app I've worked on, it's all moot. Just saying that there's an easy solution to the issue with linked 3rd party scripts being compromised.