-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Missing permission check on default edit form #118
Comments
Why is the view permission not enough? |
Imagine someone creates a custom edit form like so, maybe to adjust some form attributes:
Do you notice the wrong permission? Now with that form anyone having |
This also works with |
The example code you provided is clear: you're overriding the edit view and changing it's permission. I don't see that as a problem. I don't agree it's a bug. |
So a badly chosen view permission is worth much more than any permissions set by roles, workflows etc? 🤦♂ |
So basically Plone is currently working like this:
🤡 😂 🤢 💣 💥
🚮 |
@tmassman But it is an edit form. What is the use case of requiring a different permission to view the form than submit it? |
There is no "usecase", but I see people over and over again copy&pasting code without checking and opening things like the edit form, because they wanted to customize some properties. If someone really wants to make an edit form available for the general public (or some regular Plone users without further permissions) than that should be done explicitly by adjusting the permission in the view declaration (zcml), the view permission check (python code) and the corresponding workflow settings. I've written ZTK applications with strict security policies, using security-proxied objects by default. Plone's security model currently feels like a big Swiss cheese. Here workflow settings and common agreements on a default edit permission (Modify portal content) are ignored and given in the hands of the permission setting on a single view. |
This is the main point of our disagreement. You're proposing that in order to change the permission of the edit form the developer must do 2 things: change the zcml and the python code. The rationale being the developer often makes mistakes when dealing with the zcml. I think it's not a good idea. Permission settings should be defined in a single place. Besides that, this is not a pattern I've seen anywhere in Plone code. |
So, things like:
are all irrelevant and the zcml permission settings are enough? |
So you say it is like this:
And you want to change it to:
I am not saying that all checks that you mention are irrelevant. The first one checks a permission on the parent of a context, which you cannot express in ZCML. The other three go through a list of brains that the user can see, and filters out ones for which the user does not have a certain permission. |
For the record, Thomas has responsibly and securely sent a message to the Plone security team before filing this bug. We discussed it, and think it is no security bug, and said he was free to discuss it in public, which he is doing now. As a community, we can always decide that it is better to add more permission checks, even when it is not strictly necessary. For me, this is what this bug is about, and I welcome the discussion. |
My opinion is the same. The examples provided by @tmassman are of cases where the permission of the view is really not sufficient. One is checking for a permission in the parent object, others are checking in a collection of objects managed by the view. There's no way to express it in zcml, so the checks must be done in python code. |
First, as @mauritsvanrees said, I agree this is not a security issue. But I tend to agree we can do better. We have the global permission "Modify portal content". Only when this permission is given, attributes shall be modified. Except the field-level permission tells us something different. In fact, not only in the z3c.form add and edit, but elsewhere too. Btw., this applies also to the field-level view permission. Goes to far? I fear performance-implications are not on our side when adding this. All has its costs. |
The default edit form for dexterity content is only protected by a view permission setting in ZCML with the
Modify portal content
permission. There is no additional check on the form itself before new data is applied to the content.Individual field permissions applied to a schema are checked by the tagged value settings of
plone.autoform.utils
, but fields without a specific read or write permission are ignored.There is a
DXFieldPermissionChecker
(usingModify portal content
as default permission), but it is only called and used for the vocabulary view for AJAX requests.Adding a permission check in the
DefaultEditForm
would help to secure the write operation:If someone needs to customize the default edit form and requires a different permission, the
DEFAULT_PERMISSION
can be adjusted as well:The text was updated successfully, but these errors were encountered: