r/shittyprogramming • u/mikaey00 • 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
View all comments
Show parent comment
1
u/Symphonic_Rainboom Jan 18 '20
I still think that linking to external scripts with sri doesn't much sense really, but I admit that's more of an opinion.
If the script is expected to change, of course don't use sri and only link to cdns you really trust. But if the script is not expected to change, I think it makes more sense to copy it to your own cdn under your domain name, which you should probably already have set up to serve images, css, etc. anyways.
Again, just my opinion. One thing that's definitely overblown though nowadays is the caching benefits of loading from a shared cdn, it barely makes a difference now with http/2, and can actually be counterproductive by opening more TCP connections.