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

Enforcing React 18 in Dash and allowing data: in CSP connect-src #687

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webviz_config/_theme_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, theme_name: str):

self._csp = {
"default-src": "'none'",
"connect-src": "'self'",
"connect-src": ["'self'", "data:"],
"style-src": ["'self'", "'unsafe-inline'"], # [1]
"script-src": ["'self'", "blob:", "'unsafe-eval'"], # [blob: 2] [eval: 3]
"img-src": ["'self'", "data:", "blob:"], # [4]
Expand Down
2 changes: 2 additions & 0 deletions webviz_config/templates/copy_data_template.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ theme = webviz_config.WebvizConfigTheme("{{ theme_name }}")
theme.from_json((Path(__file__).resolve().parent / "theme_settings.json").read_text())
theme.plotly_theme_layout_update({{ options.plotly_theme }})

dash._dash_renderer._set_react_version("18.3.1")

app = dash.Dash()
app.config.suppress_callback_exceptions = True

Expand Down
4 changes: 3 additions & 1 deletion webviz_config/templates/webviz_template.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ from pathlib import Path

from uuid import uuid4

from dash import html, dcc, Dash, Input, Output, callback, callback_context
from dash import html, dcc, Dash, Input, Output, callback, callback_context, _dash_renderer
import webviz_core_components as wcc
from flask_talisman import Talisman
import webviz_config
Expand All @@ -40,6 +40,8 @@ theme = webviz_config.WebvizConfigTheme("{{ theme_name }}")
theme.from_json((Path(__file__).resolve().parent / "theme_settings.json").read_text())
theme.plotly_theme_layout_update({{ options.plotly_theme }})

_dash_renderer._set_react_version("18.3.1")

app = Dash(
name=__name__,
external_stylesheets=theme.external_stylesheets,
Expand Down