Conversation
|
@firaskafri should we release another patch version (v3.1.6) before merging this? I think this deserves a minor bump to v3.2.0 but there were a couple of small bug fixing PRs merged since v3.1.5 so I think it's a good idea to have another patch version for v3.1. |
dfbb8bf to
8eeffc7
Compare
sjdemartini
left a comment
There was a problem hiding this comment.
💯
Awesome stuff! Really appreciate the clear docs examples and tests!
Agreed with your suggestion that we should release another patch version (v3.1.6) before merging this and releasing this as a minor bump to 3.2.0
| def test_validation_disallow_introspection(client, url): | ||
| response = client.post(url_string(url, query="{__schema {queryType {name}}}")) | ||
|
|
||
| assert response.status_code == 400 |
There was a problem hiding this comment.
How about we also check that the json representation of the response does not contain the __schema in its data (or data is null/empty, however it appears in practice)? That way we ensure it's not merely returning a 400 and the error message, but is also omitting the introspection data from the response as intended. (Same goes for the other 400 error tests below)
pmcarlos
left a comment
There was a problem hiding this comment.
This looks good to me, testing it locally with another approach I used to have
@pmcarlos Would you be able to share your current method? This PR is to be merged eventually but there's someone in Graphene Discord asking if there's another way to disable introspection. |
|
Hi guys, any idea when this PR will be merged ? |
This would be part of the |
Hello @kiendang not at all. |
@firaskafri Awesome. Thanks! We're good to go for |
|
Hi @kiendang any example on how to implement both rules ? I tried to follow the graphene documentation: But I get an error |
|
@lee-pai-long hmm that's weird. It comes with Graphene. We have a test for it in this repo and it works fine. You can try taking a look at your installed packages? Alternatively the introspection disabling rule is also implemented in from graphql.validation.rules.custom.no_schema_introspection import NoSchemaIntrospectionCustomRule
|
|
Hi @kiendang thanks for you help, actually my error was that I didn't have the right version of |
* Add support for validation rules * Enable customizing validate max_errors through settings * Add tests for validation rules * Add examples for validation rules * Allow setting validation_rules in class def * Add tests for validation_rules inherited from parent class * Make tests for validation rules stricter
Close #1472
Close #1342