r/javascript • • Mar 20 '15

[whatwg] HTML6 proposal for single-page apps without Javascript from Bobby Mozumder on 2015-03-20

https://lists.w3.org/Archives/Public/public-whatwg-archive/2015Mar/0071.html
6 Upvotes

50 comments sorted by

39

u/LossFor Mar 20 '15

This sounds.... Horrifying.

20

u/m1sta Mar 20 '15

And unnecessary.

26

u/Knotix Mar 20 '15

More advanced link URLs could include SQL statements - “<A href=“http://...“>" becomes “<A href="sql:select from *”>"

Is this guy for real? Do they let just anyone make feature proposals?

6

u/[deleted] Mar 20 '15

You forgot <a href="sql:select * from table" user="hiMom" secretPassword="dontlookhere"></a>

10

u/zayelion Mar 20 '15

I want to say no,... this breaks more than it fixes. Data being loaded via a channel usually has to be studied a bit by the javascript and it usually preforms more than 1 action.

10

u/fbatista Mar 20 '15

The scary part to me is how the hell does this get voted up... i would understand if this was /r/funny ...

7

u/SaadRhoulam Mar 20 '15

More advanced link URLs could include SQL statements - “<A href=“http://...“>" becomes “<A href="sql:select from *”>".

The author has no concept of web security.

0

u/[deleted] Mar 22 '15

The author has no concept of web security.

And you do?

How exactly is someone going to gain access to your server and modify the html files on it? I'd really like to know.

2

u/SaadRhoulam Mar 22 '15

Here, get familiar with this.

The part I quoted is a proposal to create the easiest SQLi vulnerability of all time.

How exactly is someone going to gain access to your server and modify the html files on it?

One wouldn't have to do that. You can fire up the MySQL client and connect to the remote DB with the credentials you found on the page source, or you can save the page, edit the SQL queries in the HTML, and open the local file in your browser.

That's what "client-side" means: your pages and scripts are being downloaded, potentially altered, and parsed on a computer under someone else's control. If you haven't learned it already, you're learning it now: never trust the client.

0

u/[deleted] Mar 22 '15 edited Mar 22 '15

I've been programming for over 30 years, I know what SQL injection is.

But you are implying that someone would be stupid enough to put the database passwords in the html file.

It would not be necessary to include passwords in the html, but still allow SQL queries to run. The passwords can and should be kept private.

Your supposition that passwords would also be included in the HTML file that has SQL queries, is just wrong thinking. Passwords were never mentioned in the article at all, so your reaction seems a bit knee-jerky.

I'm not saying it's a good idea to put SQL in the HTML, far from it, but your idea of security is clouding your view of what the article is suggesting, which doesn't say anything about putting database passwords in the same publicly available file.

Let me give you a hypothetical situation as an example.

When a web server is serving an html page that has SQL queries embedded in it, it doesn't serve the page to the client and then the client does the database lookup. No. The server parses the HTML page, if it finds any SQL statements it would then connect to the database using the passwords stored privately on the server, then it would populate the HTML page with the returned data, and then serve the page to the client. The SQL statements could even be removed before the page gets sent to the client. There is no need to send the SQL queries to the client, nor the passwords to the database.

But, this is not even what the article is trying to explain. It's not saying that the SQL would be used to connect to a database server.

1

u/SaadRhoulam Mar 22 '15

How do you propose the client authenticate with the database in order to run the SQL query, then?

1

u/johannL Mar 24 '15

With a publically known username and password for an account with, let's call it "guest privileges". How else?

What makes you think there's only "full access" or "not authenticated"?

https://www.google.com/search?q=sql+grant+syntax

1

u/SaadRhoulam Mar 24 '15

I don't think well-crafted database grants can handle things such as only allowing a user access to their own record, stored as a row on a table of all users' records, and not the entire table. If you were able to structure a database to enable that, I wonder what the performance ramifications would be.

In any case, it turns out OP didn't have that in mind, and that I misread their motivation behind the proposal; they were talking about running SQL queries against a local database from HTML. I still think it's a bad idea, though not for the reason at the top of this subthread.

1

u/johannL Mar 24 '15

Well yeah, of course it's a bad idea, I was just playing devils advocate really.

0

u/[deleted] Mar 22 '15

I don't think the article is suggesting that SQL is to be used in the way you think it is. It mentions a 'local database' for caching. It doesn't say anything about passwords, or connecting to remote databases.

1

u/SaadRhoulam Mar 22 '15

You're right that I took the quote out of context; the only instance of "database" in the OP is preceded by "local". A more careful reading shows that the author didn't intend to have exposed remote databases being queried by clients.

Re: your edit

The server parses the HTML page, if it finds any SQL statements it would then connect to the database using the passwords stored privately on the server, then it would populate the HTML page with the returned data, and then serve the page to the client.

So "HTML6" is partially reinventing PHP.

1

u/johannL Mar 24 '15

And even then, that wouldn't have to imply "full access".

7

u/AlGoreBestGore Mar 20 '15

I propose we switch back to Flash and Java Applets in HTML6.

4

u/andersevenrud github.com/andersevenrud Mar 20 '15

This is some kind of joke...right ?!

-2

u/x-skeww Mar 20 '15

It's like,
super cereal for reals.
Because reasons.
#strokehaiku

2

u/sgndave Mar 20 '15

I understand the opposition (at least several of the arguments), but this is probably something best solved by the browser, not by ad-hoc javascript implementations.

The counter-example I would point to is the [whatwg datetime input](https://html.spec.whatwg.org/multipage/forms.html#date-and-time-state-(type=datetime)). Instead of every datetime input doing their own, ad-hoc, slightly broken, non-accessible implementation, we do it once and let the semantics take over.

Channeled loading makes sense to hand off to the browser, since the browser would know best how to handle it: pipelining, parallel requests, or the server could eagerly send it (HTTP 2.0 does this). The JS implementations are just as much a hack as dynamically adding image nodes instead of using <img>.

2

u/[deleted] Mar 20 '15 edited Mar 20 '15

Do keep in mind that the datetime input was introduced around 3 years ago and still has no traction or buy in from anything outside of Blink. Similar to this, to cover a wide array of necessary features it would become far too bloated. Meanwhile there are plenty of patterns available mixing other available HTML standards with JS standards.

1

u/sgndave Mar 21 '15

Hey, hard problems are hard to solve. No arguments there.

My view is that it's better to handle native things natively. Input controls are a great example, so is network handling. At best, Javascript is just mimicking what the browser itself could do much better.

1

u/danyamachine Mar 20 '15

i was under the impression that Web Components - currently in the works - are supposed to create some of that functionality

1

u/[deleted] Mar 20 '15

Apparently this guy didn't read the memo that there will be no "HTML6" and there isn't even a recognized "HTML5" by WHATWG since 2011. Hell, it's in section 1 of the HTML spec...

0

u/[deleted] Mar 20 '15

[deleted]

2

u/[deleted] Mar 20 '15 edited Mar 20 '15

Please note that I said "by WHATWG", which is what OP posted a link to.

An "HTML5" spec was released by W3C, not by the people who have actually been leading the new standards and what's commonly referred to as HTML5. Please feel free to read the history in both groups specs yourself:

https://html.spec.whatwg.org/multipage/introduction.html#history-2 http://www.w3.org/TR/html5/introduction.html#history-0

From WHATWG:

For a number of years, both groups then worked together. In 2011, however, the groups came to the conclusion that they had different goals: the W3C wanted to publish a "finished" version of "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously maintaining the specification rather than freezing it in a state with known problems, and adding new features as needed to evolve the platform.

Since then, the WHATWG has been working on this specification (amongst others), and the W3C has been copying fixes made by the WHATWG into their fork of the document (which also has other changes).

From W3C:

For a number of years, both groups then worked together under the same editor: Ian Hickson. In 2011, the groups came to the conclusion that they had different goals: the W3C wanted to draw a line in the sand for features for a HTML5 Recommendation, while the WHATWG wanted to continue working on a Living Standard for HTML, continuously maintaining the specification and adding new features. In mid 2012, a new editing team was introduced at the W3C to take care of creating a HTML5 Recommendation and prepare a Working Draft for the next HTML version.

Since then, the W3C HTML WG has been cherry picking patches from the WHATWG that resolved bugs registered on the W3C HTML specification or more accurately represented implemented reality in UAs.

If you track the features of the last few years, you'll find that WHATWG has been at the forefront of modern HTML. W3C is still trailing behind and taking snapshots of their work and attempting to stay relevant with versioned releases, as opposed to the "Living Standard" approach that WHATWG shifted to in 2011.

Considering he submitted to WHATWG and not W3C, he should have known that there will be no HTML6 and that the group doesn't even recognize HTML5 as anything more than a buzzword. At the very least, read 2 paragraphs into the spec itself...

Section 1.2 from WHATWG's HTML spec, "Is this HTML5?":

In short: Yes.

In more length: The term "HTML5" is widely used as a buzzword to refer to modern Web technologies, many of which (though by no means all) are developed at the WHATWG. This document is one such; others are available from the WHATWG specification index.

Lastly, "HTML is the new HTML5": https://blog.whatwg.org/html-is-the-new-html5

1

u/_basem_ Mar 21 '15

Just for reference purposes, Facebook is doing something similar - in core idea - with Relay+GraphQL but much better and not a standard proposal

Relay+GraphQL

1

u/x-skeww Mar 20 '15

Arbitrarily paired quote characters! Bestest feature ever!

"PeNgU1N oF d00m"-style quotation. Such random. Wow.

-1

u/calsosta Mar 20 '15

I think what this guy actually wants to say but doesn't realize it is, we need to define a NEW language/architecture that better combines the imperative and declarative parts of web development.

The fact is we have HTML and JS and they only link between them is created by the browser. So if that is the case then we need to re-architect the way the browser works to directly link the two. Make HTML natively extensible, and build in the features that make sense for building web APPLICATIONS and not just web SITES.

I think something like http://breach.cc/ is on the right track.

I know I am in the extreme minority on this one but before you downvote this, think about it and if you disagree then say why.

0

u/[deleted] Mar 20 '15

[deleted]

18

u/Knotix Mar 20 '15 edited Mar 20 '15

The guy clearly has no experience doing anything in JS. He sounds like someone who read a few framework tutorials, got confused, and just dreamed up this whacky solution. Here are some reasons as to why it's awful:

  • Most importantly, this is the opposite of the purpose of HTML. HTML is a markup language that defines a document's structure and has nothing to do with "apps". The application side is left up to JS, and styling is up to CSS. Having these functions overlap leads to a chaotic mess.

  • Most calls to the server to get data are usually passed through more logic in JS to convert values, calculate totals, etc. So this non-JS approach is only good for static content.

  • He suggests allowing SQL statements in the href. This is the worst idea possible and makes me think this whole proposal is a joke. It is completely and utterly susceptible to SQL injection (Anyone could change the query to "SELECT password FROM users"). Plus, SQL isn't the only database language, and favoring one language is against the idea of the W3C. Additionally, this also implies there's no standard way to send data back to the client. SQL certainly doesn't output data that looks anything like that weird XML format he uses, so you'd have to have some way to specify it.

  • Lack of flow control (if, while, for) severely limits the usefulness of this and would mean you have to resort back to JS anyway to accomplish these tasks. Existing templating engines like Handlebars solve this problem already.

All of this could just as easily be accomplished in JS in a much more flexible way that supports all back-end systems.

-4

u/[deleted] Mar 20 '15 edited Mar 20 '15

Not that I think this guy's proposal is a good idea, but I can't find a single actual problem with it in your response.

The guy clearly has no experience doing anything in JS. He sounds like someone who read a few framework tutorials, got confused, and just dreamed up this whacky solution.

That's name-calling and nothing more.

this is the opposite of the purpose of HTML. HTML is a markup language that defines a document's structure and has nothing to do with "apps". The application side is left up to JS, and styling is up to CSS.

So, "this is not the way we currently do things". Well yeah, obviously, it's a proposal.

Don't take that as saying existing technology should be abandoned without reason. What I'm saying is that taking the status quo as law is a mistake, especially when considering the future direction of technology.

Having these functions overlap leads to a chaotic mess.

I hear that repeated over and over, despite the overwhelming evidence that it's untrue. Frameworks have switched to organizing files by function, rather than language, and React even mixes languages in the same file. The only reason I can guess people still recommend organization by language is as a zero-thought way of imposing a little bit of order on an otherwise chaotic codebase, in which case it would be an improvement.

Most calls to the server to get data are usually passed through more logic in JS to convert values, sum totals, etc. So this non-JS approach is only good for static content.

What does static content have to do with converting values?

He suggests allowing SQL statements in the href. This is the worst idea possible and makes me think this whole proposal is a joke.

Yet more name-calling.

It is completely and utterly susceptible to SQL injection (Anyone could change the query to "SELECT password FROM users").

Out of your entire reply, this is the part that's so stunningly thoughtless that I can't bring myself to give you a polite response. Is the shell, then, "completely and utterly" insecure because I can type whatever I want into it? Are banks insecure because I can ask for other people's money?

Plus, SQL isn't the only database language, and favoring one language is against the idea of the W3C.

The W3C favors one language in many different instances. If they don't like to do so, they are certainly willing to make exceptions. Besides, this could easily be done in a way that supports multiple query languages.

Additionally, this also implies there's no standard way to send data back to the client. SQL certainly doesn't output data that looks anything like that weird XML format he uses, so you'd have to have some way to specify it.

Did you expect this to be finished and implemented? What you're describing seems very straightforward to implement.

Lack of flow control (if, while, for) severely limits the usefulness of this and would mean you have to resort back to JS anyway to accomplish these tasks. Existing templating engines like Handlebars solve this problem already.

What "tasks"? That's the question. Nobody's end goal is a while loop.

All of this could just as easily be accomplished in JS in a much more flexible way

"just as easily" for who? The point of the proposal is to put in more effort now, for much less effort for future developers. Not saying it can necessarily accomplish that, but saying "we can already do that in JS" is like saying "we don't need frameworks, we can do this with vanilla JS".

that supports all back-end systems.

I don't know of a single webpage that supports more than one backend.

5

u/Knotix Mar 20 '15 edited Mar 20 '15

What does static content have to do with converting values?

When you pull data from the server (for instance, in an AJAX call), you typically want to do further processing in JS such as summing numbers, converting dates, caching the data to be used in other parts of the page, etc... The proposal completely skips JS, meaning the data must be completely processed on the server. This forces you to use a thin client and actively prevents a fat client.


Out of your entire reply, this is the part that's so stunningly thoughtless that I can't bring myself to give you a polite response. Is the shell, then, "completely and utterly" insecure because I can type whatever I want into it? Are banks insecure because I can ask for other people's money?

Name-calling. You're thinking I'm afraid of you, the developer, typing something stupid. Wrong. I'm afraid the user will type something stupid. A malicious user can right-click, inspect element, and change the query in the HREF attribute to run any query they want to. They could steal credit card numbers or drop databases. This is giving every user of your website permission to run any query they want just by changing the attribute. The very fact that you misunderstood this argument tells me you don't know what you're talking about.


What "tasks"? That's the question. Nobody's end goal is a while loop.

Aside from variable injection, flow control is the number one feature in every templating engine. The proposer himself says he wants HTML to be a templating engine, yet this suggestion lacks the fundamental feature for it to be useful.


I don't know of a single webpage that supports more than one backend.

You've never heard of using different database types for a single app? Some people use SQL for general storage, Redis for key-value storage, Mongo for arbitrary data storage, and ElasticSearch for fuzzy text searching all within a single app. Furthermore, that's not even what I was getting at. I was trying to say that this implementation ONLY supports people who choose to use a SQL database and ignores other people with other apps that use other back-ends.

-3

u/[deleted] Mar 20 '15

When you pull data from the server (for instance, in an AJAX call), you typically want to do further processing in JS such as summing numbers, converting dates, caching the data to be used in other parts of the page, etc... The proposal completely skips JS, meaning the data must be completely processed on the server. This forces you to use a thin client and actively prevents a fat client.

Still not seeing how it relates to static content. But yes, I agree that the processing would have to be done at some point, on the server or on the client. Depending on the query, this could be an implementation detail.

Name-calling. You're thinking I'm afraid the developer will type something stupid. Wrong. I'm afraid the user will type something stupid. A malicious user can right-click, inspect element, and change the query in the HREF attribute to run any query they want to. They could steal credit card numbers or drop databases. The very fact that you misunderstood this argument tells me you don't know what you're talking about.

Yes it's name-calling, I called it impolite as I wrote it.

And I didn't misunderstand you, you missed the point of my response (sorry, you'll need to find another reason I "don't know what I'm talking about"). Security does not mean controlling what's requested, it means controlling how you respond. Obviously you will receive all sorts of queries - with the permissions granted the webpage. Obviously you will not grant the public access to read your passwords.

Aside from variable injection, flow control is the number one feature in every templating engine. The proposer himself says he wants HTML to be a templating engine, yet this suggestion lacks the fundamental feature for it to be useful.

There are alternatives, like declarative transformations - which are in favor even in actual programming languages with things like map. He needs something like that, not a keyword from a 40-year-old programming language.

You've never heard of using different database types for a single app? Some people use SQL for general storage, Redis for key-value storage, Mongo for arbitrary data storage, and ElasticSearch for fuzzy text searching all within a single app.

By backend I meant the sum of server-side code. Apparently you were referring only to the SQL interface, so disregard that.

Furthermore, that's not even what I was getting at. I was trying to say that this implementation ONLY supports people who choose to use a SQL database and ignores other people who use other back-ends.

I fail to see how not solving all of everybody's problems makes a thing bad at solving the problem it does address.

2

u/Knotix Mar 20 '15 edited Mar 20 '15

And I didn't misunderstand you, you missed the point of my response (sorry, you'll need to find another reason I "don't know what I'm talking about"). Security does not mean controlling what's requested, it means controlling how you respond. Obviously you will receive all sorts of queries - with the permissions granted the webpage. Obviously you will not grant the public access to read your passwords.

Are you suggesting we allow users to send us arbitrary queries and that we should parse them to determine if they have proper permissions? This inverts the typical permissions model. Instead of checking if they have access to call "getUsers" and then generating the appropriate query that returns the proper results, we instead have to determine if the query they sent us is returning results they don't have access to and filter them out. Am I understanding the argument correctly? This makes things tremendously more difficult.

