Skip to content

JSPWIKI-673 Do not loop when a page filter asks for the permissions of the page it filters - #556

Open
arturobernalg wants to merge 4 commits into
apache:masterfrom
arturobernalg:bug/JSPWIKI-673
Open

arturobernalg wants to merge 4 commits into
apache:masterfrom
arturobernalg:bug/JSPWIKI-673

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

https://issues.apache.org/jira/browse/JSPWIKI-673

Reading the ACL of a page renders the page, and rendering runs the page filters. A page filter that asks for the permissions of the page it is filtering, for example with AuthorizationManager.checkPermission in preTranslate, made DefaultAclManager.getPermissions render the page again, because the ACL of a page is only stored after the rendering ends. The result was a StackOverflowError: in a test with such a filter it came after 786 calls of the filter.

getPermissions now remembers, per thread, the pages whose ACL it is reading, and returns an empty ACL when it is asked again for one of them. The outer call still reads and stores the real ACL. The difference is that a filter that runs during that reading sees an empty ACL for its page at that moment.

DefaultAclManagerTest has a new test with a filter of that kind. It fails with a StackOverflowError without the change and passes with it. The whole jspwiki-main suite passes, 935 tests. I did not test the case of a filter that needs the real ACL of its own page during the first reading.

…f the page it filters

Reading the ACL of a page renders it, and rendering runs the page filters. A
filter that asked for the permissions of that same page in preTranslate made
DefaultAclManager.getPermissions render the page again, until the stack
overflowed. getPermissions now remembers the pages whose ACL the thread is
reading and returns an empty ACL when it is asked again for one of them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant