Skip to content

Commit

Permalink
Release 0.64, with a warning against arbitrary SQL with SpatiaLite
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jan 9, 2023
1 parent 02987e3 commit 0084daa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion datasette/version.py
@@ -1,2 +1,2 @@
__version__ = "0.63.3"
__version__ = "0.64"
__version_info__ = tuple(__version__.split("."))
11 changes: 11 additions & 0 deletions docs/changelog.rst
Expand Up @@ -4,6 +4,17 @@
Changelog
=========

.. _v0_64:

0.64 (2023-01-09)
-----------------

- Datasette now **strongly recommends against allowing arbitrary SQL queries if you are using SpatiaLite**. SpatiaLite includes SQL functions that could cause the Datasette server to crash. See :ref:`spatialite` for more details.
- New :ref:`setting_default_allow_sql` setting, providing an easier way to disable all arbitrary SQL execution by end users: ``datasette --setting default_allow_sql off``. See also :ref:`authentication_permissions_execute_sql`. (:issue:`1409`)
- `Building a location to time zone API with SpatiaLite <https://datasette.io/tutorials/spatialite>`__ is a new Datasette tutorial showing how to safely use SpatiaLite to create a location to time zone API.
- New documentation about :ref:`how to debug problems loading SQLite extensions <installation_extensions>`. The error message shown when an extension cannot be loaded has also been improved. (:issue:`1979`)
- Fixed an accessibility issue: the ``<select>`` elements in the table filter form now show an outline when they are currently focused. (:issue:`1771`)

.. _v0_63_3:

0.63.3 (2022-12-17)
Expand Down
26 changes: 23 additions & 3 deletions docs/spatialite.rst
Expand Up @@ -4,17 +4,37 @@
SpatiaLite
============

The `SpatiaLite module <https://www.gaia-gis.it/fossil/libspatialite/index>`_ for SQLite adds features for handling geographic and spatial data. For an example of what you can do with it, see the tutorial `Building a location to time zone API with SpatiaLite, OpenStreetMap and Datasette <https://simonwillison.net/2017/Dec/12/location-time-zone-api/>`_.
The `SpatiaLite module <https://www.gaia-gis.it/fossil/libspatialite/index>`_ for SQLite adds features for handling geographic and spatial data. For an example of what you can do with it, see the tutorial `Building a location to time zone API with SpatiaLite <https://datasette.io/tutorials/spatialite>`__.

To use it with Datasette, you need to install the ``mod_spatialite`` dynamic library. This can then be loaded into Datasette using the ``--load-extension`` command-line option.

Datasette can look for SpatiaLite in common installation locations if you run it like this::

datasette --load-extension=spatialite
datasette --load-extension=spatialite --setting default_allow_sql off

If SpatiaLite is in another location, use the full path to the extension instead::

datasette --load-extension=/usr/local/lib/mod_spatialite.dylib
datasette --setting default_allow_sql off \
--load-extension=/usr/local/lib/mod_spatialite.dylib

.. _spatialite_warning:

Warning
=======

.. warning::
The SpatiaLite extension adds `a large number of additional SQL functions <https://www.gaia-gis.it/gaia-sins/spatialite-sql-5.0.1.html>`__, some of which are not be safe for untrusted users to execute: they may cause the Datasette server to crash.

You should not expose a SpatiaLite-enabled Datasette instance to the public internet without taking extra measures to secure it against potentially harmful SQL queries.

The following steps are recommended:

- Disable arbitrary SQL queries by untrusted users. See :ref:`authentication_permissions_execute_sql` for ways to do this. The easiest is to start Datasette with the ``datasette --setting default_allow_sql off`` option.
- Define :ref:`canned_queries` with the SQL queries that use SpatiaLite functions that you want people to be able to execute.

The `Datasette SpatiaLite tutorial <https://datasette.io/tutorials/spatialite>`__ includes detailed instructions for running SpatiaLite safely using these techniques

.. _spatialite_installation:

Installation
============
Expand Down

0 comments on commit 0084daa

Please sign in to comment.