You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2013/03/25 17:59:44 UTC

Feedback on the current ResourceAccessSecurity API

Hi,

See below for a few comments about the recently added ResourceAccessSecurity.

IMO these show that this API will still evolve, which makes me think
that this belongs in the whiteboard for now - maybe using a forked
sling.api bundle if that's easier.

-Bertrand


Notes on ResourceAccessSecurity:

1) javadocs says "* - Expected to only be implemented once in the
framework/application...", I'm not sure about that. If you have both a
filesystem and an HBase resource providers, they might use very
different implementations?

2) Notes as comments in the interface:
public interface ResourceAccessSecurity {

    // Calling that canRead would be more consistent with other names
    public Resource checkReadPermission( Resource resource );

    // Having to extract username as a String feels a bit funny - maybe
    // you need an opaque ResourceCredentials object that the
ResourceResolver can provide
    // based on a Request or Resource, similar to JCR Sessions.
    public boolean canCreate( String absPathName, String user );

    public boolean canUpdate( Resource resource );
    public boolean canDelete( Resource resource );
    public boolean canExecute( Resource resource );

    public boolean canReadValue( Resource resource, String valueName );

    // Do we need both canCreate and canUpdate? To use canCreate you first need
    // to find out that the value doesn't exist, feels a bit weird.
Maybe canSetValue
    // can cover both cases, by first checking if the value exists
    public boolean canCreateValue( Resource resource, String valueName );
    public boolean canUpdateValue( Resource resource, String valueName );

    public boolean canDeleteValue( Resource resource, String valueName );

    // Does that rather belong to a QuerySecurity interface, what's
the use case?
    // Also, user vs. ResourceCredentials as above
    public String sanitizeQuery( String query, String language, String
user ) throws AccessSecurityException;

}

Re: Feedback on the current ResourceAccessSecurity API

Posted by Carsten Ziegeler <cz...@apache.org>.
2013/3/25 Mike Müller <mi...@mysign.ch>:
>> Notes on ResourceAccessSecurity:
>>
>
> At this time ResourceResolver has a method named getUserID() which
> returns a String. The Javadoc of this method says:
>      * Get the user ID, if any, associated with this resource resolver. The
>      * meaning of this identifier is an implementation detail defined by the
>      * underlying repository. This method may return null.
>
> If we want to use something different, we should use AuthenticationInfo, but
> This is not available in ResourceResolver interface.

Yes and no :) I think we should pass in ResourceResolver - for one, it
has the getUserID method but it also has the getAttribute methods
which allow access to most of the stuff passed into authentication
info (except password and maybe other security related information).

Carsten

>
>
>>
>>     public boolean canUpdate( Resource resource );
>>     public boolean canDelete( Resource resource );
>>     public boolean canExecute( Resource resource );
>>
>>     public boolean canReadValue( Resource resource, String valueName );
>>
>>     // Do we need both canCreate and canUpdate? To use canCreate you first need
>>     // to find out that the value doesn't exist, feels a bit weird.
>
> We do need canCreate, because you could save a resource without a value on it.
> The method canUpdate is the only way how a client of the ResourceAccessSecurity
> service can determine if a user must not update a resource. Otherwise the client
> has to check for every value which exists on the resource and also if the client
> does that, it's not sure if the user can create a new value on this resource to update
> it. canUpdate returns false if the user can't update any existing value and can't
> add a new value to the given resource.
>
>
>> Maybe canSetValue
>>     // can cover both cases, by first checking if the value exists
>>     public boolean canCreateValue( Resource resource, String valueName );
>>     public boolean canUpdateValue( Resource resource, String valueName );
>
> Yes good point, we could make this easier with just one method.
>
>>     public boolean canDeleteValue( Resource resource, String valueName );
>>
>>     // Does that rather belong to a QuerySecurity interface, what's
>> the use case?
>>     // Also, user vs. ResourceCredentials as above
>>     public String sanitizeQuery( String query, String language, String
>> user ) throws AccessSecurityException;
>
> This method is thought for special query languages where it is very easy
> to inject some things in the query which limits the resulting list of resources.
> This method delegates the call to the ResourceAccessGate#sanitizeQuery.
> It hasen't to be used by implementations of ResourceAccessGate, but can
> be used to speed up security checks a lot. Think of a mongodb like persistence
> layer with millions of resources saved. No we've got a user which has access
> to only 10 resources. Now he makes a query like "SELECT * FROM allresources"
> (just as an example in an SQL like language). This query would now return
> millions of resources and every resource in the returning list would be checked
> by ResourceAccessSecurity#canRead. With sanitizeQuery the query could
> be injected with some limiting statements like "SELECT * FROM allresources
> WHERE owner=<userid>". In this case a list of only 10 resources would
> be returned. Nevertheless every returned resource would be checked by canRead,
> but the performance would be much much better than in the first case.
>
> Best regards
> mike



-- 
Carsten Ziegeler
cziegeler@apache.org

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
Thank you Bertrand for the more precise javadocs. I have also
changed to javadoc from AccessSecurityException to be more
generic. (commited in r1464476)

best regards
Mike

> -----Original Message-----
> From: Bertrand Delacretaz [mailto:bdelacretaz@apache.org]
> Sent: Thursday, April 04, 2013 10:05 AM
> To: dev@sling.apache.org
> Subject: Re: Feedback on the current ResourceAccessSecurity API
> 
> Hi Mike,
> 
> On Wed, Apr 3, 2013 at 9:18 PM, Mike Müller <mi...@mysign.ch> wrote:
> > ...I commited a last shot of the SPI API. The Sling API hasn't changed
> > anymore. I think the API is now complete and after all the discussions
> > enough mature....
> 
> I have added/tweaked javadocs on the ResourceAccessSecurity interface
> in revision 1464342, could you cross-check?
> 
> Also, the AccessSecurityException javadoc says "Exception thrown by
> ResourceAccessGate#sanitizeQuery(String, String,
> org.apache.sling.auth.core.spi.AuthenticationInfo) if the query is not
> allowed or illegal.", I would move that info to the sanitizeQuery
> method instead, and make the exception description more generic - feel
> free to do that if you agree.
> 
> -Bertrand

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

On Wed, Apr 3, 2013 at 9:18 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...I commited a last shot of the SPI API. The Sling API hasn't changed
> anymore. I think the API is now complete and after all the discussions
> enough mature....

I have added/tweaked javadocs on the ResourceAccessSecurity interface
in revision 1464342, could you cross-check?

Also, the AccessSecurityException javadoc says "Exception thrown by
ResourceAccessGate#sanitizeQuery(String, String,
org.apache.sling.auth.core.spi.AuthenticationInfo) if the query is not
allowed or illegal.", I would move that info to the sanitizeQuery
method instead, and make the exception description more generic - feel
free to do that if you agree.

-Bertrand

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
I commited a last shot of the SPI API. The Sling API hasn't changed
anymore. I think the API is now complete and after all the discussions 
enough mature.

best regards
mike

> -----Original Message-----
> From: Carsten Ziegeler [mailto:cziegeler@apache.org]
> Sent: Wednesday, April 03, 2013 1:48 PM
> To: dev@sling.apache.org
> Subject: Re: Feedback on the current ResourceAccessSecurity API
> 
> We discussed this API in length and as I said, the impl is missing. So yes,
> we're not releasing until it's implemented
> 
> 
> 2013/4/3 Bertrand Delacretaz <bd...@apache.org>
> 
> > On Wed, Apr 3, 2013 at 12:17 PM, Carsten Ziegeler <cz...@apache.org>
> > wrote:
> > > ...I would like to cut some releases shortly, especially a new API,
> > > resourceresolver and jcr resource release...
> >
> > Do we really want to include Mike's new APIs in a release already?
> >
> > I'd feel more comfortable if we can look at them in parallel, and
> > release only once we have at least a basic implementation that
> > demonstrates the ideas.
> >
> > -Bertrand
> >
> 
> 
> 
> --
> Carsten Ziegeler
> cziegeler@apache.org

Re: Feedback on the current ResourceAccessSecurity API

Posted by Carsten Ziegeler <cz...@apache.org>.
We discussed this API in length and as I said, the impl is missing. So yes,
we're not releasing until it's implemented


