You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2017/05/15 08:06:04 UTC

[jira] [Commented] (OAK-5355) Too eager refreshing of tree permissions in SecureNodeBuilder

    [ https://issues.apache.org/jira/browse/OAK-5355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16010132#comment-16010132 ] 

Michael Dürig commented on OAK-5355:
------------------------------------

There is a problem with the setup of {{SecureNodeBuilderTest}} that causes a {{null}} value to be passed to the as the {{workspace}} argument to {{AuthorizationConfiguration.getPermissionProvider()}} from the initialisation of {{MutableRoot.permissionProvider}}. The following patch fixes this:

{code}
--- oak-core/src/test/java/org/apache/jackrabbit/oak/core/MutableRootTest.java	(date 1494834751000)
+++ oak-core/src/test/java/org/apache/jackrabbit/oak/core/MutableRootTest.java	(revision )
@@ -74,6 +74,7 @@
         ContentSessionImpl cs = Mockito.mock(ContentSessionImpl.class);
         when(cs.toString()).thenReturn("contentSession");
         when(cs.getAuthInfo()).thenReturn(AuthInfoImpl.EMPTY);
+        when(cs.getWorkspaceName()).thenReturn("default");
         root = new MutableRoot(store, new EmptyHook(), "default", new Subject(), sp, null, null, cs);
     }
{code}


> Too eager refreshing of tree permissions in SecureNodeBuilder
> -------------------------------------------------------------
>
>                 Key: OAK-5355
>                 URL: https://issues.apache.org/jira/browse/OAK-5355
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>            Reporter: Michael Dürig
>            Assignee: angela
>              Labels: technical_debt
>             Fix For: 1.7.0, 1.8
>
>         Attachments: OAK-5355.patch
>
>
> {{SecureNodeBuilder.baseChanged()}} calls {{SecureNodeBuilder.getTreePermission()}} even though the tree permission would be calculated lazily as needed anyway. Re-calculating the tree permissions at this point bears the risk of accessing stale data from the underlying not yet fully refreshed root (when being called e.g. from {{MutableRoot.refresh()}}. 
> I would thus argue for removing the call to {{SecureNodeBuilder.getTreePermission()}} from {{SecureNodeBuilder.baseChanged()}}. 
> See also OAK-5296 for an in-depth analysis. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)