Re:Datasette’s new JSON write API: The first alpha of Datase...
by pedrovhb on Friday December 02, 2022 @08:24PM
(#33839299)
Or a bit more generically, having a configurable allowlist of hosts, so I can make my ESP32 just a dumb "sensors on a microcontroller" thing pushing data to a RPi on my local home network, which has static IPs provided to certain devices via DHCP. Having to add an auth header isn't a great deal of work, but it'd be handy to be able to try things out quickly. IMO the great thing about all this is how frictionless it is.
Re:Datasette’s new JSON write API: The first alpha of Datase...
by simonw on Friday December 02, 2022 @08:32PM
(#33839345)
I like that: I can have a thing where you can provide "localhost" but can also provide other host names and IPs too.
Re:Datasette’s new JSON write API: The first alpha of Datase...
by vorpalhex on Friday December 02, 2022 @11:45PM
(#33840688)
That approach also makes things more docker friendly.
Re:Datasette’s new JSON write API: The first alpha of Datase...
by tlarkworthy on Saturday December 03, 2022 @02:17AM
(#33841443)
Unfortunately the host header is spoofable
Re:Datasette’s new JSON write API: The first alpha of Datase...
by simonw on Saturday December 03, 2022 @02:25AM
(#33841488)
You mean the HTTP host header?
Yeah that's a good call: I need to do these checks only based on IP.
I could allow users to enter host names which I would resolve to the IP before checking though, which matches how networking is used in things like Kubernetes.
Re:Datasette’s new JSON write API: The first alpha of Datase...
by fbdab103 on Friday December 02, 2022 @08:11PM
(#33839195)
I like the idea of having some way to do unauthenticated calls, but would it be possible to layer on some additional granularity or would that be asking too much when the security infrastructure already exists?
That is, I might want to be able to append data without any ceremony (logs?), but schema changes or data mutation would require credentials.
Re:Datasette’s new JSON write API: The first alpha of Datase...
by simonw on Friday December 02, 2022 @08:18PM
(#33839247)
The big feature in the next alpha will be the ability to create tokens that have a subset of permissions - eg can only write to specific tables: https://github.com/simonw/datasette/issues/1855
But maybe a mechanism for easily specifying that for anonymous localhost users would be useful too?
It would need to be an explicit opt-in thing because I've seen what happens if you release software that is open by default, and it's not good!