2013/4/3 Bertrand Delacretaz <bd...@apache.org>

> On Wed, Apr 3, 2013 at 12:17 PM, Carsten Ziegeler <cz...@apache.org>
> wrote:
> > ...I would like to cut some releases shortly, especially a new API,
> > resourceresolver and jcr resource release...
>
> Do we really want to include Mike's new APIs in a release already?
>
> I'd feel more comfortable if we can look at them in parallel, and
> release only once we have at least a basic implementation that
> demonstrates the ideas.
>
> -Bertrand
>



-- 
Carsten Ziegeler
cziegeler@apache.org

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Wed, Apr 3, 2013 at 12:17 PM, Carsten Ziegeler <cz...@apache.org> wrote:
> ...I would like to cut some releases shortly, especially a new API,
> resourceresolver and jcr resource release...

Do we really want to include Mike's new APIs in a release already?

I'd feel more comfortable if we can look at them in parallel, and
release only once we have at least a basic implementation that
demonstrates the ideas.

-Bertrand

Re: Feedback on the current ResourceAccessSecurity API

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

I would like to cut some releases shortly, especially a new API,
resourceresolver and jcr resource release.

I think, this is the only item blocking this. From the api pov, I guess
only the definition of the resource provider property is missing which
controls whether the RAS should be applied.
How about the implementation?

Regards
Carsten


2013/3/27 Mike Müller <mi...@mysign.ch>

> +1
>
> > -----Original Message-----
> > From: Bertrand Delacretaz [mailto:bdelacretaz@apache.org]
> > Sent: Wednesday, March 27, 2013 5:53 PM
> > To: dev@sling.apache.org
> > Subject: Re: Feedback on the current ResourceAccessSecurity API
> >
> > On Wed, Mar 27, 2013 at 5:48 PM, Carsten Ziegeler <cz...@apache.org>
> > wrote:
> > > ...What about a neutral name? It's up to the implementation whether it
> > > optimizes or sanitizes - transformQuery maybe?...
> >
> > Works for me, suggested javadoc:
> >
> > **
> > Allows the ResourceProvider to transform the query based on the
> > current user's credentials. Can be used to narrow down queries to omit
> > results that the current user is not allowed to see anyway, speeding
> > up downstream access control.
> >
> > Query transformations are not critical w.r.t access control as results
> > are checked using the canRead.. methods anyway.
> > ***
> >
> > -Bertrand
>



-- 
Carsten Ziegeler
cziegeler@apache.org

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
+1

> -----Original Message-----
> From: Bertrand Delacretaz [mailto:bdelacretaz@apache.org]
> Sent: Wednesday, March 27, 2013 5:53 PM
> To: dev@sling.apache.org
> Subject: Re: Feedback on the current ResourceAccessSecurity API
> 
> On Wed, Mar 27, 2013 at 5:48 PM, Carsten Ziegeler <cz...@apache.org>
> wrote:
> > ...What about a neutral name? It's up to the implementation whether it
> > optimizes or sanitizes - transformQuery maybe?...
> 
> Works for me, suggested javadoc:
> 
> **
> Allows the ResourceProvider to transform the query based on the
> current user's credentials. Can be used to narrow down queries to omit
> results that the current user is not allowed to see anyway, speeding
> up downstream access control.
> 
> Query transformations are not critical w.r.t access control as results
> are checked using the canRead.. methods anyway.
> ***
> 
> -Bertrand

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Wed, Mar 27, 2013 at 5:48 PM, Carsten Ziegeler <cz...@apache.org> wrote:
> ...What about a neutral name? It's up to the implementation whether it
> optimizes or sanitizes - transformQuery maybe?...

Works for me, suggested javadoc:

**
Allows the ResourceProvider to transform the query based on the
current user's credentials. Can be used to narrow down queries to omit
results that the current user is not allowed to see anyway, speeding
up downstream access control.

Query transformations are not critical w.r.t access control as results
are checked using the canRead.. methods anyway.
***

-Bertrand

Re: Feedback on the current ResourceAccessSecurity API

Posted by Carsten Ziegeler <cz...@apache.org>.
What about a neutral name? It's up to the implementation whether it
optimizes or sanitizes - transformQuery maybe?

Carsten

2013/3/27 Mike Müller <mi...@mysign.ch>:
>>
>> So it is optimizeQuery really ;-)
>>
>> -Bertrand
>
> optimizeQuery in matters of performant security checks :-)
> Maybe you are right in this case, that we rather should name the method optimizeQuery than sanitizeQuery.
>
> mike



-- 
Carsten Ziegeler
cziegeler@apache.org

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
> 
> So it is optimizeQuery really ;-)
> 
> -Bertrand

optimizeQuery in matters of performant security checks :-)
Maybe you are right in this case, that we rather should name the method optimizeQuery than sanitizeQuery.

mike

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

On Wed, Mar 27, 2013 at 12:50 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...It shouldn't scare at all: With or without the use of sanitizeQuery, the resulting
> list of resources (or the resulting resource) is checked against security anyway...

ok, good then.

> ...The use case is very simple as showed above:
> If a query returns a lot of resources but the querying user does only have access
> to a few of these resources, sanitizeQuery could change the query in a way that
> only a few resources will be returned from the resource provider. Without
> sanitizeQuery it can take quite a long time to check each and every resource with
> getReadableResource() if the querying user has read access to the resource...

So it is optimizeQuery really ;-)

-Bertrand

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
> > It's not really an optimization in the sense of a QueryOptimizer, that could be
> done
> > by every ResourceProvider by now, without any new API. The sanitizeQuery
> functionality
> > has to come with the ResourceAccessSecurity service: The query can be
> injected
> > (sanitized) only from a service which "knows" the security rules for the given
> user.
> > If you look at the example above with the injection "WHERE owner=<user>":
> This
> > could only be injected by a service which knows that the given user only has
> access
> > to resources where the he is the owner. Maybe a different user with more rights
> > does not have any restrictions (or another restriction)....
> 
> This sounds scary to me in terms of security, with many moving parts.
> I guess I'll need to see more concrete examples to make up my mind.


It shouldn't scare at all: With or without the use of sanitizeQuery, the resulting
list of resources (or the resulting resource) is checked against security anyway.
So sanitizeQuery does not disturb security. The use case is very simple as showed above:
If a query returns a lot of resources but the querying user does only have access
to a few of these resources, sanitizeQuery could change the query in a way that
only a few resources will be returned from the resource provider. Without 
sanitizeQuery it can take quite a long time to check each and every resource with
getReadableResource() if the querying user has read access to the resource.
We don't talk about some milliseconds here but about seconds or minutes if there
are a lot of similar resources but the user has access only to a few (and the persistence
does not have any ACLs - which is the use case for ResourceAccessSecurity).
So we really can gain a lot with this method in matters of performance for some
cases, but nobody who want's to use ResourceAccessSecurity in the future has
to implement it. The disadvantage could be (depends on the data) that applying
access rights is slow if someone decides not to impement it. So we only can win
with this additional method.

Best regards
Mike

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

On Wed, Mar 27, 2013 at 8:54 AM, Mike Müller <mi...@mysign.ch> wrote:
>> > Bertrand wrote:
>> Could sanitizeQuery be done by having the ResourceProvider implement a
>> QueryOptimizer API instead?...

> It's not really an optimization in the sense of a QueryOptimizer, that could be done
> by every ResourceProvider by now, without any new API. The sanitizeQuery functionality
> has to come with the ResourceAccessSecurity service: The query can be injected
> (sanitized) only from a service which "knows" the security rules for the given user.
> If you look at the example above with the injection "WHERE owner=<user>": This
> could only be injected by a service which knows that the given user only has access
> to resources where the he is the owner. Maybe a different user with more rights
> does not have any restrictions (or another restriction)....

This sounds scary to me in terms of security, with many moving parts.
I guess I'll need to see more concrete examples to make up my mind.

-Bertrand

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
> On Mon, Mar 25, 2013 at 8:14 PM, Mike Müller <mi...@mysign.ch> wrote:
> ...
> > Bertrand wrote:
> >>     // Calling that canRead would be more consistent with other names
> >>     public Resource checkReadPermission( Resource resource );
> >
> > I choosed another naming because canCreate, canDelete, etc. returns a
> boolean,
> > but checkReadPermission returns a Resource. Maybe it's more visible with
> > a different methode name.
> 
> What's the goal of returning a Resource? Is one expected to use the
> returned one instead of the one that's passed into the method?
> 
> If yes I'd suggest getReadableResource(Resource).

Yes, that's exactly what it does - I will take with your method name.

 
> ...
> >>     // Having to extract username as a String feels a bit funny - maybe
> >>     // you need an opaque ResourceCredentials object...
> > ...At this time ResourceResolver has a method named getUserID() which
> > returns a String...
> 
> As Carsten says, passing the ResourceResolver in such cases is
> probably the best way to provide context.

That's okay for me


> 
> >>... Maybe canSetValue
> >>     // can cover both cases, by first checking if the value exists..
> 
> > Yes good point, we could make this easier with just one method.
> 
> ok
> 
> >...
> >>     public String sanitizeQuery( String query, String language, String
> >> user ) throws AccessSecurityException;
> > ...Think of a mongodb like persistence
> > layer with millions of resources saved. No we've got a user which has access
> > to only 10 resources. Now he makes a query like "SELECT * FROM allresources"
> > (just as an example in an SQL like language). This query would now return
> > millions of resources and every resource in the returning list would be checked
> > by ResourceAccessSecurity#canRead. With sanitizeQuery the query could
> > be injected with some limiting statements like "SELECT * FROM allresources
> > WHERE owner=<userid>". In this case a list of only 10 resources would
> > be returned. Nevertheless every returned resource would be checked by
> canRead,
> > but the performance would be much much better than in the first case....
> 
> Could this be done by having the ResourceProvider implement a
> QueryOptimizer API instead? The ResourceResolver can then check if the
> provider implements this and call that method in that case. It doesn't
> feel right to me to mix that method with security stuff as it has
> nothing to do with security AFAICS.

It's not really an optimization in the sense of a QueryOptimizer, that could be done
by every ResourceProvider by now, without any new API. The sanitizeQuery functionality
has to come with the ResourceAccessSecurity service: The query can be injected 
(sanitized) only from a service which "knows" the security rules for the given user.
If you look at the example above with the injection "WHERE owner=<user>": This
could only be injected by a service which knows that the given user only has access
to resources where the he is the owner. Maybe a different user with more rights
does not have any restrictions (or another restriction).
I do have experience with such a possibility of query injection for years now and 
can say that it speeds up access controlling a lot. 

best regards
Mike

Re: Feedback on the current ResourceAccessSecurity API

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Mike,

Thanks for your replies - as usual I'm a stickler for names...I think
good naming helps a lot in making APIs understandable.

On Mon, Mar 25, 2013 at 8:14 PM, Mike Müller <mi...@mysign.ch> wrote:
...
> Bertrand wrote:
>>     // Calling that canRead would be more consistent with other names
>>     public Resource checkReadPermission( Resource resource );
>
> I choosed another naming because canCreate, canDelete, etc. returns a boolean,
> but checkReadPermission returns a Resource. Maybe it's more visible with
> a different methode name.

What's the goal of returning a Resource? Is one expected to use the
returned one instead of the one that's passed into the method?

If yes I'd suggest getReadableResource(Resource).

...
>>     // Having to extract username as a String feels a bit funny - maybe
>>     // you need an opaque ResourceCredentials object...
> ...At this time ResourceResolver has a method named getUserID() which
> returns a String...

As Carsten says, passing the ResourceResolver in such cases is
probably the best way to provide context.

>>... Maybe canSetValue
>>     // can cover both cases, by first checking if the value exists..

> Yes good point, we could make this easier with just one method.

ok

>...
>>     public String sanitizeQuery( String query, String language, String
>> user ) throws AccessSecurityException;
> ...Think of a mongodb like persistence
> layer with millions of resources saved. No we've got a user which has access
> to only 10 resources. Now he makes a query like "SELECT * FROM allresources"
> (just as an example in an SQL like language). This query would now return
> millions of resources and every resource in the returning list would be checked
> by ResourceAccessSecurity#canRead. With sanitizeQuery the query could
> be injected with some limiting statements like "SELECT * FROM allresources
> WHERE owner=<userid>". In this case a list of only 10 resources would
> be returned. Nevertheless every returned resource would be checked by canRead,
> but the performance would be much much better than in the first case....

Could this be done by having the ResourceProvider implement a
QueryOptimizer API instead? The ResourceResolver can then check if the
provider implements this and call that method in that case. It doesn't
feel right to me to mix that method with security stuff as it has
nothing to do with security AFAICS.

-Bertrand

RE: Feedback on the current ResourceAccessSecurity API

Posted by Mike Müller <mi...@mysign.ch>.
> Notes on ResourceAccessSecurity:
> 
> 1) javadocs says "* - Expected to only be implemented once in the
> framework/application...", I'm not sure about that. If you have both a
> filesystem and an HBase resource providers, they might use very
> different implementations?
> 
> 2) Notes as comments in the interface:
> public interface ResourceAccessSecurity {
> 
>     // Calling that canRead would be more consistent with other names
>     public Resource checkReadPermission( Resource resource );

I choosed another naming because canCreate, canDelete, etc. returns a boolean,
but checkReadPermission returns a Resource. Maybe it's more visible with
a different methode name.

 
>     // Having to extract username as a String feels a bit funny - maybe
>     // you need an opaque ResourceCredentials object that the
> ResourceResolver can provide
>     // based on a Request or Resource, similar to JCR Sessions.
>     public boolean canCreate( String absPathName, String user );

At this time ResourceResolver has a method named getUserID() which
returns a String. The Javadoc of this method says:
     * Get the user ID, if any, associated with this resource resolver. The
     * meaning of this identifier is an implementation detail defined by the
     * underlying repository. This method may return null.

If we want to use something different, we should use AuthenticationInfo, but
This is not available in ResourceResolver interface. 


> 
>     public boolean canUpdate( Resource resource );
>     public boolean canDelete( Resource resource );
>     public boolean canExecute( Resource resource );
> 
>     public boolean canReadValue( Resource resource, String valueName );
> 
>     // Do we need both canCreate and canUpdate? To use canCreate you first need
>     // to find out that the value doesn't exist, feels a bit weird.

We do need canCreate, because you could save a resource without a value on it.
The method canUpdate is the only way how a client of the ResourceAccessSecurity
service can determine if a user must not update a resource. Otherwise the client
has to check for every value which exists on the resource and also if the client
does that, it's not sure if the user can create a new value on this resource to update
it. canUpdate returns false if the user can't update any existing value and can't 
add a new value to the given resource.


> Maybe canSetValue
>     // can cover both cases, by first checking if the value exists
>     public boolean canCreateValue( Resource resource, String valueName );
>     public boolean canUpdateValue( Resource resource, String valueName );

Yes good point, we could make this easier with just one method. 
 
>     public boolean canDeleteValue( Resource resource, String valueName );
> 
>     // Does that rather belong to a QuerySecurity interface, what's
> the use case?
>     // Also, user vs. ResourceCredentials as above
>     public String sanitizeQuery( String query, String language, String
> user ) throws AccessSecurityException;

This method is thought for special query languages where it is very easy
to inject some things in the query which limits the resulting list of resources.
This method delegates the call to the ResourceAccessGate#sanitizeQuery.
It hasen't to be used by implementations of ResourceAccessGate, but can
be used to speed up security checks a lot. Think of a mongodb like persistence
layer with millions of resources saved. No we've got a user which has access
to only 10 resources. Now he makes a query like "SELECT * FROM allresources"
(just as an example in an SQL like language). This query would now return
millions of resources and every resource in the returning list would be checked
by ResourceAccessSecurity#canRead. With sanitizeQuery the query could
be injected with some limiting statements like "SELECT * FROM allresources
WHERE owner=<userid>". In this case a list of only 10 resources would
be returned. Nevertheless every returned resource would be checked by canRead,
but the performance would be much much better than in the first case.

Best regards
mike