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

[feature flag] Enforce csrf protection on explore_json endpoint #7935

Merged

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented Jul 27, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

This PR is to resume the work in #7449. For some security concerns, we need to enforce CSRF protection on query request to explore_json endpoint.

So I want to add a new feature flag: ENABLE_EXPLORE_JSON_CSRF_PROTECTION. When ENABLE_EXPLORE_JSON_CSRF_PROTECTION is set to true, user cannot make GET request to explore_json.

The default value for this feature False (current behavior), explore_json accepts both GET and POST request.

TEST PLAN

send GET request to explore_json, you will get 405 Method Not Allowed exception.

REVIEWERS

@DiggidyDave @betodealmeida @john-bodley @mistercrunch

Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGMT

@graceguo-supercat graceguo-supercat force-pushed the gg-DisableGETOnQueryRequest branch 2 times, most recently from 8e33b5b to 45f11af Compare July 29, 2019 06:41
@codecov-io
Copy link

Codecov Report

Merging #7935 into master will increase coverage by <.01%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7935      +/-   ##
==========================================
+ Coverage   65.97%   65.97%   +<.01%     
==========================================
  Files         468      468              
  Lines       22297    22304       +7     
  Branches     2429     2429              
==========================================
+ Hits        14710    14715       +5     
- Misses       7466     7468       +2     
  Partials      121      121
Impacted Files Coverage Δ
superset/config.py 94.04% <ø> (ø) ⬆️
superset/views/core.py 71.22% <100%> (+0.06%) ⬆️
superset/views/base.py 70.93% <50%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 994ac04...45f11af. Read the comment docs.

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

one comment, otherwise lgtm

@@ -204,7 +204,8 @@
# will result in combined feature flags of { 'FOO': True, 'BAR': True, 'BAZ': True }
DEFAULT_FEATURE_FLAGS = {
# Experimental feature introducing a client (browser) cache
"CLIENT_CACHE": False
"CLIENT_CACHE": False,
"ENABLE_EXPLORE_JSON_CSRF_PROTECTION": False,
Copy link
Member

Choose a reason for hiding this comment

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

Let's add a comment explaining this flag too?

@graceguo-supercat
Copy link
Author

graceguo-supercat commented Jul 29, 2019

I added a section in http://superset.incubator.apache.org/installation.html for featured flags:
Screen Shot 2019-07-29 at 12 29 11 PM

@graceguo-supercat graceguo-supercat merged commit 06d547f into apache:master Jul 29, 2019
@graceguo-supercat graceguo-supercat deleted the gg-DisableGETOnQueryRequest branch September 21, 2019 08:09
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 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/S 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants