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: replace datamask with key from new key value api #17680

Merged
merged 32 commits into from
Dec 21, 2021

Conversation

pkdotson
Copy link
Member

@pkdotson pkdotson commented Dec 8, 2021

SUMMARY

This pr fixes the longurl problem in dashboard when a user has a lot of filters and shares the url with other users. The long copied url had the potential to break loading the dashboard. This pr uses the new keyvalue api for dashboard to replace the datamask content with secure hashed key.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before

Screen.Recording.2021-12-08.at.5.59.57.PM.mov

after

Screen.Recording.2021-12-08.at.6.14.05.PM.mov

TESTING INSTRUCTIONS

Go to a dashboard and create filters. Ensure that the nativefilters param has a hashed key when applying new filters and saving the dashboard url.

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

@pkdotson pkdotson added hold:testing! On hold for testing need:qa-review Requires QA review labels Dec 8, 2021
@pkdotson pkdotson marked this pull request as ready for review December 9, 2021 02:16
@pkdotson
Copy link
Member Author

/testenv up

@github-actions
Copy link
Contributor

@pkdotson Ephemeral environment spinning up at http://54.191.208.158:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@@ -88,7 +88,6 @@ export const useFilterUpdates = (
) => {
const filters = useFilters();
const dataMaskApplied = useNativeFiltersDataMask();

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 remove the unnecessary change?

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

Hey Philip. I have added some comments.If you have any questions, feel free ping me.

@zhaoyongjie
Copy link
Member

zhaoyongjie commented Dec 11, 2021

BTW:
I found a potential security issues when I review this PR. The user can create a cache store from the api/v1/dashboard/${dashId}/filter_state/${key}/ endpoint. This can constitute a memory attack.

We have to fix this issue in separate PR. @michael-s-molina @pkdotson

filter_put_method.mov

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.

A few quick comments. Great work and seems to work nicely, but it's missing one key feature that we discussed with @michael-s-molina that's needed: when a user enters a dashboard with the native filter key, it should initialize a new key-value pair based on the contents of the original one. This is to ensure a user can have multiple tabs open based on the same key; when opening the new tab, the key will change, which will ensure that the state of the original tab is not overwritten. This is mostly an edge case for regular users, but an important one for public dashboards, where circulating the key to others will lead to the original state being overwritten if another anonymous user changes the filters.

superset-frontend/src/constants.ts Outdated Show resolved Hide resolved
@rusackas
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@rusackas Ephemeral environment spinning up at http://52.33.231.170:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@rusackas
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@rusackas Ephemeral environment spinning up at http://35.86.151.100:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@pkdotson pkdotson requested review from rusackas and zhaoyongjie and removed request for zhaoyongjie December 20, 2021 22:37
Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

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

frontend code LGTM, but we have to polish the key-value backend codes in separate PR. When I input a random filter key, the server-side response 500.

image

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, thanks for the hard work here!

@pkdotson pkdotson merged commit cfd851a into apache:master Dec 21, 2021
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@michael-s-molina
Copy link
Member

frontend code LGTM, but we have to polish the key-value backend codes in separate PR. When I input a random filter key, the server-side response 500.

@zhaoyongjie This has been fixed in #17878

@michael-s-molina
Copy link
Member

Thank you for the hard work @pkdotson!

@rusackas rusackas deleted the frontend-dashboard-longurl-2 branch January 4, 2022 04:10
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
* afirst stage to ccheck to get initial datamask

* clean up code and update typescript

* remove consoles

* fix ts and update copy dashboard url

* use key when one doesn't exists

* lint clean up

* fix errors

* add suggested changes

* remove line

* add tests and add changes for copydashboard

* fix lint

* fix lint

* fix lint

* Update superset-frontend/src/dashboard/components/Header/index.jsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add timeout

* fix test

* fix test, add qs to cypress and add suggestions

* add suggestions

* fix lint

* more suggested changes for backwards comapat

* fix lint

* cleanup naming and add qs parse to tests

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* more changes and fix lint

* remove nativefiler param

* fix path

* remove con

* simplify logic

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
* afirst stage to ccheck to get initial datamask

* clean up code and update typescript

* remove consoles

* fix ts and update copy dashboard url

* use key when one doesn't exists

* lint clean up

* fix errors

* add suggested changes

* remove line

* add tests and add changes for copydashboard

* fix lint

* fix lint

* fix lint

* Update superset-frontend/src/dashboard/components/Header/index.jsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add timeout

* fix test

* fix test, add qs to cypress and add suggestions

* add suggestions

* fix lint

* more suggested changes for backwards comapat

* fix lint

* cleanup naming and add qs parse to tests

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* Update superset-frontend/src/dashboard/components/menu/ShareMenuItems/index.tsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* more changes and fix lint

* remove nativefiler param

* fix path

* remove con

* simplify logic

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 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 hold:testing! On hold for testing need:qa-review Requires QA review preset-io size/L 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants