{"action":"opened","issue":{"url":"https://api.github.com/repos/cockroachdb/cockroach/issues/19277","repository_url":"https://api.github.com/repos/cockroachdb/cockroach","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/19277/labels{/name}","comments_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/19277/comments","events_url":"https://api.github.com/repos/cockroachdb/cockroach/issues/19277/events","html_url":"https://github.com/cockroachdb/cockroach/issues/19277","id":265812704,"number":19277,"title":"sql: system tables should *never* allow direct write access","user":{"login":"benesch","id":882976,"avatar_url":"https://avatars1.githubusercontent.com/u/882976?v=4","gravatar_id":"","url":"https://api.github.com/users/benesch","html_url":"https://github.com/benesch","followers_url":"https://api.github.com/users/benesch/followers","following_url":"https://api.github.com/users/benesch/following{/other_user}","gists_url":"https://api.github.com/users/benesch/gists{/gist_id}","starred_url":"https://api.github.com/users/benesch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benesch/subscriptions","organizations_url":"https://api.github.com/users/benesch/orgs","repos_url":"https://api.github.com/users/benesch/repos","events_url":"https://api.github.com/users/benesch/events{/privacy}","received_events_url":"https://api.github.com/users/benesch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/cockroachdb/cockroach/milestones/3","html_url":"https://github.com/cockroachdb/cockroach/milestone/3","labels_url":"https://api.github.com/repos/cockroachdb/cockroach/milestones/3/labels","id":1298443,"number":3,"title":"Later","description":"","creator":{"login":"BramGruneir","id":1614265,"avatar_url":"https://avatars1.githubusercontent.com/u/1614265?v=4","gravatar_id":"","url":"https://api.github.com/users/BramGruneir","html_url":"https://github.com/BramGruneir","followers_url":"https://api.github.com/users/BramGruneir/followers","following_url":"https://api.github.com/users/BramGruneir/following{/other_user}","gists_url":"https://api.github.com/users/BramGruneir/gists{/gist_id}","starred_url":"https://api.github.com/users/BramGruneir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BramGruneir/subscriptions","organizations_url":"https://api.github.com/users/BramGruneir/orgs","repos_url":"https://api.github.com/users/BramGruneir/repos","events_url":"https://api.github.com/users/BramGruneir/events{/privacy}","received_events_url":"https://api.github.com/users/BramGruneir/received_events","type":"User","site_admin":false},"open_issues":409,"closed_issues":119,"state":"open","created_at":"2015-09-09T21:24:17Z","updated_at":"2017-10-16T15:31:48Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2017-10-16T15:31:48Z","updated_at":"2017-10-16T15:31:48Z","closed_at":null,"author_association":"OWNER","body":"At present, we have the following system tables:\r\n\r\n* `namespace`\r\n* `descriptor`\r\n* `users`\r\n* `zones`\r\n* `settings`\r\n* `lease`\r\n* `eventlog`\r\n* `rangelog`\r\n* `ui`\r\n* `jobs`\r\n* `web_sessions`\r\n\r\nAt present, only `namespace` and `descriptor` prevent root write access. This permits all manner of crazy things:\r\n\r\n```\r\nDELETE FROM system.jobs;\r\nINSERT INTO system.zones (id, config) VALUES (42424242, 'crap protobuf');\r\nINSERT INTO system.settings ... <invalid setting>\r\nINSERT INTO system.eventlog ... <fake event>\r\n```\r\n\r\nMany of these tables allow write access because, historically, manual `INSERT`s/`UPDATE`s were the only method of interacting with the tables. E.g., `system.settings` started out this way, but now we have `SET CLUSTER SETTING`. Similarly, the zone config CLI previously needed to run `UPSERT INTO system.zones`, but we're soon getting dedicated SQL syntax for zone configs.\r\n\r\nBy 1.2, it should be possible to prevent root write access to _every_ system table. Internally, we can execute SQL against these tables by using `security.NodeUser`."}}
{"actor":{"display_login":"benesch"}}