Skip to content

Fix the security check when a wrong permission is specified - #2042

Merged
mauritsvanrees merged 4 commits into
mainfrom
ale/2041/fix-permission-check
Aug 31, 2026
Merged

Fix the security check when a wrong permission is specified#2042
mauritsvanrees merged 4 commits into
mainfrom
ale/2041/fix-permission-check

Conversation

@ale-rt

@ale-rt ale-rt commented Aug 26, 2026

Copy link
Copy Markdown
Member

Also add a warning to support developers in fixing the permission checks.

Fixes #2041

@mister-roboto

Copy link
Copy Markdown

@ale-rt thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@ale-rt

ale-rt commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

@mamico mamico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mauritsvanrees mauritsvanrees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but some tests fail.

When I try it locally, tox -e py313-plone62 -- -m test_services_inherit passes on the main branch, but not on this one. It is likely just something that needs an update in the tests.

@ale-rt

ale-rt commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

tox -e py313-plone62 -- -m test_services_inherit

LOL, look at this:

Before this fix the security check in this line was always passing...

@ale-rt

ale-rt commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

@jenkins-plone-org please run jobs

@mauritsvanrees
mauritsvanrees force-pushed the ale/2041/fix-permission-check branch from be17fa6 to d73500b Compare August 27, 2026 11:52
@mauritsvanrees

Copy link
Copy Markdown
Member

The uncommitted doc changes test failed, but that was on main as well. I have fixed it in PR #2043. I have rebased and force-pushed the current PR branch for good measure.

And I have improved the most interesting test of this part to be more life-like, with a published child and a private parent. See last commit.

Can be merged when green.

@davisagli

Copy link
Copy Markdown
Member

@jenkins-plone-org please run jobs

@mauritsvanrees
mauritsvanrees merged commit 5677f2e into main Aug 31, 2026
18 of 20 checks passed
@mauritsvanrees
mauritsvanrees deleted the ale/2041/fix-permission-check branch August 31, 2026 10:34
mauritsvanrees added a commit that referenced this pull request Aug 31, 2026
…2044)

* Fix the security check when a wrong permission is specified

Also add a warning to support developers in fixing the permission checks.
And in the `@inherit` endpoint check the permission using the permission id.
Fixes #2041

Backport of #2042 to Plone 6.1/6.0/5.2.

* Test no uncommitted doc changes: test on Plone 6.1.

The script and workflow were using Plone 6.2, but the 9.x.x branch should be used on Plone 6.1 as latest.

* Update the http-examples to be correct for Plone 6.1.

---------

Co-authored-by: Alessandro Pisa <alessandro.pisa@gmail.com>
mister-roboto pushed a commit to plone/buildout.coredev that referenced this pull request Aug 31, 2026
Branch: refs/heads/9.x.x
Date: 2026-08-31T16:06:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.restapi@bf963e9

Fix the security check when a wrong permission is specified [9.x.x] (#2044)

* Fix the security check when a wrong permission is specified

Also add a warning to support developers in fixing the permission checks.
And in the `@inherit` endpoint check the permission using the permission id.
Fixes #2041

Backport of plone/plone.restapi#2042 to Plone 6.1/6.0/5.2.

* Test no uncommitted doc changes: test on Plone 6.1.

The script and workflow were using Plone 6.2, but the 9.x.x branch should be used on Plone 6.1 as latest.

* Update the http-examples to be correct for Plone 6.1.

---------

Co-authored-by: Alessandro Pisa &lt;alessandro.pisa@gmail.com&gt;

Files changed:
A news/2041.bugfix.md
M .github/workflows/tests.yml
M src/plone/restapi/serializer/schema.py
M src/plone/restapi/services/inherit/get.py
M src/plone/restapi/tests/http-examples/querystring_get.resp
M src/plone/restapi/tests/http-examples/querystring_get_contextual.resp
M src/plone/restapi/tests/http-examples/translated_messages_addons.resp
M src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp
M src/plone/restapi/tests/http-examples/types_document.resp
M src/plone/restapi/tests/http-examples/types_document_put.req
M src/plone/restapi/tests/test_services_inherit.py
M test-no-uncommitted-doc-changes
mister-roboto pushed a commit to plone/buildout.coredev that referenced this pull request Aug 31, 2026
Branch: refs/heads/9.x.x
Date: 2026-08-31T16:06:12+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.restapi@bf963e9

Fix the security check when a wrong permission is specified [9.x.x] (#2044)

* Fix the security check when a wrong permission is specified

Also add a warning to support developers in fixing the permission checks.
And in the `@inherit` endpoint check the permission using the permission id.
Fixes #2041

Backport of plone/plone.restapi#2042 to Plone 6.1/6.0/5.2.

* Test no uncommitted doc changes: test on Plone 6.1.

The script and workflow were using Plone 6.2, but the 9.x.x branch should be used on Plone 6.1 as latest.

* Update the http-examples to be correct for Plone 6.1.

---------

Co-authored-by: Alessandro Pisa &lt;alessandro.pisa@gmail.com&gt;

Files changed:
A news/2041.bugfix.md
M .github/workflows/tests.yml
M src/plone/restapi/serializer/schema.py
M src/plone/restapi/services/inherit/get.py
M src/plone/restapi/tests/http-examples/querystring_get.resp
M src/plone/restapi/tests/http-examples/querystring_get_contextual.resp
M src/plone/restapi/tests/http-examples/translated_messages_addons.resp
M src/plone/restapi/tests/http-examples/translated_messages_types_folder.resp
M src/plone/restapi/tests/http-examples/types_document.resp
M src/plone/restapi/tests/http-examples/types_document_put.req
M src/plone/restapi/tests/test_services_inherit.py
M test-no-uncommitted-doc-changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the read and write permission checks

6 participants