-
Notifications
You must be signed in to change notification settings - Fork 18
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
Gravsearch ForbiddenResource result and permissions of linked resources #1344
Comments
@tobiasschweizer Do you think this is a bug? Or is it correct behaviour? |
I am not sure I understand correctly. Could I see the complete response? |
Sorry, I'm not very clear... So, when I run the cited gravsearch query, I get that response: {
"@id": "http://rdfh.ch/0000/forbiddenResource",
"@type": "knora-api:ForbiddenResource",
"knora-api:arkUrl": {
"@type": "xsd:anyURI",
"@value": "https://ark.dasch.swiss/ark:/72163/1/0000/forbiddenResourceV"
},
"knora-api:attachedToProject": {
"@id": "http://www.knora.org/ontology/knora-admin#SystemProject"
},
"knora-api:attachedToUser": {
"@id": "http://rdfh.ch/users/root"
},
"knora-api:creationDate": {
"@type": "xsd:dateTimeStamp",
"@value": "2017-10-06T11:05:37Z"
},
"knora-api:hasPermissions": "CR knora-admin:Creator|M knora-admin:ProjectMember|V knora-admin:KnownUser|V knora-admin:UnknownUser",
"knora-api:userHasPermission": "V",
"knora-api:versionArkUrl": {
"@type": "xsd:anyURI",
"@value": "https://ark.dasch.swiss/ark:/72163/1/0000/forbiddenResourceV.20171006T110537Z"
},
"rdfs:label": "This resource is a proxy for a resource you are not allowed to see (may depend on the context: query path)",
"@context": {
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"knora-api": "http://api.knora.org/ontology/knora-api/v2#"
}
} While, if I use the I think the problem comes from the user rights, this user does not have access to the linked Collection resources, but I don't ask for it, I just ask for the the linked properties values ( |
The rule is: if the user does not have sufficient permission on anything (linking value or referred resource) in the WHERE clause, the forbidden resource is returned. |
1/ so it's not the same rule as with 2/ I cannot get the And the only solution there is to remove this property of the gravsearch query? |
If the user can see the link value but not the referred resource, the forbidden resource is returned. |
But I think Gilles is saying that when he uses |
|
yes, exactly. |
Right, so the two routes don't apply the same rule. Hence my question: is this correct, and if so, do you remember why we decided to do it this way? |
I think it's correct. We do not want the user to know that a specific resource links to another one when he does not have the sufficient permissions on the link value or the referred resource. If the resource was returned without the link value / the nested resource, the user could still infer the such a relation exists. |
just think of the dating website metaphor :-) |
So the logic is: We hide relations that you don't have permission to see. If you use Gravsearch, you're saying, "Show me the resources that have this relation." To hide the relation, we have to hide the resource. But if you use Let's document it. |
yes |
But I could do something like this: CONSTRUCT {
?johnSmith knora-api:isMainResource true .
} WHERE {
BIND(<http://rdfh.ch/john-smith> as ?johnSmith)
?johnSmith example:isDatingPerson ?otherPerson .
FILTER NOT EXISTS {
?johnSmith example:isSpouseOf ?otherPerson .
}
} If I got |
we do not hide that such a relation exists |
So why return |
we do not hide that such a relation exists but still do not tell to what resource it applies |
ideally, the resource would be suppressed, but that would make paging difficult |
So why not have the same behaviour as in |
I remember we agreed that the client must have sufficient permissions on everything present in the restrictions, otherwise forbidden resource is returned that could surely be changed in the processing logic |
now I remember: we decided that Knora does not have to provide the same level of security as a dating website service |
I think the problem is CONSTRUCT {
?johnSmith knora-api:isMainResource true .
} WHERE {
BIND(<http://rdfh.ch/john-smith> as ?johnSmith)
?johnSmith example:isDatingPerson <http://rdfh.ch/jane-jones>.
} Then if you got Could we make it so that if your search returns less than one page of results, and they're all forbidden, we return 0 results to the client, instead of returning |
I am happy to think about this in the future but right now I am very busy finishing the BEOL project and documenting everything. |
OK. |
A logical way for us (with @mrivoal and @loicjaouen) could be to return in any cases the link, and when the link refers to a |
@tobiasschweizer Could you give me your opinion about that issue? |
@gfoo Yes, of course it could be made more flexible!
I think Permission checking removes value objects or dependent resources the user has insufficient permissions to see: @benjamingeer suggested in #1344 (comment)
I think this would have to be done after So we need to agree on how we want Gravsearch to behave and who would implement that change. Also I think this should include writing unit tests for |
I would like to discuss this point again and insist on this part: From our point of view, and given the granularity allowed by that the current permissions' schema, the current behaviour of Gravsearch may be too simplistic. It raises troubles for the development of Lumières.Lausanne application. Given the above ontology, I think we should definitely be able to display a list of
I think we could/should live with that. As long as you don't know what is the target resource of the link property, I don't think it is a problem. |
I believe that this is already the case, as long as your query does not ask for the linked |
I think it would be difficult to guarantee this in any case. You could, for example, specify the target resource in a |
I have also been wondering for a long time whether we could eliminate |
Wasn't paging the reason for |
Yes, the idea is that all pages except the last one have a fixed size. If you get a page that's smaller than the fixed size, you know it's the last page. |
Could there be empty pages then? |
Yes, I think that would make sense. An alternative would be that Knora could automatically query the next page until it got a non-empty one. But that could take a long time if there were a lot of results that the user didn't have permission to see. Maybe better to let the client do it; then the user can see what's going on, and maybe change their query. |
so that means this is something I should keep in mind when writing the search endpoint in knora-api-lib-js |
So, could we back to my initial question? :) Let say, we have this ontology
If you think that this is a normal way to manage permissions, so the only solution to get data using gravsearch will be:
It really depends on how
Maybe we should redesign our web app to consume less data at one time, that is the case of modern UX design, all is reactive now! But why to use systematically Gravsearch? Because it is flexible, orderable, constraintable, response size optimizable. THE missing feature from my point of view: do no return |
Ok, let's consider getting rid of |
for what I remember it is not so possible right now mainly because the permissions constraints are not in the sparql query which provides the pages?... Maybe it is not true anymore. But it could be implemented in |
It's still true, because the permissions constraints can't be implemented in SPARQL. We can get rid of |
Permissions have to be implemented in the Knora, otherwise any client could ignore them. |
If we go back to the initial issue,
Do you think this is the correct behaviour? If so (I am not yet quite convinced), then we should find a workaround for Lumières.Lausanne. |
For all previous use cases cited above, I think I can find other ways to access data without right permissions errors:
But I have a last use case that I don't know how to fix if the current user has not enough rights to access to all
Find all This is something that you will have to face in the extended search of Kuirl? |
Moving to #1494. |
With gravsearch, I get a
ForbiddenResource
when a user does not have enough rights to get a linked resource but enough rights to get the property linking this resource. Withv2/resources
endpoint it works correctly.For example with this query, I get a
ForbiddenResource
if a user (groupphp-student
) cannot view aCollection
related to aPerson
(see expected result below).n.b.: with Knora 7.0.0
With a user from
administrator
group who has access to relatedCollections
, we get this normal result:As explained, for example, the first
Collection
with IRIhttp://rdfh.ch/0113/xYkKg_GfQ5az0FOqS1iOwA
cannot be seen by alumieres-lausanne-phdstudent
user:The text was updated successfully, but these errors were encountered: