Web SQL Database: In Memoriam (2014)
nolanlawson.com
nolanlawson.com
There's nothing wrong with implementing the actual standard IndexedDB on top of SQLite, since it's entirely possible to reimplement IndexedDB on top of a different underlying database.
WebSQL would have been awesome right up until the moment that some new platform takes off where SQLite won't meet the requirements for but we want to reach with the web platform, at which point we'd be screwed. Or even worse, WebSQL would guarentee that the reach of the web platform has been fundamentally limited by what a single codebase can reach.
Like some basic SQL select/insert/update/create table/drop table syntax and semantics? In a way such that advanced/specific features are not available in order to not be relied on and then let all browsers just use sqlite as implementation detail?
At least with IndexedDB there's a large enough impedence between SQLite and IndexedDB that there's far less chance of details getting through.
What does SQLite not run on in 2021?
https://www.sqlite.org/cves.html
While SQLite earned DO-178B compliance status through a difficult test suite that appears to verify every branch instruction at the assembler/machine level, focus on hostile SQL is demonstrably not a priority.
https://sqlite.org/th3.html#history
Web applications are going to see hostile SQL, so this is a problem. I know that additional sandboxing was implemented in Chrome, but exploits always seem to find ways around.
A new implementation of SQLite, in Rust or Ada, that could spend more time on the safety of the parser because the various C foot-guns are removed, might have brought WebSQL to be, but that was a bridge too far.
Apparently, there is no formal oversight over how CVEs are reported or assigned severity. But because the label sounds official & authoritative & scary, people who spam CVEs are rewarded with clout.
Some have speculated that CVE inflation will lead to the death of the term altogether:
"A few applications do allow untrusted SQL scripts received from potentially hostile agents to be run direct in SQLite. The main example of this is the Chrome and Safari web browsers, which allow an anonymous web page to run SQL using the WebSQL feature of Javascript. This is done inside a sandbox with tightly controlled constraints on resources, lest the SQL script try to soak up all available memory or CPU cycles in a denial-of-service attack. Chrome and Safari have the infrastructure in place to allow a hostile agent to run code which does not harm or compromise the rest of the machine. They have to, as they also run Javascript which could, if not tightly controlled, do even more damage than unrestrained SQL. Apart from Chrome and Safari, no applications known to the SQLite developers deliberately allows an anonymous remote agent to run arbitrary SQL text.
"However, most CVEs written against SQLite flippantly assume that an attacker is free to run any arbitrary SQL in the database engine. So to a good approximation, this means most CVEs written against SQLite really only apply to SQLite as it is used in Chrome and Safari. Or, in other words, most CVEs for SQLite do not apply to you unless you are one of the developers of Chrome or Safari."
https://venturebeat.com/2021/04/12/mozilla-winds-down-deepsp...
https://blog.mozilla.org/en/mozilla/mozilla-partners-with-nv...
someone should really look into any grants/investments/deals Mozilla did with Oracle at the time of WebSQL decision.
[0] https://web.dev/storage-foundation/
[1] https://hackaday.com/2021/08/24/sqlite-on-the-web-absurd-sql...
Then to comfortably store data, we would have SQLite running in WebAssembly persisting the data via the awkward IndexedDB API which uses the comfortable SQLite API to store the data in native SQLite.
Today you get ABSURD: https://news.ycombinator.com/item?id=28156831
Give me that and we can forget about web sql.