-
Notifications
You must be signed in to change notification settings - Fork 280
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
[Question] What syntax should extension permissions have and how should they be parsed? #2565
Comments
I think 'permissions for extensions' needs a little refinement. From an administrator of a cluster, when an extension is installed they want to allow/deny the extension to be able to do certain things. We have a kind of language for this in the 'permissions' that can be assigned to roles and I think the kinds of allow/deny actions for extensions might be broader and distinct from how we talk about user scenarios.
I think this document could expand on the second concept and the scenarios we want to support / not support for extensions. Maybe the service account fits here or in another issue, what do you think? |
@peternied I would be hesitant to introduce another way of defining read/write permissions and instead allow the extension developer to define a set of permissions that would make the extension work best and allow the admin of the cluster to accept the default or modify before accepting. I see a couple of different ideas that I'd like to separate. 1. Cluster admin needs to be presented with a list of how the extension extensions OpenSearch and the cluster admin can accept or reject, 2: Assuming the cluster admin says yes, then the cluster admin should be empowered to further restrict how the installed extension can interact with the cluster Imagine the following installation steps:
During this prompt the admin would be able to edit the policy before its created and at this stage the service account/role for the account can be created. A service account token could also be generated for extensions that want system indices and the token could be shared with the extension to permit it to use the system index.
|
Hi @peternied, thank you for taking the time to review this document. For details about service accounts, you can find a discussion question here. Specifically, under "How should extensions be tracked or managed?" I agree that service accounts are very similar to user accounts. For your second point, I think this is where we differ in view a little. I am not sure that we require a second "type" or permission for extensions. In what I have been doing so far, I have yet to see a scenario where a second type of permission would be required. For the example you provided about reading, I am not sure why the extension could not just provide the explicit permissions it required in the traditional format. Then if the administrator did not want the extension to have that access, they could deny the installation. You can find details about this over here under "How should extensions get starting permissions?" Let me know if I have not addressed your concerns. |
[Closing]
|
Problem Statement
What syntax should extension permissions have and how should OpenSearch interact with them?
Action items decided on this issue:
This is the least important design decision when dealing with permissions for extensions.
Permission syntax and parsing is the least important consideration when designing permissions for extensions. It is always possible to use the same permission syntax that OpenSearch does today. Namely, permissions follow a
<action_type>:<action>/<filter>
pattern. For example,indices:data/read/field_caps
. A permission can be either index- or cluster-level. An index-level permission can be granted granularly. The index-level permissions allow for an optional resource pattern. For example, indices:admin/aliases can take an optional filter where the target resources are specified after the aliases action. Cluster-level permissions do not allow for this fine-tuning and can only be granted or not.Because the existing syntax can be re-used, and there is already a system in place for parsing user permissions in this form, this topic should be revisited last.
When looking at permission syntax, there are three main options that come to mind.
I am in favor of redesigning permission syntax. While there is nothing inherently wrong with the current syntax, I would be interested in seeing permissions defined with either or
<action_name>?param1=value1¶m2=value2
.<action_type>.<action>.<resource_pattern>
. This option takes a similar approach to delimiting the permission string as the existing permission syntax does today. It improves upon the existing version by being more human-readable and simplifying the parsing logic. When looking at the current permission syntax, there is not a clear logic behind the delimiters. While the separation is helpful for parsing, the different characters used to split the string makes the code complicated and the output hard to read. This option shifts to a easier to read format with periods being used to separate each segment from the others.What do code changes look like?
For either syntax change, it will be easiest to implement the new formatting by notifying extension makers of the change (so that they design their permissions in the expected format) and resolving both the legacy and new formats inside the
PrivilegesEvaluator.java
class of the Security Plugin. The class makes use of pattern matching as well as explicit string comparison, so the updated syntax will need to added to the appropriate location. If the legacy syntax is removed from the class, any legacy permissions will need to be converted to the new format prior to evaluation.indices/data/read/search?index-pattern=my-index*&index-pattern=other-index*
could be parsed using a URL parser. Note that the:
betweenindices
anddata
has been switched to a/
.Using a
/
makes more sense then the arbitrary:
delimiter being used now. In a URL, the:
is used to separate the scheme from the hostname, but it does not seem like it has any real purpose in the current syntax.What do code changes look like?
See above code changes comment.
What do code changes look like?
There should not be any code changes outside of adding an 'extension' path to the permissions. In core, this will require adding the new actions for the extensions (or handling their injection). In the Security Plugin, changes can just be made to the
PrivilegesEvaluator
with the newly added action format.This question should be addressed by the answer of the previous question. If the current permission syntax is used, then it makes the most sense to use the existing parsing mechanism as well. If the syntax is swapped to use only
.
as its delimiter, then modifying the existing parsing code to handle either form makes the most sense. Finally, it a URL format syntax is adopted, using a URL parser from a library makes the most sense.What do code changes look like?
For handling permission parsing, changes will need to be made based on which syntax option is used. For a change in syntax, parsing logic will need to be added to read from whatever permissions storage is used. The logic should connect from the storage to the
PrivilegesEvaluator
. In thePrivilegesEvaluator
, the permissions should be read and processed similar to how legacy permissions are handled. If no change in syntax is made, changes will only be required in thePrivilegesEvaluator
. These changes will need to allow the existing framework to parse the newextension
action type.The text was updated successfully, but these errors were encountered: