Improve the error handling of the tenant token requests #398
Replies: 4 comments 6 replies
-
I think this is really an issue that we need to think about it and try to handle better. Because when implementing the token creation functions it was very difficult to understand where the problem was coming from when an error was returned. Mainly because the message suggests that it is the encryption that went wrong but there is no clue if the problem is in the payload or in a field of the payload or in the encryption. |
Beta Was this translation helpful? Give feedback.
-
During a discussion with @ManyTheFish, we quickly evaluated what could be done in the Meilisearch API to ensure a better validation and help the user not generate invalid tenant tokens for a future iteration. We could have an endpoint to generate a tenant token like It could allow verifying and returning a dedicated error message when:
It won't:
Changes vs SDK method: The http payload should require the full signing API Key Further questions:
|
Beta Was this translation helpful? Give feedback.
-
Related to https://github.com/meilisearch/product/discussions/415 |
Beta Was this translation helpful? Give feedback.
-
For the moment, when a token is badly created the error thrown is Invalid API key. Which doesn't say a lot about the issue and makes debugging very hard. After looking at the code with @irevoire we realised that some checks could be easily implemented (I don't know about the workloud in the spec's though!) These are the errors that can be returned:
It would help a lot in creating the tokens when using the jwt libraries for example. |
Beta Was this translation helpful? Give feedback.
-
Following this comment: https://github.com/meilisearch/specifications/pull/89/files#r810014680
The idea of this discussion is to keep track of this possible problem that could happen in the future (after the v0.26 release).
Some ideas to handle the problem:
/search
every time the user generates a new token./search
changes.searchRules
parser into the API (/verify-search-rules
or something), and we use it to validate the generated token before returning it to the user.Above we have some ideas to handle the problem, but we definitely can wait for the feedback regarding the usage of the feature in the following weeks after the release.
Beta Was this translation helpful? Give feedback.
All reactions