4 ms·
> I wonder if this shouldn't question whether we should still allow all websites to run javascript by default. Plenty of harmful things are done with C and C++
by krapp 9y ago
> I wonder if this shouldn't question whether we should still allow all websites to run javascript by default.
Plenty of harmful things are done with C and C++ but no one is saying we should deactivate native apps written in unsafe languages, or not allow anyone to program a GUI unless they can justify the use of canvas space. Yet the web, arguably the most successful and free (as in both beer and freedom) and accessible software platform yet devised, is the only one on which people - erstwhile hackers - say that code should be a considered a privilege and not a right, or that it doesn't really belong on the web at all, despite javascript being on the web for ~20 years now.
What you're describing seems a lot like adding Windows UAC prompts to the web - no one would find that better, particularly given that anyone can simply turn javascript off in their browser already. This isn't even a javascript problem per se - you could erase javascript from the universe and make the web as plain as you like and Spectre and Meltdown would still exist.
> also at the very least it should lead us to question the chain of trust of javascript. When I visit abc.com I should only execute javascript from abc.com or a subdomain. No script either hosted on a non abc.com domain or appearing in an iframe should be executed.
That seems reasonable, and I would be willing to bet, possible to configure with modern tools. But pretending javascript is a second-class citizen on the web isn't the answer.
- xtanx 9y ago> no one is saying we should deactivate native apps written in unsafe languages No we should definitely not, but we should encourage using something like rust or whatever comes after rust.
- iainmerrick 9y agoThe language is a red herring here. Javascript is a safe language, but it's powerful enough to exploit Spectre and Meltdown. Rust would be the same. It's not badly-written programs we need to worry about in this context, it's well-written malicious programs exploiting badly-designed hardware. We don't need apps written in safe programming languages to fix this problem, we need secure browsers, OSes and hardware. (And yes, those bits should be written in safe languages.)
- cm2187 9y agoRandom, unexpected, untrusted c/c++ written code doesn't execute on my machine every time I browse a website. The only c/c++ code is code I downloaded and installed or that my OS vendor trusted to include in the OS. It's quite different from javascript where the code is literally executing uninvited, often by 3rd or 4th or 5th parties of the website I visit.
- krapp 9y ago>Random, unexpected, untrusted c/c++ written code doesn't execute on my machine every time I browse a website. It does every time you run a native application, for the same values of "random, unexpected and untrusted." >It's quite different from javascript where the code is literally executing uninvited, often by 3rd or 4th or 5th parties of the website I visit. Fine. Turn it off then. That's an option you don't really have in any other runtime, so take advantage of it. But just because you don't want javascript on the web doesn't mean it doesn't belong there when authors choose to include it as part of the content they serve. Also, how exactly does one run "3rd, 4th or 5th party" javascript?
- cm2187 9y ago> Also, how exactly does one run "3rd, 4th or 5th party" javascript? You load a page that includes 3rd party scripts/iframes that themselves load 4th party scripts that themselves load 5th party scripts, etc. You often notice that when you start blocking an ad in your browser and suddenly 10 others disappear at the same time.
- seba_dos1 9y agoNo. Unless the application downloads and executes new code from third parties neither you nor application author can control every time you launch it, it's absolutely not comparable to most of the websites.
- sillysaurus3 9y agoThe only c/c++ code is code I downloaded and installed or that my OS vendor trusted to include in the OS. You never brew install anything? Or brew cask install, or git clone followed by make, or... Even npm install sometimes compiles C. It's hard to get away from c/c++ code.
- UncleEntity 9y ago> ...say that code should be a considered a privilege and not a right, or that it doesn't really belong on the web at all, despite javascript being on the web for ~20 years now. Same could be said about advertising and I'm infringing on all these innocent corporations' natural rights by running an adblocker. For random code to run on my machine a few (IMHO reasonable) steps need to happen: 1) somehow entice me to click on a link 2) get past AdBlock 3) get past Privacy Badger Seems like a privilege to me --and I'm not someone who cares all that much about the shenaganians the big webcorps get up to since I have no money so spend on their ad campaigns anyway.
- Matt3o12_ 9y agoBe aware that Adblock doesn’t block all JavaScript code. It blocks code after people have identified that code X run on website Y does something bad (tracking, ads, etc) and they decided to block it. This works well for visible ads because people see them. For tracking scripts, it still happens because most of them have obvious giveaways (come from a different domain, etc) but chances are that you still run random code because it is better hidden (comes from the same domain and does nothing obvious bad). Just because you use Adblock, malicious code will still be able to run. You are just less likely to notice it because it does nothing obvious so people don’t notice it as quickly and it will not get blocked. If you don’t want to run malicious code at all unless you trust this website, you should probably consider running NoScript.
- UncleEntity 9y ago> Be aware that Adblock doesn’t block all JavaScript code. That's fine as long as it keeps the annoying stuff to a minimum and Privacy Badger seems to do a good job on the tracking stuff.
- Matt3o12_ 9y agoI get that (and that’s why I use it too) but you made it sound like Adblock is blocking malicious code and thus you do not need to worry about Spectre and meltdown, which is defentily not true (though it does prevent some malicious code).
- alien_at_work 9y ago>Plenty of harmful things are done with C and C++ but no one is saying we should deactivate native apps written in unsafe languages, That's not remotely a valid comparison. If I run a native app, I had to get that app somehow and install it. I know it can modify my computer (and probably have to give it persmission to do so). A web page can automatically load other pages, even in the background and do who knows what. For most of the existance of the web we've all had the mental model of "sandbox". We never had that for native apps.
- hnonlyforu 9y agoSame thing could happen to apps. There was a Baidu app in China that secretly downloaded random videos just to eat up the users' data plan, so they will buy more data.
- alien_at_work 9y agoAgain: we've always known that desktop apps were risky and could do anything to our computer (and for years, a lot of "free" windows software installed malware and viruses). We were always told that JavaScript is "sandboxed".
- Nursie 9y ago>> Plenty of harmful things are done with C and C++ but no one is saying we should deactivate native apps written in unsafe languages This is not in any way equivalent to browsing an informational site and having arbitrary code execute. >> Yet the web ... is the only one on which people - erstwhile hackers - say that code should be a considered a privilege and not a right, Hell no, code execution is a privilege in all situations! I don't just download scores of random executables and run them. Do you? >> But pretending javascript is a second-class citizen on the web isn't the answer. Making it one might be an improvement though. There's no way in hell I should be (to give a recent example) browsing a keyboard review and notice that my laptop now sounds like an aircraft about to take off because the site is running something unidentified as fast as it can (likely a coin miner).
- ancarda 9y ago>Plenty of harmful things are done with C and C++ but no one is saying we should deactivate native apps written in unsafe languages Isn't that exactly what a lot of people have been saying ever since Rust started taking off? Every time there's a security vulnerability, someone suggests rewriting the program in Rust, if not some other safe program.