-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Ensure values of fields with type password are redacted in API response #21809
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
Conversation
Can we adjust an existing test or add a new test for this? |
Not too easily. We don't use any password settings in core. Except of an example in the ExampleSettingsPlugin. But that one doesn't have tests or is enabled in tests at all. Might be easier to add tests for that in QueuedTracking plugin, where such a setting is really used. But I can look into it and see if we can somehow inject a fake setting for tests only |
Fair enough. With this change I'd say we probably want to have it covered somewhere as to not have a sudden regression where the password would become visible again. |
I've now added a test |
Thanks for adding the test, that all looks good. One last question that just crossed my mind — shall we throw an exception when someone tries to set the password to |
Currently this value is simply ignored. Throwing an exception would break it, as the UI sends this value to the backend. I don't really see a solution how to change that. We could adjust the UI to avoid sending through the placeholder at all. But it would then also be not possible to distinguish if the placeholder was provided manually to the input field. So the UI would then ignore the value and not the backend... |
I guess the best way around it is to implement a password validator requiring a set of different character types in a password that would prevent using six asterisk characters by default, but that's out of scope here. All good. 👍 |
…se (#21809) * Ensure values of fields with type password are redacted in API response * Add test
Description:
Plugins are able to define the own system, user and/or measurable settings. See https://developer.matomo.org/guides/plugin-settings
The system settings for all plugins are currently available using the API
CorePluginsAdmin.getSystemSettings
The response includes all defined settings including their current value.
This currently makes it possible for a super user to also see values of fields, that are defined as password field.
For certain values it might be unwanted that a super user sees the value another super user might have configured.
Therefor this PR aims to replace values of password fields with
*****
, so they are no longer visible in the API response.fixes DEV-16785
Review