-
-
Notifications
You must be signed in to change notification settings - Fork 39
Authorize only actual operation #171
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
Authorize only actual operation #171
Conversation
src/GraphQL.Authorization.Tests/AuthorizationValidationRuleTests.cs
Outdated
Show resolved
Hide resolved
|
@SlavaUtesinov Thanks to fix the oldest bug! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add a test with failing validation with a query of this nature:
query a {
...frag1
}
query b {
...frag1
}
fragment frag1 on Query {
# adminField should fail validation
adminField
}Ideally it would also allow this query when testing for operation a, but this could be a future enhancement:
query a {
# a field that passes validation
userField
}
query b {
...frag1
}
fragment frag1 on Query {
# adminField should fail validation
adminField
}|
I've added desired tests. |
| if (belongs) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| belongs = node is FragmentSpread fragmentSpread && fragmentSpread.Name == fragment.Name; | ||
|
|
||
| if (node != null) | ||
| { | ||
| node.Visit(Visit, 0); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (belongs) | |
| { | |
| return; | |
| } | |
| belongs = node is FragmentSpread fragmentSpread && fragmentSpread.Name == fragment.Name; | |
| if (node != null) | |
| { | |
| node.Visit(Visit, 0); | |
| } | |
| if (!belongs) | |
| { | |
| if (!(belongs = node is FragmentSpread fragmentSpread && fragmentSpread.Name == fragment.Name)) | |
| node.Visit(Visit, 0); | |
| } |
Codecov Report
@@ Coverage Diff @@
## develop #171 +/- ##
===========================================
+ Coverage 80.56% 83.60% +3.03%
===========================================
Files 9 9
Lines 211 250 +39
Branches 32 41 +9
===========================================
+ Hits 170 209 +39
Misses 32 32
Partials 9 9
Continue to review full report at Codecov.
|
|
@Shane32 ? |
|
I need to re-review |
|
@Shane32 ? |
This is a possible fix of the issue #5.