Skip to content
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

Validate request fields in sql_json API #20873

Closed
3 tasks
EugeneTorap opened this issue Jul 26, 2022 · 0 comments · Fixed by #21003
Closed
3 tasks

Validate request fields in sql_json API #20873

EugeneTorap opened this issue Jul 26, 2022 · 0 comments · Fixed by #21003
Labels
#bug Bug report

Comments

@EugeneTorap
Copy link
Contributor

EugeneTorap commented Jul 26, 2022

We use postman/insomnia http client to call/test all superset API.
And we found that /superset/sql_json/ API don't have validation for required fields. For example if we don't provide sql field in JSON body of request we get such error: "message": "Failed to execute query '164' - 'None': 'NoneType' object has no attribute 'strip'" and then Query History record is created with sql column is null (db table - query)

How to reproduce the bug

  1. Call login API to auth
  2. Call /superset/sql_json/ API without sql field
  3. See response error
  4. See error for /api/v1/query/ API

Expected results

We have to validate required fields for /superset/sql_json/ API .

Actual results

There's no validation for /superset/sql_json/ API .
Columns sql has null value in db table - query.
/api/v1/query/ API is broken with error message is "error": "'NoneType' object has no attribute 'strip'"

Screenshots

image
image
image

Environment

(please complete the following information):

  • browser type and version:
  • superset version: superset version
  • python version: python --version
  • node.js version: node -v
  • any feature flags active:

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.
@michael-s-molina @kgabryje @codyml @zhaoyongjie @diegomedina248 @jinghua-qa @geido @AAfghahi @srinify

@EugeneTorap EugeneTorap added the #bug Bug report label Jul 26, 2022
@EugeneTorap EugeneTorap changed the title Validate request fields of sql_json API Validate request fields in sql_json API Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant