You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dpgaspar (via GitHub)" <gi...@apache.org> on 2023/07/13 12:30:33 UTC
[GitHub] [superset] dpgaspar opened a new pull request, #24686: fix: dataset safe URL for explore_url
dpgaspar opened a new pull request, #24686:
URL: https://github.com/apache/superset/pull/24686
### SUMMARY
Use a better approach to handle custom default URLs on Datasets. Previously we were validating the URL itself and checked if it belonged to the same request host but this approach is not fail proof.
This PR makes all `explore_url` on datasets be handled as relative URLs, relative URLs were already supported and used on this field, now we enforce it when `PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET`
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1277420873
##########
UPDATING.md:
##########
@@ -41,6 +41,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24686]https://github.com/apache/superset/pull/24686): All dataset's custom explore_url are handled as relative URLs on the frontend, behaviour controlled by PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET.
Review Comment:
All `explore_url` is handled as relative, so existing URLs like: `http://www.google.com` will result on the following link: `http://localhost:8088/tablemodelview/list/http://www.google.com`
Previously we were supporting both types, absolute URL and relative, internally when no value was provided we handled the default as relative (dataset link to explore)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on pull request #24686: fix: dataset safe URL for explore_url
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on PR #24686:
URL: https://github.com/apache/superset/pull/24686#issuecomment-1677342337
> @dpgaspar I was wondering whether there would be merit in adding some frontend tests given that it seems the explore URL logic is handled completely by the frontend.
yes, added frontend tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1262537364
##########
superset-frontend/src/pages/DatasetList/index.tsx:
##########
@@ -181,6 +186,11 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
setSSHTunnelPrivateKeyPasswordFields,
] = useState<string[]>([]);
+ const PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET = useSelector<
+ any,
+ DatasetListConfig
Review Comment:
Return type here should be `boolean` - `DatasetListConfig` makes typescript think that `PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET` is an object with a field `PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET` in it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1262583125
##########
superset-frontend/src/pages/DatasetList/index.tsx:
##########
@@ -181,6 +182,14 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
setSSHTunnelPrivateKeyPasswordFields,
] = useState<string[]>([]);
+ const PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET: boolean = useSelector<
Review Comment:
`: boolean` here is redundant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] michael-s-molina merged pull request #24686: fix: dataset safe URL for explore_url
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina merged PR #24686:
URL: https://github.com/apache/superset/pull/24686
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] eschutho commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1264219522
##########
UPDATING.md:
##########
@@ -41,6 +41,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24686]https://github.com/apache/superset/pull/24686): All dataset's custom explore_url are handled as relative URLs on the frontend, behaviour controlled by PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET.
Review Comment:
@dpgaspar since we were already validating that all explore_urls were of the same domain, what would possibly break with this change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] eschutho commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1302169968
##########
UPDATING.md:
##########
@@ -41,6 +41,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24686]https://github.com/apache/superset/pull/24686): All dataset's custom explore_url are handled as relative URLs on the frontend, behaviour controlled by PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET.
Review Comment:
Ok, perfect, then, I tagged it for 3.0.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] eschutho commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "eschutho (via GitHub)" <gi...@apache.org>.
eschutho commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1296568812
##########
UPDATING.md:
##########
@@ -41,6 +41,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24686]https://github.com/apache/superset/pull/24686): All dataset's custom explore_url are handled as relative URLs on the frontend, behaviour controlled by PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET.
Review Comment:
Is there any way that we can make this somewhat backwards compatible? Maybe a migration that trims off the scheme/domain/host and attempts to make the url into a relative one if it can? Like if .*/explore.* is in the string at least?
Otherwise, we may want to consider this PR for a major version bump. cc @michael-s-molina for thoughts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] dpgaspar commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "dpgaspar (via GitHub)" <gi...@apache.org>.
dpgaspar commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1297034122
##########
UPDATING.md:
##########
@@ -41,6 +41,7 @@ assists people when migrating to a new version.
### Breaking Changes
+- [24686]https://github.com/apache/superset/pull/24686): All dataset's custom explore_url are handled as relative URLs on the frontend, behaviour controlled by PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET.
Review Comment:
Yes, I do think this breaks backward compatibility, but users can still opt in for the old behaviour, that I think it's safer and more explicit/clearer then changing metadata with a db migration.
Ultimately I do question the utility of allowing users to set their own custom default URL for datasets.
@michael-s-molina is it possible to include this one on 3.0.0?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] john-bodley commented on pull request #24686: fix: dataset safe URL for explore_url
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley commented on PR #24686:
URL: https://github.com/apache/superset/pull/24686#issuecomment-1636121895
@dpgaspar I was wondering whether there would be merit in adding some frontend tests given that it seems the explore URL logic is handled completely by the frontend.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov[bot] commented on pull request #24686: fix: dataset safe URL for explore_url
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #24686:
URL: https://github.com/apache/superset/pull/24686#issuecomment-1634171829
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#24686](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (2e0a3f4) into [master](https://app.codecov.io/gh/apache/superset/commit/a156816064c47b9ad12f34571f44e02cfb72fe75?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (a156816) will **decrease** coverage by `10.81%`.
> The diff coverage is `n/a`.
> :exclamation: Current head 2e0a3f4 differs from pull request most recent head d9ae149. Consider uploading reports for the commit d9ae149 to get more accurate results
```diff
@@ Coverage Diff @@
## master #24686 +/- ##
===========================================
- Coverage 68.97% 58.17% -10.81%
===========================================
Files 1902 1902
Lines 74007 73983 -24
Branches 8186 8186
===========================================
- Hits 51047 43036 -8011
- Misses 20839 28826 +7987
Partials 2121 2121
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `?` | |
| postgres | `?` | |
| presto | `54.04% <ø> (+0.02%)` | :arrow_up: |
| python | `60.85% <ø> (-22.61%)` | :arrow_down: |
| sqlite | `?` | |
| unit | `54.83% <ø> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/pages/DatasetList/index.tsx](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3BhZ2VzL0RhdGFzZXRMaXN0L2luZGV4LnRzeA==) | `57.50% <ø> (-0.27%)` | :arrow_down: |
| [superset/config.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29uZmlnLnB5) | `91.62% <ø> (-0.56%)` | :arrow_down: |
| [superset/datasets/commands/exceptions.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvZXhjZXB0aW9ucy5weQ==) | `81.81% <ø> (-12.39%)` | :arrow_down: |
| [superset/datasets/commands/update.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGF0YXNldHMvY29tbWFuZHMvdXBkYXRlLnB5) | `26.82% <ø> (-67.29%)` | :arrow_down: |
| [superset/utils/urls.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdXRpbHMvdXJscy5weQ==) | `73.91% <ø> (-23.31%)` | :arrow_down: |
| [superset/views/base.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmlld3MvYmFzZS5weQ==) | `58.66% <ø> (-14.67%)` | :arrow_down: |
| [superset/views/datasource/views.py](https://app.codecov.io/gh/apache/superset/pull/24686?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS92aWV3cy5weQ==) | `54.54% <ø> (-39.06%)` | :arrow_down: |
... and [287 files with indirect coverage changes](https://app.codecov.io/gh/apache/superset/pull/24686/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] kgabryje commented on a diff in pull request #24686: fix: dataset safe URL for explore_url
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje commented on code in PR #24686:
URL: https://github.com/apache/superset/pull/24686#discussion_r1262540821
##########
superset-frontend/src/pages/DatasetList/index.tsx:
##########
@@ -181,6 +186,11 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
setSSHTunnelPrivateKeyPasswordFields,
] = useState<string[]>([]);
+ const PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET = useSelector<
+ any,
Review Comment:
Could we use a more strict typing here? Like `ViewState` from `src/views/types.ts` (you'd just need to add `PREVENT_UNSAFE_DEFAULT_URLS_ON_DATASET: boolean` to it)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org