{"action":"created","issue":{"url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/43","repository_url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram","labels_url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/43/comments","events_url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/43/events","html_url":"https://github.com/fabianonline/OctoPrint-Telegram/pull/43","id":181674598,"number":43,"title":"Restrict sensitive settings to admins on API","user":{"login":"foosel","id":83657,"avatar_url":"https://avatars.githubusercontent.com/u/83657?v=3","gravatar_id":"","url":"https://api.github.com/users/foosel","html_url":"https://github.com/foosel","followers_url":"https://api.github.com/users/foosel/followers","following_url":"https://api.github.com/users/foosel/following{/other_user}","gists_url":"https://api.github.com/users/foosel/gists{/gist_id}","starred_url":"https://api.github.com/users/foosel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foosel/subscriptions","organizations_url":"https://api.github.com/users/foosel/orgs","repos_url":"https://api.github.com/users/foosel/repos","events_url":"https://api.github.com/users/foosel/events{/privacy}","received_events_url":"https://api.github.com/users/foosel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-07T13:53:21Z","updated_at":"2016-10-11T00:28:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/pulls/43","html_url":"https://github.com/fabianonline/OctoPrint-Telegram/pull/43","diff_url":"https://github.com/fabianonline/OctoPrint-Telegram/pull/43.diff","patch_url":"https://github.com/fabianonline/OctoPrint-Telegram/pull/43.patch"},"body":"I recently noticed that I'd not properly protected some sensitive data in one of my own plugins. An API key was available on the settings API for basically everyone with access to the instance in question (settings API GET requests are not restricted since a lot of settings data is directly needed in the frontend for various things). Not a good idea. So I fixed that in my own plugin, added a new utility method in OctoPrint itself in future versions to allow to define restricted settings paths (already part of 1.2.17rc1) and thought I'd also go around and send some PRs to the plugins I know of that also might have sensitive data such as API keys and what not stored in their settings.\r\n\r\nThis PR is the result of that. I gave it a quick test whirl and it seems that it works. I noticed an exception on the GET SimpleAPI (undefined `commandDict`), however as far as I could see that was unrelated to my changes.\r\n\r\nThe basic idea is to set sensitive settings fields to \"None\" if the settings load call does not originate from a user with admin rights. You might also want to do this for the `chats` settings, I'm not sure though and limited myself to the tokens for now.\r\n\r\nTwo implementations are provided, one for OctoPrint versions up to and including 1.2.16, and one for OctoPrint versions after 1.2.16 which come with a new method on the SettingsPlugin API to allow defining restricted paths."},"comment":{"url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/comments/252780668","html_url":"https://github.com/fabianonline/OctoPrint-Telegram/pull/43#issuecomment-252780668","issue_url":"https://api.github.com/repos/fabianonline/OctoPrint-Telegram/issues/43","id":252780668,"user":{"login":"derpicknicker1","id":5983533,"avatar_url":"https://avatars.githubusercontent.com/u/5983533?v=3","gravatar_id":"","url":"https://api.github.com/users/derpicknicker1","html_url":"https://github.com/derpicknicker1","followers_url":"https://api.github.com/users/derpicknicker1/followers","following_url":"https://api.github.com/users/derpicknicker1/following{/other_user}","gists_url":"https://api.github.com/users/derpicknicker1/gists{/gist_id}","starred_url":"https://api.github.com/users/derpicknicker1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/derpicknicker1/subscriptions","organizations_url":"https://api.github.com/users/derpicknicker1/orgs","repos_url":"https://api.github.com/users/derpicknicker1/repos","events_url":"https://api.github.com/users/derpicknicker1/events{/privacy}","received_events_url":"https://api.github.com/users/derpicknicker1/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T00:28:10Z","updated_at":"2016-10-11T00:28:10Z","body":"Thank you for your advise. I never thought about taht. I will implement it soon. I have some commits in pipeline for a new release in a few days. When i have pushed them, i will merge your pull request.\r\n\r\nMay you have some further infos on the exception on GET Simple API? I'm not able to reproduce until now."}}
{"actor":{"display_login":"derpicknicker1"}}