There was a bug in an older version of SQLite that CheckPoint was able to exploit. That bug has been fixed for a long time. It was fixed even before the referenced talk was given. They had to use an older version of SQLite in that talk so that the attack would work. The CheckPoint attack was a clever new idea, to be sure, and so more recent versions of SQLite have added new defenses to this kind of mischief, such that even if new bugs in SQLite are found, there will be defense in depth and attacks similar to the CheckPoint attack will still be unlikely. And yet for some reason, because we had that one bug, long ago, people keep saying that SQLite is "unsafe" years after the bug was fixed. Why is that?
Well it's more a question of it being a much more complex interface than with a simpler format. Just about everyone runs a service that parses untrusted JSON, but I personally really wouldn't feel as safe running a service that consumes client-submitted SQLite databases.
"It's possible to get it right" is not a great security boundary.
That bug was fixed long ago, even before the referenced video
was produced.
The described attack is clever. It exploits the fact that
an attacker might alter the schema so that it invokes an SQL
function with side-effects when an app simply tries to read
from a table. And depending on those side-effects, an exploit
might be possible. In the video, there was a bug in a built-in
SQL function that caused exploitable side-effects. But that bug
was fixed long before the video was even produced. The examples in the video were from an older version of SQLite. They did not work for the latest SQLite release on the day that lecture was given.
Since the checkpoint.com attack was described (in the video and elsewhere) new defense-in-depth features have been
added to SQLite to make similar exploits increasingly unlikely.
(1) Built-in SQL functions that have side effects cannot be
used in the schema. Side-effect functions can only be invoked
directly by the application.
(2) When applications register their own custom SQL functions, they can now mark those functions as "direct-only", meaning that they are prohibited in the schema.
(3) Run-time and compile-time options are available to prohibit the use of SQL functions in the schema that are not explicitly declared to be safe for use in the schema - that is, functions without side effects. This is for use in legacy applications that might have been created before the per-function flag that prohibited use within the schema was available. It is also an extra layer of defense for complex applications that might add hundreds or thousands of side-effect SQL functions - to ensure that the "direct-only" flag is not accidentally omitted from one of them.
(4) Run-time options are available to disable triggers and views in applications that do not need them. This is not necessary to avoid an exploit, but it does provide an additional layer of defense.
All versions of SQLite from 3.0.0 (2004-06-18) through 3.34.0 (the latest) use the same database file format. So if two applications use different versions of SQLite, it shouldn't matter. The database file will be the same.
Now, if one application uses a more recent version of SQLite and also makes use of some new feature (say, for example, generated columns which were added in release 3.31.0) then that might result in a database file that is unreadable by older versions since the older version won't be able to interpret the generated column syntax. But if you assume that all different versions of SQLite that you use have support for all of the features used in the database file (a reasonable assumption in most cases) then the database files are completely portable across versions. Different versions of SQLite can read/write the same database file concurrently. And newer versions of SQLite are always able to read/write databases created by older versions of SQLite, without exception or precondition.
So perhaps the "sqlite format conflict" example was not the best, in as much as it will always work as long as the package manager installs the most recent version of SQLite.
GCC 5.4.0 is what came installed by default on my Ubuntu 16.04 desktop. I might change to a different compiler except that would be a lot of work, since I would then need to rerun hundreds of historical benchmarks, and it is not clear what would we learn by using a different compiler or compiler version.
We use many different compilers and compiler versions for correctness testing - various versions of GCC, LLVM, and MSVC with various optimization settings. That's important because different compilers generate different code and we want to ensure that they all generate correct code. (SQLite has found bugs in historical versions of all of those compilers!) But for benchmarking, as long as the same compiler and version is used consistently, does it really matter which compiler is used?
The problem that prompted me to make this extension to SQLite was a web-page request, so it needs to be processed with low latency. I initially tried loading the graph into memory and processing it that way. But there are approx 100K nodes in the graph, only a few dozen of which are relevant to the answer. It took a lot of time to pull in 100K nodes from disk. Running the query entirely in SQL is not only much less code to write, debug, and maintain, it is also much faster.
I wrote https://wapp.tcl.tk/ for occasions such as this. SQLite is built-in, of course.
One key feature Wapp is that identical code can be run as
+ CGI from Apache
+ SCGI from Nginx
+ As its own stand-alone webserver
So, for development work on your desktop you run it as a standalone webserver. It even pops up its root page in your webbrowser automatically when you launch it. Then, once you get things working there, you "scp" the one small source-code file that implements your application up into a CGI-enabled directory of you server, and is just works.
It is difficult to find the right balance between a simple language that requires "toil" and a less toilsome language that is also more complex and requires more effort to learn and master. I'm very open to new ideas of how to make the Pikchr language less toilsome without a corresponding increase in complexity. Expect improvements to occur. Your suggestions are welcomed
I envision Pikchr operating in the same nitch as Markdown. (Indeed, Pikchr was originally designed to augment Markdown-based documentation.) An artificial language like PIC/Pikchr is always going to have a steeper learning curve than a GUI diagram drawing tool, just as Markdown documents are always going to be a barrier to entry for pointy-clicky people who prefer MS-Word or Google-Docs. And yet, Markdown persists and even flourishes. Why is that? If point-and-click really is so much better, why are there so many Markdown technical documents out there?
A key advantage of Markdown, which helps it thrive in a point-and-click world, is that it is very simple to learn and requires no proprietary tools. Pikchr is not as simple, though it is simpler (I think) than any other artificial language for graphics that I have encountered, and I've tried to make the Pikchr code as accessible and as easy to integrate as I know how. I'm on a mission to make Pikchr simpler still. Your feedback on how to do that is appreciated.
Thanks for responding. Actually, I dont think Pikchr needs to have more features. "Toil" should tell people that they should use a different tool, IMO, so that Pikchr is used for the intended purpose - small diagrams to go with Markdown documentation.
The parallel to Markdown is apt, since it too does not do everything HTML does, and that's good (tm). The use of "same" and "last" also forces a locality that would be lost if the diagram were large.
I gave an example of a box syntax that allowed defining a label aligned vertically, but I did so to illustrate that while such an extension could be done, the library author could not possibly imagine all such attributes that users might want.
The default answer to this is an extension mechanism, i.e, you allow users to create their own primitives, but that might be overkill for the pikchr use case, and would possibly require going past the "single pass through lemon produces a c file that can be integrated into any c project" model.
The other idea - stolen from Markdown - would be to "fall through" to SVG at will by allowing svg syntax as also being valid in pikchr, but I dont know that SVG is as forgiving as HTML to do that.
When I have time, I'd like to create a markup language for diagrams that's paired with a GUI app. You'd define your diagram through text (just the structure without any stylistic elements), then use the app to tweak the style for the generated diagram as needed, e.g. change positions, adjust sizes, align elements, etc. The visual portion would be stored in a separate part of the document, possibly as a delta from the default style, and nothing would break if the graph portion was tweaked. Particular emphasis would be placed on editability of the graph contents. (For example, adding new elements or tweaking the text should not break the diagram.) We'd need a comprehensive, higher-level set of visual rules that aren't just "position of box A should be (122,34)". Maybe something like Apple's Autolayout would be a good fit here.
I've generated plenty of diagrams in Graphviz where everything was great except for a poorly-placed node or two, and I think this sort of two-part solution could provide the best of both worlds. (Or, at least, it would be a fun R&D project.)
Did you know that Graphviz can also output its own dot format, but that the output contains layout information? That might help you get started with the 2nd part. There's also an extended dot[1] format with more information
The TH3 test harness for SQLite (https://www.sqlite.org/th3.html) supports a virtual filesystem in which we can create test database files that appear to be very large but that don't actually contain much data or use much space.
Author of SQLite and Fossil here - I have not forgotten
monotone! Indeed, Fossil itself is inspired by monotone
documentation (though not the implementation). This is
credited at https://fossil-scm.org/fossil/doc/trunk/www/history.md
See https://www.sqlite.org/security.html for tips on safely opening SQLite database files that have been tampered with by a hostile agent.