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

[security] Adding Flask-Talisman #7443

Merged
merged 1 commit into from
May 14, 2019

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented May 3, 2019

CATEGORY

Choose one

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

SUMMARY

As discussed in the Meetup on 2019-05-03 a security audit at Airbnb surfaced a few recommendations in terms of security header settings. Specifically they recommended:

  • Setting the secure flag on session cookies
  • Support HTTP Strict Transport Security (HSTS)

Reading through the Flask security documentation on security header they mention that the Flask-Talisman package can be used to manage various security headers.

It mentions that a subset of default configuration/options handles:

  • Sets X-Frame-Options to SAMEORIGIN to avoid clickjacking.
  • Sets Flask's session cookie to secure, so it will never be set if your application is somehow accessed via a non-secure connection.
  • strict_transport_security, default True, whether to send HSTS headers.

The first one was already enabled for Superset and the later two addresses the two security concerns mentioned above. Unless we have dedicated or knowledgable security personnel, using something like Flask-Talisman with a blanket type approach to best practices around security seems like a good approach.

Note it's not apparent whether each Superset installation would want to handle security differently and currently the package is configurable only via the Talisman class or Talisman.init_app(...) options. In the future if we require this to be more configurable we could expose some of these configurations in Superset's configuration or leverage the mutator, i.e.,

# superset/__init__.py

talisman = Talisman()
# superset_config.py

FLASK_APP_MUTATOR = mutator

def mutator(app):
    from superset import talisman 
   
    talisman.init_app(app, force_https=False)

TEST PLAN

CI.

REVIEWERS

to: @betodealmeida @DiggidyDave @dpgaspar @graceguo-supercat @michellethomas @mistercrunch

@codecov-io
Copy link

Codecov Report

Merging #7443 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7443      +/-   ##
==========================================
- Coverage   65.26%   65.26%   -0.01%     
==========================================
  Files         430      430              
  Lines       21078    21080       +2     
  Branches     2338     2338              
==========================================
+ Hits        13757    13758       +1     
- Misses       7205     7206       +1     
  Partials      116      116
Impacted Files Coverage Δ
superset/views/core.py 72.47% <ø> (-0.07%) ⬇️
superset/config.py 93.78% <100%> (ø) ⬆️
superset/__init__.py 74.62% <100%> (+0.38%) ⬆️

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 c8bb7e0...1e02846. Read the comment docs.

Copy link

@graceguo-supercat graceguo-supercat left a comment

Choose a reason for hiding this comment

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

LGTM

@graceguo-supercat
Copy link

ping @betodealmeida @DiggidyDave

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.

LGTM

@DiggidyDave
Copy link
Contributor

👍

@john-bodley john-bodley merged commit a4392c8 into apache:master May 14, 2019
@craig-rueda craig-rueda mentioned this pull request May 16, 2019
1 task
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 31, 2019
michellethomas pushed a commit that referenced this pull request Jun 1, 2019
@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
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 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.

5 participants