Problem 1: A text-sharing platform was coerced into being a sandboxed pseudo-distributed virtual machine.
Problem 2: The way this virtual machine is built and re-built for each "app" is terrible (wasteful, overkill, overbearing).
You might think 1) is a fait accompli, but it continues to impact and create issues downstream in so many areas (security, privacy, usability etc etc) because the platform was simply not built for what we're making it do.
When I make a web app, it's specifically because i want it to run in a sandboxed pseudo-distributed virtual machine that installs and runs in less than a second, and is removed automatically after some time has passed.
My users don't want to download and install a binary onto their PC, they don't want to have to manage any dependencies I may rely on, they don't want to have to configure anything, they just want to use my app ASAP in a safe manner and then go on with their lives.
If i gave you 2 options, which would you choose?
1. Download and execute this binary blob on your PC.
2. Run this javascript in your browser.
Option 1 provides little protection. I could access GPS, camera, microphone, disk, etc... without as much as a single prompt. And if the PC's permissions are messed up, i can even access other programs' data and even manipulate them.
Option 2 provides permission-locked options to access a lot of those, in a language which was designed to be sandboxed, in a browser with exactly the same amount of permissions as Option 1 (so even if all the permission-locking measures failed or were bypassed, the app is still bound by the same permissions and restrictions as option 1 would be). It installs itself in seconds, it runs fast enough for most use cases, and is cross-platform in a way that nothing else ever has been able to even come close to before.
Javascript wasn't "designed to be sandboxed", it was designed (in something like a week) to move crap around an html page. It then grew and mutated in the frankenvm we all "enjoy" today; which is why all these "security features" that were tacked on (like xmlhttprequest, same-origin, "secure cookies" etc etc) are constantly failing and require more and more hacks to keep up appearances.
> My users don't want to download and install a binary onto their PC
Your users were absolutely fine with Flash, and if Macromedia had not gone to the dogs after the Adobe acquisition, they would likely still be. They were fine with ActiveX objects (in fact, they loved them!). Your users don't know the difference between markup and binary blobs, they just don't care. By shoving scripts down their throat "because the browser starts faster than a java applet", we simply abuse their good faith. Maybe you could have claimed "javascript is more secure" back in 2001, when 99.99% of scripts out there were perfectly readable with view-source; in the age of minifying, obscuring and compiling, that's simply not true anymore. Javascript is now effectively the same as a binary blob, the only difference being that Google, Microsoft and Mozilla do some of the bootstrapping for you. Hell, even HTTP/2 is now binary!
Please, don't try to claim a moral high ground that was lost 10 years ago. We've decided to abuse the browser-donkey, fine; but let's not delude ourselves that there was some grand design or logic behind it all.
> Option 1 provides little protection. I could access GPS, camera, microphone, disk, etc
Yeah, because the browser today cannot access GPS, camera, microphone, disk... oh wait. In Microsoft land, the browser can even bork your entire system!
These problems are problems because we're using the wrong tools to find solutions to a different class of problems altogether. In so doing, we've perverted what was a wonderful document-oriented system. The browser was not born to run apps, but we've decided it's good enough to do it anyway, logic be damned. This comes to mind: https://www.youtube.com/watch?v=aXQ2lO3ieBA
>all these "security features" that were tacked on (like xmlhttprequest, same-origin, "secure cookies" etc etc) are constantly failing and require more and more hacks to keep up appearances.
I don't see those security features or anything like them in any other platform, and that's my point. Regardless of how we got here, the browser is a platform that i feel MOST comfortable executing random code from the internet on because of those restrictions. If i'm going to execute code, the next best alternative is pretty poor. Obviously they aren't perfect, but they are more things that need to fail in order for something bad to happen.
Also, since when is an evolution of a product considered "more and more hacks"?
Is anything that wasn't included in Linux 1.0 a hack?
> Javascript is now effectively the same as a binary blob
I 100% agree that modern JS payloads are basically binary blobs at this point, that's why i compared them to binary blobs... I'm saying that the language (more the "standard library" that js running in the browser has access to) is meant to be run by everyone in a secure and safe manner. That is something that just about no other language/platform is designed to do today. Yes, there are ways you could make something like python for instance safe enough to allow random websites to execute code on your PC, but that is going to be much riskier because the language is not meant to be run that way (not to mention that it won't be even within a few magnitudes as "battle tested" as javascript is).
>Yeah, because the browser today cannot access GPS, camera, microphone, disk... oh wait.
You can't just quote the parts of the sentence you like and ignore the rest. The very next words were "without a single prompt". The browser has those features and more permission-locked (and more recently enabled only for TLS secured pages), just about all desktop platforms don't even have the concept of "access to webcam" permissions, most mobile platforms are pretty on-par in this aspect, but even they don't have restrictions like requiring the user confirm if the app wants to store more than like 10mb of data on the disk in a permanent manner (which all major browsers do).
>In Microsoft land, the browser can even bork your entire system!
And i'm in no way advocating for that... Most of the web community and all browser vendors are moving away from dangerous plugins/extensions like those that were used in the 90's and early 2000's. Bringing up microsoft specific extensions like activex (or even flash!) in a discussion about web development in 2016 is just building yourself a strawman to kick down. That's not web development any more than running a program in x86 real mode is current desktop application programming.
>In so doing, we've perverted what was a wonderful document-oriented system.
That wonderful document-oriented system still works just fine.
I get that you don't like the web, but arguing that it was a mistake is completely missing the point. The language and the platform has evolved since it's inception, and these evolutions aren't mistakes, they are changes made by all major browser vendors as well as multiple standards bodies in an effort to improve it. You may not like that it's changing, but it's no mistake. Javascript is designed to be a sandboxed, quick, programming language regardless of what it's "first inception" was meant to be, and the web is designed to be an application platform regardless of how much you don't want it to be one.
... except the ones that were built exactly for the purpose of being sandboxed VMs: java applets, flash, mobile apps etc. The browser might have more prompts now simply because Microsoft showed everyone how not to do it with ActiveX, but it was not designed that way.
> just about all desktop platforms don't even have the concept of "access to webcam"
That's staggering ignorance, sorry. Why do you think you have groups like "cdrom" in Linux?
No, sorry, you can try with other arguments (standards, design in the open, whatever), but security really has nothing to do with why JS got where it got or why we use it today.
> That's not web development
No, that's exactly "web development" as you understand it (i.e. building "apps"), just on previous iterations. What you do today in JS was done yesterday with plugins; but nobody could agree on a single architecture (too many salespeople influencing the process), so the community took it upon itself to standardise on the minimum common denominator (JS) no matter how bad it was -- it was the only thing browser vendors could agree on (and even then, barely). JS managed to jump on the "standard" bandwagon that HTML+CSS spearheaded, and found itself as The Blessed VM. And here we are.
> That wonderful document-oriented system still works just fine.
No, it goddamn does not, hence the rant. loads of mainstream websites simply do not work without JS anymore, even when they are simply supposed to show me some text. I have to trust umpteen third-party spynalytics websites just to read a couple of football scores.
The document-oriented system is dead and buried. We are left with the JS frankenvm.
> I get that you don't like the web
Read my top comment again -- I love the web, and that's why this involution is hurting me.
> these evolutions aren't mistakes
No, in most cases they are simply accidents of history like XMLHttpRequest.
> the web is designed to be an application platform
No, the web has mutated in an application platform. Big difference.
In a way, it's another wonderful metaphor for human nature: the evolution of web technology has been as messy, inconsistent and accidental as most human history. There is no rising sun, there is no grand plan: evolution is random and all political or religious systems are equally broken... we simply agree on the minimum set of norms necessary to avoid stabbing each other in the face, and then we call it a masterpiece of divine design that we obviously wanted all along.
Screw this, it's 2AM and tomorrow I have to work to pay a mortgage. Have fun, you silly kids.
Sorry, my comment ended up being more aggressive than i wanted, and i apologize. But I really do want to keep having a bit of a discussion without it dissolving to insults. Clearly we both think we are right, and i'm curious where the disconnect is.
>... except the ones that were built exactly for the purpose of being sandboxed VMs: java applets, flash, mobile apps etc.
But most of those are gone now (or at least gone from "popular" usage, and for good reason), and while mobile apps are still around and aren't going anywhere they aren't nearly as locked down as something like a web app is. When comparing mobile apps and web apps, i'm not saying one is better than the other, just that they are different.
>The browser might have more prompts now simply because Microsoft showed everyone how not to do it with ActiveX, but it was not designed that way.
Then current browsers were designed with more prompts... Maybe not from version 0, but their current versions are designed to have them.
>That's staggering ignorance, sorry. Why do you think you have groups like "cdrom" in Linux?
Now i'm not nearly as knowledgeable about linux as i should be, but I thought those groups all had to do with file access. I've installed applications and had them access GPS hardware, cameras, microphones, and more without a single prompt on multiple linux platforms (as well as windows). Is there something i'm missing there, or were my systems just not configured correctly?
>No, that's exactly "web development" as you understand it (i.e. building "apps"), just on previous iterations.
But again, that's like comparing current desktop/server application development with x86 real mode applications. Yeah, that was how it was done in the past, but it's not how it's done now. I agree with the rest of that statement though, JS was pretty awful, but it's grown significantly and I wouldn't call current day JS bad by any means. It definitely has it's warts (more than many other languages, but it is extremely capable and it's becoming a language i reach for more often than not. Once people successfully started writing non-trivial server side code in JS instead of alternatives that argument kind of goes out the window IMO.
>No, in most cases they are simply accidents of history like XMLHttpRequest.
I wouldn't call XMLHttpRequest an accident. It was designed to allow script access to Http Requests... And then it was adopted by other browser vendors because it was great functionality. There were mistakes in web development and javascript (like automatic semicolon insertion making it's way into the standard), but things like XMLHttpRequest wasn't one of them.
>No, the web has mutated in an application platform. Big difference.
Regardless of the terminology that you want to use, it is an application platform, and a very capable and secure one. It's far from perfect and it is still rapidly changing, but arguing about how awful it was in the past isn't going to make anyone's lives better. Like the linked article is saying, let's try to work on making sure that things get better in the future. Personally, I really like the direction everything is heading (with only a few exceptions).
I find this whole line of reasoning disingenuous. A prompt doesn't make something to be 'designed securely' - sure it helps, but the same mechanism used to provide security prompts on a VM is applicable to providing security prompts on a 'proper' OS - whether your particular implementation of Machine, virtual or otherwise, has implemented those prompts (correctly), be damned.
Basically your whole argument boils down to "I like VMs and that's why we should be allowed to write crap inside them". No. I'm on the "old fart's" side here, although I'm pretty young myself (my peers are full of the class of idiots like yourself) - the semantic web was never meant to be an app distribution platform. We did NOT upgrade to html5 so that we could have more cat videos, the whole point of the internet was to build networks of data, not networks of incredibly crappy newspaper articles.
Consider that Google probably would not have had as much success today if the web were an app consumption platform, first and foremost. "But Google's Dead, Facebook and Apple!" you cry - well yeah, good luck with that, when you have 20 crappy apps that don't work and no way to find a solution to the crap the idiot hipsters have shoveled on you, how are you going to find a solution to your problems again?
Hmm?
Not sure why you brought up mobile, but anyway... mobile OSs have very fine-grained policies and sandboxes that can lock apps down as tight as any website. The problem is that most of them get waived away by lazy developers and unsuspecting users, and walled gardens' owners have an interest in not bothering developers too much (for fear of losing them). It was like this for browsers as well, when they were an IE monoculture; and it will likely go back there if Mozilla ever croaks under pressure from Google.
> Then current browsers were designed with more prompts
Yeah, but current browsers are part of the problem: they've decided to be runtimes, so they will act as runtimes. People who want document browsers have been left by the wayside. That is my point in a nutshell.
> I thought those groups all had to do with file access.
Of course: standard Unix philosophy is that everything is a file, including your devices; so they were secured as such.
> Is there something i'm missing there, or were my systems just not configured correctly?
Linux desktops can be locked down to various degrees; there are so many different ways to enforce policies on all sorts of things (from traditional permissions to ACLs to SELinux to PolicyKit and whatnot). What distributions decide to allow out of the box is due to their target markets. Try doing the same on OpenBSD, to see what life is when a system is completely locked down by default: you'll have to explicitly authorize many, many things...
> Yeah, that was how it was done in the past, but it's not how it's done now.
The point is, the aim of the effort is the same; but since people couldn't agree on the best way to do it, it was done on the most politically acceptable way, piggybacking on a system that was not designed for it but that nobody could object to. It's a bit like QWERTY: a keyboard layout nobody ever liked, but that somehow became The One Way To Type. JS was retrofitted to replace plugins and be the "web runtime" for everyone. In a way, that was the objective that Firefox pursued almost from the start, although it came to life in a slightly different way from their specific implementation.
I'm not saying JS is completely bad, but that it was clearly designed for "quick and dirty" scripts and it shows. There is very little philosophy, very few stylistical choices in the core language beyond "it has to be OO" when OO meant Java and Smalltalk. It's to "mainstream" OO languages what PHP is to C: a quick hack to use a familiar syntax in a context where the original cannot go. Sure, it's evolved and we can use it to do all sorts of things (which is not at all a recent development, btw; Netscape had a server-side product almost from the beginning), but its roots are undeniably weak. The fact that we need rocket-science VMs on state-of-the-art processors to move a few boxes with it (slowly) IMHO is proof enough.
>I wouldn't call XMLHttpRequest an accident.
It pretty much is. Microsoft's vision for it was a mechanism to fetch XML and mash it with XSL, which is what the web was supposed to become at one point. It became a way for the runtime to interact with any networked resource, for all sorts of purposes (loading other code, APIs, authentication, tracking, data etc etc) without having to reload the full layout.
But again, it did not come from "the web runtime camp" and it wasn't even a JS thing (it was a COM object): it was a cool feature added by a browser vendor with a completely different view of what the web should be, but it was retrofitted because it sorta worked. They had to tack-on same-origin limitations because originally it was ripe for abuse, and tbh even now it looks a bit silly when compared with any other mainstream language http-request implementation. Random evolution at its finest.
I say this as someone who, when "ajax" started to become a buzzword, was like "oh yeah I've been pushing that concept for ages". I just think we've gone too far.
> Personally, I really like the direction everything is heading (with only a few exceptions).
Well then, to each his own :) personally, I'd very much prefer to start again with a clear separation between "content browser" and "application runtime". You can have your runtime, but let me read content in peace without having to execute anything. Which is why I've always liked RSS: I fetch the content and then I'm free to read it as I damn well like. Beside, a runtime rebuilt from scratch could do cool things like supporting multiple languages by design, an extended stdlib, proper sockets, etc etc, removing the need for the current "selection of features by marketing popularity" process that produces framework over framework over framework.