Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict sensitive settings to admins on API #43

Merged
merged 2 commits into from
Oct 12, 2016

Conversation

foosel
Copy link
Contributor

@foosel foosel commented Oct 7, 2016

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.

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

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

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

Two implementations 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.
@derpicknicker1
Copy link
Collaborator

derpicknicker1 commented Oct 11, 2016

Thank you for your advise. I never thought about that. 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.

May you have some further infos on the exception on GET Simple API? I'm not able to reproduce until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants