-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ?sql=xxx:signature instead of signed values #45
Comments
Another reason this is useful: if you have a staging environment and a live environment with different secrets you can still modify the URL of one to the hostname of the other and still edit and re-submit the queries on the new host. |
I'm going to add code to detect the old style of |
I can still use most of Django's signing code for this. The only difference is that I'll be using |
I'm really uncomfortably about the idea of accepting a random weird looking string, unsigning it, finding the signature is invalid, then saying "it might be base64 encoded JSON", attempting to decrypt THAT (from an already untrusted source) and showing that end result back to the user. I think it can be done securely, but there's enough weirdness going on there that I don't want to try. So instead I'm going to say that the "decode old signed strings" part of this will only work if the signature DOES pass. I'm not going to attempt to decode a JSON/base64 string that wasn't protected by a signature. |
So there are three parts to this:
|
I might include clickjacking prevention here: if you load the dashboard with a Actually no. If I care about clickjacking I should use the |
I'm splitting out the handling of old signed values into a separate ticket. |
URLs to SQL queries currently look like this:
https://simonwillison.net/dashboard/?sql=InNlbGVjdCAlKG5hbWUpcyBhcyBuYW1lLCB0b19jaGFyKGRhdGVfdHJ1bmMoJ21vbnRoJywgY3JlYXRlZCksICdZWVlZLU1NJykgYXMgYmFyX2xhYmVsLFxyXG5jb3VudCgqKSBhcyBiYXJfcXVhbnRpdHkgZnJvbSBibG9nX2VudHJ5IGdyb3VwIGJ5IGJhcl9sYWJlbCBvcmRlciBieSBjb3VudCgqKSBkZXNjIg%3A1lLfRD%3AvFP_m0s3BxRS2qyiWtlMlE1KRa2qoKItofP1vvK7hdY&sql=InNlbGVjdCBib2R5IGFzIGh0bWwgZnJvbSBibG9nX2VudHJ5IGxpbWl0IDEi%3A1lLfRD%3AEK0KOXcGgYdgD4Yzglbodf806GnbmrdtPridp8m0hlY
The problem here is that if the Django secret is reset these become broken links - there's no easy way to recover the SQL.
Instead, if the signatures do not match, how about populating the forms but NOT executing the SQL queries, and showing a warning message at the top of the page?
The
?sql=
parameters could then become?sql=SELECT ...::oKItofP1vvK7hdY
whereoKItofP1vvK7hdY
is a signature but the rest of the query is in plain text.The text was updated successfully, but these errors were encountered: