Reduce the importance of masterKey #443
Replies: 3 comments 1 reply
-
Hey @brunoocasali 👋 I agreed on this personally and it's surely not too "crazy".
It seems to be a straightforward solution that is clear to understand, plus it could still be warned in the logs. I wonder if we can't rely on the production or development env since I'm 100% sure users are running Meilisearch in production architecture with the development flag. We could maybe apply this restriction as soon as a master key is defined no matter the env. A user that wants to develop in his local env is not forced to set a master key. As soon it enters a staging environment I expect a master key to be set which could be a good thing to have this restriction bound to the master-key presence or not. Did I miss something in your opinion? |
Beta Was this translation helpful? Give feedback.
-
I know I'm late to the ship, I'm giving my opinion in case someone else agrees after the v0.28. I'm very not convinced by the decision of limiting the masterKey for multiple reasons:
And most importantly, because we cannot const keys = await client.getKeys();
const key = keys.find(key => key.name === "Admin" ); Nonetheless, I am very happy that we have the field name! This code is better than the previous example showed here. |
Beta Was this translation helpful? Give feedback.
-
The change explained here #443 (comment), initially planned for the v0.28 has been discarded due to raised issues by other teams that we won't treat now. Cloud team concernsCons The Master Key is currently used for every action on the SaaS. A new process must be implemented in case of changes. If the master key is restricted, an API key must be used to perform all actions. Since API keys can be removed by a user using Solutions could be to create a dedicated key for the SaaS that cannot be removed.
For now, the SaaS needs an unrestricted master key. Pro Master-key cannot be automatically changed in the SaaS, which means that if the user exposes it, they will have to shut down their instance or contact the SaaS team to make the change. By forcing the user to use an Admin key instead of the Master key, in case of a leak, it would be very easy for the SaaS team to regenerate one. Integrations Team concernsCons A lot of work needs to be done in:
Pros
Possible DevRel concernsCons
Pros
Overall User Experience subjectCons
Pros
Decision: We will get back to it when an interface for the management of the keys is planned to evaluate corner cases. In the meantime, a suggestion would be to push the guide on securing a Meilisearch instance in the documentation quick-start to let users know more easily that the master key should absolutely not be used on the client-side, and as little as possible. |
Beta Was this translation helpful? Give feedback.
-
The idea is simple and still raw, but I feel that the breaking changes will be massive!
This mindset is not new, but since we received this issue, it raises the concern that we could address or at least think of an upgrade path to it before the v1.
The issue points to an undesirable behavior that puts the
masterKey
and the data security in danger.Since we do not warn or prevent the users from making bad choices about master keys, they can do things like this:
masterKey
to do everything, from search to index management.masterKey
in front-end environments.12345678
or evenmasterKey
.To change this behavior, we could take some actions to improve the security of the masterKey:
We accept everything during the development, but when things get deployed, we need to respect some security guidelines. In this case, we could prevent every action from being made using masterKey besides other key generations.
I'm ok with don't take real action to prevent the problems, but at least I think we should warn the user somehow, the docs do a great job but for me isn't enough.
Anyway, I'm open to discussing more the concerns about each possibility. Just let me know if this idea is too "crazy." 😄
Beta Was this translation helpful? Give feedback.
All reactions