-
Notifications
You must be signed in to change notification settings - Fork 2.8k
check input empty strings for metadata api (close #2302) #2300
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
Conversation
|
Beep boop! 🤖 Hey @ajeetdsouza, thanks for your PR! One of my human friends will review this PR and get back to you as soon as possible. 🕐 Stay awesome! 😎 |
|
Deploy preview for hasura-docs ready! Built with commit 7816d9d |
|
Review app for commit 32dc7e2 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit d25479a deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
|
Review app for commit 5eb4a54 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit 72a578b deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit 9b239c8 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit a8a9033 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit fa166e8 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit 875fe13 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
|
Review app for commit be236b3 deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
rakeshkky
left a comment
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.
server LGTM
|
Review app for commit 7816d9d deployed to Heroku: https://hge-ci-pull-2300.herokuapp.com |
shahidhk
left a comment
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.
LGTM
|
Review app https://hge-ci-pull-2300.herokuapp.com is deleted |
|
Beep boop! 🤖 Awesome work @ajeetdsouza! All of us at Hasura ❤️ what you did. Thanks again 🤗 |
Description
The current metadata API allows a user to pass empty strings for things like role names, collection names, query names, etc, which should never be empty. This PR adds checks for these cases - any API calls made with empty strings as values for these types will now fail with a comprehensive error message.
Affected components
Related Issues
close #2302
Solution and Design
NETextwraps regular text, and uses a smart constructormkNEText :: Text -> Maybe NETextthat fails when provided an empty value. The following type aliases and newtypes used to contain standardText, and have been changed to containNEText:RelNameTQueryNameTriggerNameRoleNameCollectionNameQueryNameRemoteSchemaNameSteps to test and verify
A new PyTest class (
TestNEText) has been added totest_v1_queries.py, which test empty text input failure for the following types using the API:RelNameTriggerNameRoleNameCollectionNameQueryNameRemoteSchemaNameLimitations, known bugs & workarounds
To the Reviewer (Server)
NETexthas been created for non-emptyTexttypes. A smart constructormkNEText :: Text -> Maybe NETexthas been created for this.Text, and now wrapNEText:RelName,RoleName,CollectionName,QueryName,RemoteSchemaNameText, and are now newtypes wrappingNEText:TriggerNameTextfrom newtypes:relNameToTxt,triggerNameToTxt,roleNameToTxtNETextconstants have been created:adminText,rootTextTestNETextclassCritical files
src-lib/Hasura/GraphQL/Resolve/Insert.hssrc-lib/Hasura/RQL/Types/Common.hssrc-lib/Hasura/RQL/Types/EventTrigger.hssrc-lib/Hasura/RQL/Types/Permission.hssrc-lib/Hasura/RQL/Types/QueryCollection.hssrc-lib/Hasura/RQL/Types/RemoteSchema.hssrc-lib/Hasura/Server/App.hssrc-lib/Hasura/Server/Auth/JWT.hssrc-lib/Hasura/Server/Init.hstests-py/test_v1_queries.py(TestNETextand the corresponding tests)