-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Version/Branch | 0.12-dev |
Query:
type: 'object'
config:
fieldsDefaultAccess: '@=isFullyAuthenticated()'
On Query fields, I have currently seemingly random behavior, when user is NOT fully authenticated:
Possible outcomes, when I query those fields:
- error, can not return null on non nullable field
- proper error graphql response, with "access denied"
- data is returned as if the user is authenticated!
When I modify the config for a field with error (1.) by adding a const "access: false", the query correctly returns "access denied for this field". So it does not have to do with the fact, the field is non-nullable. Otherwise I would get the same error. I also do NOT have any logic inside the field's resolver, which returns null when user is not fully authenticated.
When I modify the config for the same field by replacing "false" with "@=isFullyAuthenticated()", it again result in error "can not return null on non nullable field.
It seems like it has something to do with expression evaluation?
A more critical issue is that certain fields return actual data to non-authenticated users!
I do not know what the reason is, but this one is special so I assume its the type of returned value from the expression, which matters. The field is only a "namespace" field:
Query:
[...]
fieldsDefaultAccess: '@=isFullyAuthenticated()'
fields:
thisFieldIsLeaked:
type: 'FieldType'
resolve: '@=[]'
While the FieldType is an actuall mapped type with resolvers. The data is returned to the client, even if the user is not fully authenticated.
When I add a const "access: false" to this field, I get a proper "access denied" response! So again, the expression seem to influence the behavior in a weird way.
I have tested that the user is actually really not fully authenticated, via debugging, symfony profiler, adding a field which is queries together with the problem-fields returning "resolve: @=isFullyAuthenticated()".