home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 957310278 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 10

issue 1

  • `default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) · 10 ✖

author_association 1

  • OWNER 10
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
1374555507 https://github.com/simonw/datasette/issues/1409#issuecomment-1374555507 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c5R7g1z simonw 9599 2023-01-07T18:06:01Z 2023-01-07T18:06:01Z OWNER

Documentation: - https://docs.datasette.io/en/latest/authentication.html#controlling-the-ability-to-execute-arbitrary-sql - https://docs.datasette.io/en/latest/settings.html#setting-default-allow-sql

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890400425 https://github.com/simonw/datasette/issues/1409#issuecomment-890400425 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41Em6p simonw 9599 2021-07-31T20:25:16Z 2021-07-31T20:26:25Z OWNER

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.

So 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.

If I was going to do that I should get it in before Datasette 1.0.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890400121 https://github.com/simonw/datasette/issues/1409#issuecomment-890400121 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41Em15 simonw 9599 2021-07-31T20:22:21Z 2021-07-31T20:23:34Z OWNER

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.

Plus default_allow_sql off makes sense to me but allow_default_sql off does not - what is "default SQL"?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890400059 https://github.com/simonw/datasette/issues/1409#issuecomment-890400059 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41Em07 simonw 9599 2021-07-31T20:21:51Z 2021-07-31T20:21:51Z OWNER

One of these two options:

  • --setting default_allow_sql off
  • --setting allow_sql_default off

Existing settings from https://docs.datasette.io/en/0.58.1/settings.html with similar names that I need to be consistent with:

  • default_page_size
  • allow_facet
  • default_facet_size
  • allow_download
  • default_cache_ttl
  • default_cache_ttl_hashed
  • allow_csv_stream
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890399806 https://github.com/simonw/datasette/issues/1409#issuecomment-890399806 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41Emw- simonw 9599 2021-07-31T20:18:46Z 2021-07-31T20:18:46Z OWNER

My rationale for removing it: https://github.com/simonw/datasette/issues/813#issuecomment-640916290

Naming problem: Datasette already has a config option with this name:

$ datasette serve data.db --config allow_sql:1

https://datasette.readthedocs.io/en/stable/config.html#allow-sql

It's confusing to have two things called allow_sql that do slightly different things.

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.

I'm going to do that.

This is true. The "allow_sql" permissions block in metadata.json does indeed have a name that is easily confused with --setting allow_sql off.

So I definitely need to pick a different name from the setting. --setting default_allow_sql off is a good option here.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890397753 https://github.com/simonw/datasette/issues/1409#issuecomment-890397753 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41EmQ5 simonw 9599 2021-07-31T19:57:56Z 2021-07-31T19:57:56Z OWNER

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.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890397652 https://github.com/simonw/datasette/issues/1409#issuecomment-890397652 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41EmPU simonw 9599 2021-07-31T19:56:48Z 2021-07-31T19:56:48Z OWNER

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).

The 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:

https://github.com/simonw/datasette/blob/a6c8e7fa4cffdeff84e9e755dcff4788fd6154b8/datasette/views/table.py#L436-L444

https://github.com/simonw/datasette/blob/a6c8e7fa4cffdeff84e9e755dcff4788fd6154b8/datasette/views/table.py#L964-L966

https://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L220-L221

https://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L343-L345

https://github.com/simonw/datasette/blob/d23a2671386187f61872b9f6b58e0f80ac61f8fe/datasette/views/database.py#L134-L136

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890397261 https://github.com/simonw/datasette/issues/1409#issuecomment-890397261 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41EmJN simonw 9599 2021-07-31T19:52:25Z 2021-07-31T19:52:25Z OWNER

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

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890397169 https://github.com/simonw/datasette/issues/1409#issuecomment-890397169 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41EmHx simonw 9599 2021-07-31T19:51:35Z 2021-07-31T19:51:35Z OWNER

I'm going to stick with --setting allow_sql off.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  
890397124 https://github.com/simonw/datasette/issues/1409#issuecomment-890397124 https://api.github.com/repos/simonw/datasette/issues/1409 IC_kwDOBm6k_c41EmHE simonw 9599 2021-07-31T19:51:10Z 2021-07-31T19:51:10Z OWNER

I think I may like disable_sql better. Some options:

  • --setting allow_sql off (consistent with allow_facet and allow_download and allow_csv_stream - all which default to on already)
  • --setting disable_sql on
  • --setting disable_custom_sql on

The existence of three allow_* settings does make a strong argument for staying consistent with that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
`default_allow_sql` setting (a re-imagining of the old `allow_sql` setting) 957310278  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 20.334ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows