mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: Change default SECRET_KEY, improve docs and banner warning (#17984)
* fix: Change default SECRET_KEY, improve docs and banner warning on default * lint * Update superset/initialization/__init__.py Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com> * add a secret migration procedure, update UPDATING * fix lint Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7fc6a2f36c
commit
412189fcb7
@@ -29,6 +29,7 @@ from flask_compress import Compress
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
from superset.connectors.connector_registry import ConnectorRegistry
|
||||
from superset.constants import CHANGE_ME_SECRET_KEY
|
||||
from superset.extensions import (
|
||||
_event_logger,
|
||||
APP_DIR,
|
||||
@@ -572,12 +573,27 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
|
||||
|
||||
self.init_views()
|
||||
|
||||
def check_secret_key(self) -> None:
|
||||
if self.config["SECRET_KEY"] == CHANGE_ME_SECRET_KEY:
|
||||
top_banner = 80 * "-" + "\n" + 36 * " " + "WARNING\n" + 80 * "-"
|
||||
bottom_banner = 80 * "-" + "\n" + 80 * "-"
|
||||
logger.warning(top_banner)
|
||||
logger.warning(
|
||||
"A Default SECRET_KEY was detected, please use superset_config.py "
|
||||
"to override it.\n"
|
||||
"Use a strong complex alphanumeric string and use a tool to help"
|
||||
" you generate \n"
|
||||
"a sufficiently random sequence, ex: openssl rand -base64 42"
|
||||
)
|
||||
logger.warning(bottom_banner)
|
||||
|
||||
def init_app(self) -> None:
|
||||
"""
|
||||
Main entry point which will delegate to other methods in
|
||||
order to fully init the app
|
||||
"""
|
||||
self.pre_init()
|
||||
self.check_secret_key()
|
||||
# Configuration of logging must be done first to apply the formatter properly
|
||||
self.configure_logging()
|
||||
# Configuration of feature_flags must be done first to allow init features
|
||||
|
||||
Reference in New Issue
Block a user