cldellow / datasette-parquet

Add DuckDB, Parquet, CSV and JSON lines support to Datasette
Apache License 2.0
45 stars 5 forks source link

strip unexpected parameters #3

Closed cldellow closed 1 year ago

cldellow commented 1 year ago

While implementing, I discovered:

Datasette passes extraneous parameters to the sqlite3 connection. A writable canned query will post a csrftoken for security purposes, which ends up as part of the query parameters. DuckDB is strict on the parameters matching the SQL query, so it fails.

I added a one off fix for csrftoken. But this happens elsewhere, too: go to https://dux.fly.dev/parquet/geonames_stats and click hide.

Proposal: let's strip parameters that are in the params dict, but not the SQL string