1

u/johannL Mar 24 '15

Are you suggesting we allow users to send us arbitrary queries and that we should parse them to determine if they have proper permissions?

Huh? Before "sending SQL" (that doesn't just get ignored, that is) comes authentication. Which the author of the proposal didn't mention, and maybe didn't think about, but that doesn't mean it would have to be anything but read-only access for public data. Of all the valid criticisms, "but then everybody could just click 'inspect element' and drop tables or steal credit card numbers" is kind of silly.

-4

u/[deleted] Mar 20 '15

Not at all. We can type whatever we want into the shell. We can ask a bank teller for whatever we want. The permissions involve what can be divulged, not the way that somebody goes about getting it.

1

u/Knotix Mar 20 '15

Users don't have access to the shell. They don't have access to the database. They only have access to the API we expose to them via GET/POST/PUT/DELETE

1

u/[deleted] Mar 25 '15

The analogy is right there in front of you, you're just refusing to take the last part anything but literally:

Yes, we most certainly do give users access to the shell who don't have permission to do everything. These are called file system permissions, and they've been a foundation of computing for 30+ years.

I'm not suggesting we give the website direct access to the hard drive the database is stored on. Every interaction with the database is already going through an API, we can implement permissions there.

4

u/brotherwayne Mar 20 '15

Based on what /u/Knotix said I think we can boil the problems down to: Breaks Separation of Concerns.

3

u/SaadRhoulam Mar 20 '15

This response covers it well. Another one nails it in the first sentence:

So it’s already possible, right? :)

It wouldn't be anything new. It's duplicating a limited feature of JS into HTML, weakening the boundary between mark-up and client-side code.

In two words: feature bloat.

0

u/[deleted] Mar 20 '15

[deleted]

1

u/m1sta Mar 20 '15

React.js?

1

u/Capaj Mar 20 '15

The good thing about this approach is once you're cached, your app can feel like a native app, because you don't ever rerender the whole page. Bad thing is that first load, which will usually be much longer than with server sider render. But that is solvable with CDN's and clever module management.

-4

u/[deleted] Mar 20 '15

You're as dumb as the person in the OPs post.

0

u/[deleted] Mar 20 '15

[deleted]

0

u/recompileorg Mar 20 '15

Many have tried. Even I tried. After seeing the monster I created, I, like so many others before me, said "Oh, that's why this is a bad idea!"

You're welcome to try as well, and learn that lesson the hard way.