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
145
u/Earhacker Jan 16 '20
I'm a JavaScript dev and I don't disagree with the client.
A checkout page is just a form. Why does it need JavaScript? And if you expect me to type my credit card details into that form, how can I trust you not to be logging my keystrokes? How can I trust that one of the thousands of NPM packages you've bundled isn't logging my keystrokes?
Oh but you need GTM and Honeycomb and whatever other marketing tools and bug reporting? As a user, how is that my problem?
93
u/pulpyoj28 Jan 16 '20
Well, JS is probably less secure than not-JS.
These folks take security seriously!
32
u/path411 Jan 16 '20
Having externally included javascript on your checkout is always 100% a security risk. Even just adding google analytics on your checkout now increases your security surface to google's platform as well. Sure that's unlikely to happen, but it definitely is an increase in risk. Then, there are plenty of 3rd party javascript that people throw into shopping carts all the time without any real review or consideration. One of those gets pwned and there goes all customers on your site too.
23
u/Symphonic_Rainboom Jan 16 '20
Linking 3rd party JavaScript on a sensitive page is an absolute no-no depending on how well the 3rd party is trusted, so this isn't shittyprogramming at all.
If an attacker compromises the 3rd party, they can just modify the 3rd party script and replace it with a script that does whatever malicious stuff on your website with full permissions of the logged-in user, including capturing sensitive info.
It was probably easiest for the company to say "no js on the checkout pages" than to end up with a checkout page that steals credit card info because it loaded 34 unaudited JavaScript files from 20 untrusted domains.
46
u/Dushenka Jan 16 '20
Okay, not allowing JavaScript due to security concerns equates to shitty programming now?
What's next? "My boss said not to use Java because of its proprietary nature."?
12
u/[deleted] Jan 17 '20
This is good advice unironically
5
u/Shadow_Being Jan 17 '20
it definately is a security risk, most developers receive no training on security and dont do things right. Very easy to leak confidential information via javascript if there is a XSS vulnerability.
3
u/Plasma_000 Jan 17 '20
There have been several instances where JavaScript has been used maliciously on checkout pages to steal creds.
This includes supply chain malware (see magecart) and many other drive by attacks, often coming from dodgy ad services where the ads are also on the checkout.
Iâd say disabling ads on checkouts is a good practice to have standard.
14
u/[deleted] Jan 16 '20
The fact that 'your' JavaScript is not harmful does not make JavaScript 100% safe to inject. By allowing your 'clean' JavaScript you are also allowing your ISP or any other shitty agency to inject JavaScript onto your browser which can cause unforeseen issues.
Maybe your Colleague should take a lesson in Computer Science or Data forensics if his head explodes from something like this.
JavaScript sucks. Big time! There I said it.
1
u/EkskiuTwentyTwo Jan 17 '20
You can technically make a program with css. It's just overly cumbersome to do so.
-11
u/elloGuy Jan 16 '20
This is a terrible thread... i hope never have to cross any of these so called developers who think javascript is shitty. The web runs on JS, get on with it already.