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

[talisman] Enforcing HTTP for status checks #8214

Merged

Conversation

john-bodley
Copy link
Member

CATEGORY

Choose one

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

SUMMARY

The /health and /ping checks probably should use HTTP when Flask-Talisman is enabled.

TEST PLAN

CI.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

to: @etr2460 @mistercrunch

if app.config["TALISMAN_ENABLED"]:
talisman_config = app.config.get("TALISMAN_CONFIG")
Talisman(app, **talisman_config)
talisman.init_app(app, **app.config["TALISMAN_CONFIG"])
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need to use get(...) here since the config key exists in config.py.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Also, this code would have broken before if there was no config anyway because we were doing ** on a None

Copy link
Member Author

Choose a reason for hiding this comment

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

@etr2460 correct.

@mistercrunch
Copy link
Member

@craig-rueda 👀

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.

a couple questions, otherwise lgtm

if app.config["TALISMAN_ENABLED"]:
talisman_config = app.config.get("TALISMAN_CONFIG")
Talisman(app, **talisman_config)
talisman.init_app(app, **app.config["TALISMAN_CONFIG"])
Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. Also, this code would have broken before if there was no config anyway because we were doing ** on a None

@@ -222,9 +222,11 @@ def is_feature_enabled(feature):
if conf.get("ENABLE_FLASK_COMPRESS"):
Compress(app)


talisman = Talisman()
Copy link
Member

Choose a reason for hiding this comment

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

is there a cost to always initializing this, even if the config var isn't set?

Copy link
Member Author

Choose a reason for hiding this comment

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

@etr2460 is virtually a no-op per here, i.e., here's the contents of __init__.py:

class Talisman:
    def __init__(self, app=None, **kwargs):
        if app is not None:
            self.init_app(app, **kwargs)

which we're instantiating via Talisman().

@@ -629,16 +630,19 @@ class DashboardAddView(DashboardModelView): # noqa
appbuilder.add_view_no_menu(DashboardAddView)


@talisman(force_https=False)
Copy link
Member

Choose a reason for hiding this comment

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

Assuming these are needed so that some internal health check passes with TLS being handled by a LB or reverse proxy... 👍

@john-bodley john-bodley merged commit 762edf4 into apache:master Sep 12, 2019
@john-bodley john-bodley deleted the john-bodley--talisman-http-check branch September 13, 2019 05:44
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Sep 13, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.35.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.35.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants