IAuthorizationRequirement is not sent the same variable names as those in IResolveField context #139
Labels
needs confirmation
The problem is most likely resolved and requires verification by the author
Take the following AuthorizationRequirement:
It can be defeated with the following query:
This is because AuthorizationContext.InputVariables accesses the variables object whereas IResolveFieldContext.GetArgument<>() accesses variables from the query arguments, whose names are defined by the schema.
As it stands now, there is no way to secure fields based on what arguments are allowed to be passed in. In fact, as shown above, there is no point in securing the variables object's key names since any other variable name can be passed in as a query argument.
Resolution:
Pass IResolveFieldContext.Arguments as AuthorizationContext.Arguments into IAuthorizationRequirement.Authorize.
This only makes sense as AuthorizationRequirements are supposed to define authorization for fields, therefore, they should look at the same context that they are securing.
The text was updated successfully, but these errors were encountered: