{"html_url": "https://github.com/simonw/datasette/issues/283#issuecomment-855369819", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/283", "id": 855369819, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTM2OTgxOQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T09:40:18Z", "updated_at": "2021-06-06T09:40:18Z", "author_association": "OWNER", "body": "> One note on using this pragma I got an error on starting datasette `no such table: pragma_database_list`.\r\n> \r\n> I diagnosed this to an older version of sqlite3 (3.14.2) and upgrading to a newer version (3.34.2) fixed the issue.\r\n\r\nThat issue is fixed in #1276.", "reactions": "{\"total_count\": 1, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 1, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 325958506, "label": "Support cross-database joins"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855418065", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855418065, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQxODA2NQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T15:37:11Z", "updated_at": "2021-06-06T15:37:11Z", "author_association": "OWNER", "body": "The easiest way to apply CSP is to remove all inline `\r\n\r\nSince an attacker can't guess what the nonce will be it prevents them from injecting their own script block - this seems easier to make available to plugins than a full hashing mechanism, just make `{{ csp_nonce() }}` available to the template.\r\n\r\nThat template function can then be smart enough to set a flag which Datasette uses to decide if the `script-src 'nonce-2726c7f26c'` policy should be sent or not.\r\n\r\nPresumably this would also require adding `Content-Security-Policy` to the `Vary` header though, which will have a nasty effect on Cloudflare and Fastly and such like.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855426516", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855426516, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyNjUxNg==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T16:39:34Z", "updated_at": "2021-06-06T16:39:34Z", "author_association": "OWNER", "body": "The reason Datasette uses small inline scripts right now is to avoid the overhead of an extra HTTP request for a JavaScript file - but these are both inherently cachable and perform much better under HTTP/2 so that's likely a false optimization.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855426750", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855426750, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyNjc1MA==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T16:41:30Z", "updated_at": "2021-06-06T16:44:49Z", "author_association": "OWNER", "body": "This is from the current `base.html` template: https://github.com/simonw/datasette/blob/030deb4b25cda842ff7129ab7c18550c44dd8379/datasette/templates/base.html#L62-L66\r\n\r\nWhich includes this: https://github.com/simonw/datasette/blob/030deb4b25cda842ff7129ab7c18550c44dd8379/datasette/templates/_close_open_menus.html#L1-L16\r\n\r\nThe `body_scripts` bit is for this `extra_body_script` plugin hook, which is the thing that will be the most affected by implementing CSP: https://docs.datasette.io/en/stable/plugin_hooks.html#extra-body-script-template-database-table-columns-view-name-request-datasette", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855427396", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855427396, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyNzM5Ng==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T16:46:17Z", "updated_at": "2021-06-06T16:46:17Z", "author_association": "OWNER", "body": "Mind you, since that plugin hook looks like this:\r\n\r\n```python\r\n@hookimpl\r\ndef extra_body_script():\r\n return {\r\n \"module\": True,\r\n \"script\": \"console.log('Your JavaScript goes here...')\"\r\n }\r\n```\r\nHaving it calculate a sha256 hash wouldn't be difficult.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855428296", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855428296, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyODI5Ng==", "user": {"value": 154364, "label": "dracos"}, "created_at": "2021-06-06T16:53:20Z", "updated_at": "2021-06-06T16:53:20Z", "author_association": "NONE", "body": "> Presumably this would also require adding Content-Security-Policy to the Vary header though, which will have a nasty effect on Cloudflare and Fastly and such like.\r\n\r\nNo, because Vary header is about *request* headers that cause the response to vary, not response headers.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855428601", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855428601, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyODYwMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T16:55:33Z", "updated_at": "2021-06-06T16:55:33Z", "author_association": "OWNER", "body": "> No, because Vary header is about _request_ headers that cause the response to vary, not response headers.\r\n\r\nHah, of course! Thanks for the correction. So the nonce mechanism would actually be pretty great here, especially for the `extra_body_script()` hook.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855429111", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855429111, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQyOTExMQ==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T16:59:05Z", "updated_at": "2021-06-06T17:00:15Z", "author_association": "OWNER", "body": "Twitter conversation: https://twitter.com/simonw/status/1401565566045806594\r\n\r\n@dracos provided some really useful code examples there:\r\n\r\n> We generate it here: https://github.com/mysociety/fixmystreet/blob/e9fec4e567e7148ed128816e5770c2963be51af6/perllib/FixMyStreet/Cobrand/Default.pm#L89-L90\r\nAnd use it e.g. https://github.com/mysociety/fixmystreet/blob/ba6788cd25d8f471a4e3308403607627b4d2f4f6/templates/web/base/common_header_tags.html or https://github.com/mysociety/fixmystreet/blob/cb4f2b96364d151988b5c664888468b25cc62240/templates/web/fixmystreet.com/header/css.html", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1362#issuecomment-855430317", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1362", "id": 855430317, "node_id": "MDEyOklzc3VlQ29tbWVudDg1NTQzMDMxNw==", "user": {"value": 9599, "label": "simonw"}, "created_at": "2021-06-06T17:07:48Z", "updated_at": "2021-06-06T17:07:48Z", "author_association": "OWNER", "body": "I guess I can offer a `disable_csp` setting so that people with complex custom templates aren't completely blocked from using them with Datasette, but maybe it would be better not to offer that? Or to offer it as a `datasette-insecure-csp` plugin instead?\r\n\r\nI like the idea of very actively encouraging CSP across all Datasette projects, but I'm nervous about making the software unusable for certain edge cases.\r\n\r\nMaybe require CSP and wait for someone to complain?", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 912864936, "label": "Consider using CSP to protect against future XSS"}, "performed_via_github_app": null}