{"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-1374555507", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 1374555507, "node_id": "IC_kwDOBm6k_c5R7g1z", "user": {"value": 9599, "label": "simonw"}, "created_at": "2023-01-07T18:06:01Z", "updated_at": "2023-01-07T18:06:01Z", "author_association": "OWNER", "body": "Documentation:\r\n- https://docs.datasette.io/en/latest/authentication.html#controlling-the-ability-to-execute-arbitrary-sql\r\n- https://docs.datasette.io/en/latest/settings.html#setting-default-allow-sql\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890400425", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890400425, "node_id": "IC_kwDOBm6k_c41Em6p", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T20:25:16Z", "updated_at": "2021-07-31T20:26:25Z", "author_association": "OWNER", "body": "If I was prone to over-thinking (which I am) I'd note that `allow_facet` and `allow_download` and `allow_csv_stream` are all settings that do NOT have an equivalent in the newer permissions system, which is itself a little weird and inconsistent.\r\n\r\nSo maybe there's a future task where I introduce those as both permissions and metadata `\"allow_x\"` blocks, then rename the settings themselves to be called `default_allow_facet` and `default_allow_download` and `default_allow_csv_stream`.\r\n\r\nIf I was going to do that I should get it in before Datasette 1.0.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890400121", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890400121, "node_id": "IC_kwDOBm6k_c41Em15", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T20:22:21Z", "updated_at": "2021-07-31T20:23:34Z", "author_association": "OWNER", "body": "I think `default_allow_sql` is more consistent with the current naming conventions, because both `allow` and `default` are used as prefixes at the moment but neither of them are ever used as a suffix.\r\n\r\nPlus `default_allow_sql off` makes sense to me but `allow_default_sql off` does not - what is \"default SQL\"?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890400059", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890400059, "node_id": "IC_kwDOBm6k_c41Em07", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T20:21:51Z", "updated_at": "2021-07-31T20:21:51Z", "author_association": "OWNER", "body": "One of these two options:\r\n\r\n- `--setting default_allow_sql off`\r\n- `--setting allow_sql_default off`\r\n\r\nExisting settings from https://docs.datasette.io/en/0.58.1/settings.html with similar names that I need to be consistent with:\r\n\r\n- `default_page_size`\r\n- `allow_facet`\r\n- `default_facet_size`\r\n- `allow_download`\r\n- `default_cache_ttl`\r\n- `default_cache_ttl_hashed`\r\n- `allow_csv_stream`\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890399806", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890399806, "node_id": "IC_kwDOBm6k_c41Emw-", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T20:18:46Z", "updated_at": "2021-07-31T20:18:46Z", "author_association": "OWNER", "body": "My rationale for removing it: https://github.com/simonw/datasette/issues/813#issuecomment-640916290\r\n\r\n> Naming problem: Datasette already has a config option with this name:\r\n>\r\n> $ datasette serve data.db --config allow_sql:1\r\n>\r\n> https://datasette.readthedocs.io/en/stable/config.html#allow-sql\r\n>\r\n> It's confusing to have two things called `allow_sql` that do slightly different things.\r\n>\r\n> I could retire the `--config allow_sql:0` option entirely, since the new `metadata.json` mechanism can be used to achieve the exact same thing.\r\n> \r\n> I'm going to do that.\r\n\r\nThis is true. The `\"allow_sql\"` permissions block in `metadata.json` does indeed have a name that is easily confused with `--setting allow_sql off`.\r\n\r\nSo I definitely need to pick a different name from the setting. `--setting default_allow_sql off` is a good option here.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890397753", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890397753, "node_id": "IC_kwDOBm6k_c41EmQ5", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T19:57:56Z", "updated_at": "2021-07-31T19:57:56Z", "author_association": "OWNER", "body": "I think the correct solution is for the default permissions logic to take the `allow_sql` setting into account, and to return `False` if that setting is set to `off` AND the current actor fails the `actor_matches_allow` checks.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890397652", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890397652, "node_id": "IC_kwDOBm6k_c41EmPU", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T19:56:48Z", "updated_at": "2021-07-31T19:56:48Z", "author_association": "OWNER", "body": "The other option would be to use the setting to pick the `default=` argument when calling `self.ds.permission_allowed( request.actor, \"execute-sql\", resource=database, default=True)`.\r\n\r\nThe problem with that is that there are actually a few different places which perform that check, so changing all of them raises the risk of missing one in the future:\r\n\r\nhttps://github.com/simonw/datasette/blob/a6c8e7fa4cffdeff84e9e755dcff4788fd6154b8/datasette/views/table.py#L436-L444\r\n\r\nhttps://github.com/simonw/datasette/blob/a6c8e7fa4cffdeff84e9e755dcff4788fd6154b8/datasette/views/table.py#L964-L966\r\n\r\nhttps://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L220-L221\r\n\r\nhttps://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L343-L345\r\n\r\nhttps://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L134-L136\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890397261", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890397261, "node_id": "IC_kwDOBm6k_c41EmJN", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T19:52:25Z", "updated_at": "2021-07-31T19:52:25Z", "author_association": "OWNER", "body": "I think I can make this modification by teaching the default permissions code here to take the `allow_sql` setting into account: https://github.com/simonw/datasette/blob/ff253f5242e4b0b5d85d29d38b8461feb5ea997a/datasette/default_permissions.py#L38-L45", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890397169", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890397169, "node_id": "IC_kwDOBm6k_c41EmHx", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T19:51:35Z", "updated_at": "2021-07-31T19:51:35Z", "author_association": "OWNER", "body": "I'm going to stick with `--setting allow_sql off`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1409#issuecomment-890397124", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1409", "id": 890397124, "node_id": "IC_kwDOBm6k_c41EmHE", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-07-31T19:51:10Z", "updated_at": "2021-07-31T19:51:10Z", "author_association": "OWNER", "body": "I think I may like `disable_sql` better. Some options:\r\n\r\n- `--setting allow_sql off` (consistent with `allow_facet` and `allow_download` and `allow_csv_stream` - all which default to `on` already)\r\n- `--setting disable_sql on`\r\n- `--setting disable_custom_sql on`\r\n\r\nThe existence of three `allow_*` settings does make a strong argument for staying consistent with that.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 957310278, "label": "`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting)"}, "performed_via_github_app": null}