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

fix: datasource save, improve data validation #22038

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Nov 4, 2022

SUMMARY

Improves data validation on datasource save, sanitise default endpoint on datasets

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #22038 (112f414) into master (5e1eecb) will increase coverage by 0.00%.
The diff coverage is 95.23%.

@@           Coverage Diff           @@
##           master   #22038   +/-   ##
=======================================
  Coverage   67.00%   67.01%           
=======================================
  Files        1815     1815           
  Lines       69523    69547   +24     
  Branches     7479     7479           
=======================================
+ Hits        46585    46608   +23     
- Misses      21008    21009    +1     
  Partials     1930     1930           
Flag Coverage Δ
hive 52.82% <28.57%> (-0.02%) ⬇️
mysql 78.40% <80.95%> (+<0.01%) ⬆️
postgres 78.46% <80.95%> (+<0.01%) ⬆️
presto 52.73% <28.57%> (-0.02%) ⬇️
python 81.56% <95.23%> (+0.01%) ⬆️
sqlite 76.92% <80.95%> (+<0.01%) ⬆️
unit 51.20% <80.95%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/config.py 91.84% <ø> (+0.07%) ⬆️
superset/utils/urls.py 97.22% <93.75%> (-2.78%) ⬇️
superset/views/datasource/views.py 91.26% <100.00%> (+0.28%) ⬆️
superset/views/core.py 75.92% <0.00%> (-0.04%) ⬇️
superset/views/base.py 75.70% <0.00%> (ø)
superset/connectors/base/models.py 87.04% <0.00%> (+0.30%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a few thoughts/comments

datasource_post["default_endpoint"] = "http://www.google.com"
data = dict(data=json.dumps(datasource_post))
resp = self.client.post("/datasource/save/", data=data)
assert resp.status_code == 500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really be expecting 500? This may just be me, but when I see 500, I immediately think "the system borked". Could 422 work better here?

Comment on lines 42 to 51
[
("http://localhost/", True),
("http://localhost/superset/1", True),
("localhost/superset/1", False),
("ftp://localhost/superset/1", False),
("http://external.com", False),
("external.com", False),
("///localhost", False),
("xpto://localhost:[3/1/", False),
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we also add an internal and external https:// here?

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v1.5 v2.0 v2.0.1 🍒 1.5.3 🍒 2.0.1 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants