-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
[Enhancement] Giving security attributes better names #1481
Comments
I had some thoughts which would clarify this but without having to depend on a prefix
By using @nagmat84 opinion ? |
In principle, I am fine with using verbs instead of nouns to distinguish the different categories.
I am only struggling with |
User may admin[istrate] :)
Indeed, I just left them as is because I assumed there would not be many. |
Works for me.
Maybe, we should try to start all of them with
First I considered to start everything with |
Sorry for jumping late into this discussion; it's just that these days I'm rarely in a frame of mind where I can read through a longer message like this and give it the thought it deserves. Anyway, maybe I didn't give it enough thought, because I still don't understand half of the points that are being discussed here. For example, why is I think that I do understand though the larger point that is being made here. Currently we primarily transfer the attributes between the server and the front end, and then both the server and the front end have to implement the policies to translate these attributes into rights. This is error-prone on the front end side, which may not have some of the necessary information, especially for mixed-ownership results (such as smart albums and search results), where the attributes reside with the actual parent album, not with the objects (photos) themselves or the "virtual" (smart/search) albums. In my opinion, we should eliminate as many policies from the front end as possible. Instead, every object sent by the server should include rights such as I like the OK, that's my two cents for now. |
Because
That is the end goal. :)
That would be is a very big change, but yes I would go incrementally in that direction. :)
I see what you mean with
|
We have to go this way, we have no other chance. Especially when we allow to share albums with users and different permissions on a per-share basis, we must send the currently effective rights alongside the album as otherwise the frontend cannot show or hide the appropriate action buttons.
Yes, that is somewhat problematic. I guess that is why most systems make the category explicit part of the attribute's name like I have suggested initially as in
However, I also see the advantages in the naming scheme suggested by @ildyria and use prefixes
Sure, the syntactical and semantic distance between |
Done ! |
Intro
In #1443 (comment) @ildyria asked why there is this seemingly duplication of sending certain security attributes to the front-end. The short answer is: because they only happen to have the same name (unfortunately), but have different semantical meanings.
This reminds me of something which has been bothering me for quite a while. The issue has some overlapping with #1462 and #1403, but it is worth to be considered on its own. I have been planning to give better names to some security attributes for a long time, but as I have been unable to come up with some better names on my own, I will put it to discussion.
Problem
The problem are code lines like
This is from the frontend, but it illustrates the problem. Here a user has the right to upload into an album, if the user has the admin capability or upload capability. The problem is that the term "upload" is used twice in two different meanings: on the left hand-side of the assignment it denotes the currently effective right in a specific use-case context, on the right hand-side it denotes a capability of a user. This bears some risk. In particular, it may lead to defective code if the wrong kind of some equivocally named attribute is used in the wrong place.
I also had a quick look at our new Laravel policies below
app/Policies
and my heart sunk, when I found some mix-up. At the moment, this is still a peace of cake, because we only have very limited multi-user support and hence the impact is manageable, if something gets wrong, but it will become a nightmare, if we get more and more fine-grained multi-user support.Definitions
Let me first get some terms and definitions straight, before I get back to Lychee. (Sorry, I am a scholar.)
In summary: The security attributes of object O_i, the capabilities (=security attributes) of subject S_j and the permissions of S_j for O_i are input to a policy which determines whether S_j has the right to perform a certain operation on O_i.
Situation for Lychee
(I will only consider albums for now).
requires_link
password
is_locked
is_admin
may_upload
is_downloadable
grants_full_photo
is_downloadable
grants_full_photo
is_downloadable
I have written the list above with #1462 in mind (that is
is_downloadable
andgrants_full_resolution
appear as permissions), but I have left out write permissions and rights to not make it more complicate than it is already.As you can see, some terms appear twice in the list above and that is bad. For example
grants_full_photo
appears as a permission and as a right. However, a user does not necessarily require thegrants_full_photo
permission to have the rightgrants_full_photo
, because the user could also own theis_admin
capability.So, I would really badly like to have distinct names for the attributes above to ensure that is always unambiguously clear what an attribute means. The easy solution is to simply add the designation for the kind to the name. I believe this is what most system do. This would give something like
is_link_required_secattr
password_secattr
is_locked_cap
is_admin_cap
may_upload_cap
is_downloadable_perm
is_full_photo_granted_perm
is_downloadable_right
is_full_photo_granted_right
is_downloadable_right
But maybe someone can come up with something better? Any ideas @LycheeOrg/reviewers? I think we should get this straight soon and have a consistent system before things become unfixable.
PS: There is a slightly other inconvenience. Typically, the things above are expressed "positively", because this makes reasoning easier. However,
is_link_required_attr
andis_locked_cap
are "negative" in the sense that they restrict rights. It would be nicer, if they were namedis_browseable_attr
andmay_change_pwd_cap
with the exact inverse meaning.The text was updated successfully, but these errors were encountered: