You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tl;dr - We should avoid returning an error in ListObjects for Conditional Relationship Tuple evaluation errors if we've already determined a determinate result for that object.
Given an FGA model such as:
type user
type org
relations
define viewer: [user]
type folder
relations
define viewer: [user]
type document
relations
define parent: [folder with condx, org with condy]
define viewer: viewer from parent
condition condx(x: int) {
x < 10
}
condition condy(y: int) {
y > 25
}
document:1#parent@folder:x, condition: condx
document:1#parent@org:acme, condition: condy
folder:x#viewer@user:jon
org:acme#viewer@user:jon
Check(document:1#viewer@user:jon, context: {"x": 5}) will always return {allowed: true} through the branch of evaluation that involves folder:x#viewer@user:jon.
ListObjects(document#viewer, user:jon, context: {"x": 5}) will return an error (error code 2000). This is because we'll see the document:1#parent@org:acme relationship, but we won't be able to evaluate it because context parameter y is missing.
The OpenFGA server shouldn't return an error for the ListObjects case, because it is able to find document:1 through the folder:x#viewer branch and so the other parent relationship with org:acme that is unresolvable should be irrelevant.
Expectation
I expect the following:
Check(document:1#viewer@user:jon, context: {"x": 5}) --> {allowed: true} - through folder:x#viewer Check(document:1#viewer@user:jon, context: {"y": 26}) --> {allowed: true} - through org:acme#viewer
ListObjects(document#viewer, user:jon, context: {"x": 5}) --> ["document:1"] - through folder:x#viewer ListObjects(document#viewer, user:jon, context: {"y": 26}) --> ["document:1"] - through org:acme#viewer
The OpenFGA server shouldn't return an error for the ListObjects case, because it is able to find document:1 through the folder:x#viewer branch and so the other parent relationship with org:acme that is unresolvable should be irrelevant.
We'll have to change our design quite a bit to accomodate for this, e.g. associate each evaluation error with a tuple, accumulate all errors until the very end (how do we bound this?), and compare those tuples with the actual results sent.
Checklist
Description
tl;dr
- We should avoid returning an error in ListObjects for Conditional Relationship Tuple evaluation errors if we've already determined a determinate result for that object.Given an FGA model such as:
Check(document:1#viewer@user:jon, context: {"x": 5})
will always return{allowed: true}
through the branch of evaluation that involvesfolder:x#viewer@user:jon
.ListObjects(document#viewer, user:jon, context: {"x": 5})
will return an error (error code 2000). This is because we'll see thedocument:1#parent@org:acme
relationship, but we won't be able to evaluate it because context parametery
is missing.The OpenFGA server shouldn't return an error for the ListObjects case, because it is able to find
document:1
through thefolder:x#viewer
branch and so the other parent relationship withorg:acme
that is unresolvable should be irrelevant.Expectation
I expect the following:
Check(document:1#viewer@user:jon, context: {"x": 5})
-->{allowed: true}
- throughfolder:x#viewer
Check(document:1#viewer@user:jon, context: {"y": 26})
-->{allowed: true}
- throughorg:acme#viewer
ListObjects(document#viewer, user:jon, context: {"x": 5})
-->["document:1"]
- throughfolder:x#viewer
ListObjects(document#viewer, user:jon, context: {"y": 26})
-->["document:1"]
- throughorg:acme#viewer
Reproduction
I expect step #3 above to return
["document:1"]
not an error. Similarly,Store data
No response
OpenFGA version
v1.5.1
How are you running OpenFGA?
As a binary
What datastore are you using?
In-Memory
OpenFGA Flags
./openfga run
Logs
No response
The text was updated successfully, but these errors were encountered: