Open andreloeffelmann opened 2 months ago
Corresponding ZenDesk ticket here
Hey @andreloeffelmann, I'm going to relabel this as a feature request, because this isn't intended to work this way - this would essentially be classed as something like a new operation FILTER
inside the @authorization
directive which isn't currently available. The READ
and AGGREGATE
operations apply to the fields inside the selection set, and fields within the input objects.
Hey @darrellwarde, I see your point from a developer's perspective.
However, the current state of neo4j-graphql is just not consistent. When executing the query of the example above I receive products
which have exactly 1 variants
but also those which have 0 or more than 1. The filter of the query just does not work.
And this is something which is not transparent/logically conclusive for the API consumer.
Even worse, it was pure coincidence that we figured this out! The documentation does not mention that @authorization
will not work inside filters of a simple READ query.
If you see this as a feature request
- OK. But if so, neo4j-graphql should NOT render relationship fields into the filter *Where
type which connect to a type for which an @authorization
directive is declared. Better to not offer a functionality than offering it in a buggy way!
So, from my point of view, I see the following solutions:
FILTER
inside the @authorization
directiveFILTER
inside the @authorization
directive AND remove the relationship fields from the generated filter *Where
type which connect to a type for which an @authorization
directive is declared if the FILTER
operation is not givenEither way, when do you think can we expect a solution on this? This is an internal high-prio case which I already reported via our enterprise support.
Hey @darrellwarde , any news on this? Was hoping that this will be addressed in v6, but according to the docs it was not?
Hey @andreloeffelmann, I totally missed your last message in September, my apologies!
When executing the query of the example above I receive
products
which have exactly 1variants
but also those which have 0 or more than 1. The filter of the query just does not work.
I'm reading this issue over and over and I can't see how this would be related to this authorization feature request - the variantsAggregate
filter that you're applying to your query is being translated into Cypher so this shouldn't be the case even without this authorization filters. Or am I missing something here?
Either way, when do you think can we expect a solution on this? This is an internal high-prio case which I already reported via our enterprise support.
We will have to talk about if and how we address this for Version 7 if it could be a breaking change. However, my view still stands that the authorization features of the library exist to control the reading (i.e. the return of data to consumers) and writing (i.e. database writes) through the API. The usage of the authorization features in this manner, to achieve some kind of "default filter", was never really the intended purpose of the feature. Our primary focus for this feature is that data is secure, which I still believe is the case with the state of things in this issue.
This is not to say that we will not look at this, but just to offer some explanation as why this has not been looked at yet in this time where we have a bunch of high priority architectural changes to work on.
Describe the bug When defining filters via the
@authorization
directive, these filters are not rendered asWHERE
clauses inside subqueries which match/reference on the (root)-node for which these filters are defined.Type definitions
To Reproduce Steps to reproduce the behavior:
LIMIT $param3 CALL { WITH this MATCH (this)<-[this3:PRODUCT_HAS_FAMILY_PRODUCT]-(this4:Product) WHERE (($param4 IS NOT NULL AND this4.isEmpty = $param4) AND ($param5 IS NOT NULL AND this4.isPublic = $param5)) RETURN count(this4) AS var5 } RETURN this { .productId, variantsAggregate: { count: var5 } } AS this cypher params: { param0: Integer { low: 1, high: 0 }, param1: false, param2: true, param3: Integer { low: 1, high: 0 }, param4: false, param5: true }
Expected behavior Authorization filters from the
@authorization
directive should be generated asWHERE
clauses on all subqueries/queries which match on a node for which these filters are defined.System