mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-25 22:28:11 +08:00
Hooks for sentry integration (#1460)
* add sentry webpack plugin * allow override of webpack config * work around cheerio inability to parse jinga templates * webpack can not minify jinja templates * allow script injection to specify other attributes * allow script injection to specify other attributes * Adjustments to make plugin systems work * Add sourcemaps for javascript in prod webpack * Update .gitignore * Fix spelling errors Co-authored-by: Matt Weiden <538456+mweiden@users.noreply.github.com>
This commit is contained in:
co-authored by
Matt Weiden
parent
9026e0ce41
commit
c1bf491a96
@@ -287,6 +287,17 @@ class AppConfig(object):
|
||||
elif not isinstance(v, str):
|
||||
raise ConfigurationError(f"CSP directive value must be a string or list of strings.")
|
||||
|
||||
# scripts can be string (filename) or dict (attributes). Convert string to dict.
|
||||
scripts = []
|
||||
for s in self.server__scripts:
|
||||
if isinstance(s, str):
|
||||
scripts.append({"src": s})
|
||||
elif isinstance(s, dict) and isinstance(s["src"], str):
|
||||
scripts.append(s)
|
||||
else:
|
||||
raise ConfigurationError("Scripts must be string or dict")
|
||||
self.server__scripts = scripts
|
||||
|
||||
def handle_data_locator(self, context):
|
||||
self.__check_attr("data_locator__s3__region_name", (type(None), bool, str))
|
||||
if self.data_locator__s3__region_name is True:
|
||||
|
||||
@@ -8,8 +8,13 @@ server:
|
||||
debug: false
|
||||
host: "127.0.0.1"
|
||||
port : null
|
||||
scripts : []
|
||||
|
||||
# Scripts can be a list of either file names (string) or dicts containing keys src, integrity and crossorigin.
|
||||
# these will be injected into the index template as script tags with these attributes set.
|
||||
scripts: []
|
||||
# Inline scripts are a list of file names, where the contents of the file will be injected into the index.
|
||||
inline_scripts: []
|
||||
|
||||
open_browser: false
|
||||
about_legal_tos: null
|
||||
about_legal_privacy: null
|
||||
|
||||
+3
-1
@@ -28,7 +28,7 @@ build: clean
|
||||
if [ -f customize/requirements.txt ] ; then \
|
||||
pip install requirements-parser ; \
|
||||
pip install packaging ; \
|
||||
python check_requirements.py ../requirements.txt customize/requirements.txt; \
|
||||
python3 check_requirements.py ../requirements.txt customize/requirements.txt; \
|
||||
cp customize/requirements.txt artifact.dir; \
|
||||
fi ; \
|
||||
if [ -d customize/deploy ] ; then \
|
||||
@@ -36,6 +36,7 @@ build: clean
|
||||
fi; \
|
||||
if [ -d customize/inline_scripts ] ; then \
|
||||
cp -r customize/inline_scripts/* artifact.dir/server/common/web/templates; \
|
||||
find artifact.dir/server/common/web/templates/ -type f -exec sed -i$(if $(IS_DARWIN), '',) 's/__CELLXGENE_COMMIT__/$(CELLXGENE_COMMIT)/g' {} \;; \
|
||||
fi; \
|
||||
if [ -d customize/ebextensions ] ; then \
|
||||
cp -r customize/ebextensions/* artifact.dir/.ebextensions; \
|
||||
@@ -43,6 +44,7 @@ build: clean
|
||||
fi; \
|
||||
if [ -d customize/plugins ] ; then \
|
||||
cp -r customize/plugins artifact.dir/server/; \
|
||||
find artifact.dir/server/plugins/ -type f -exec sed -i$(if $(IS_DARWIN), '',) 's/__CELLXGENE_COMMIT__/$(CELLXGENE_COMMIT)/g' {} \;; \
|
||||
fi; \
|
||||
(cd artifact.dir; \
|
||||
cp -r server/common/web/static static; \
|
||||
|
||||
@@ -60,6 +60,7 @@ class WSGIServer(Server):
|
||||
script_hashes, style_hashes = WSGIServer.get_csp_hashes(app, app_config)
|
||||
csp = {
|
||||
"default-src": ["'self'"],
|
||||
"connect-src": ["'self'"],
|
||||
"script-src": ["'self'", "'unsafe-eval'", "'unsafe-inline'"] + script_hashes,
|
||||
"style-src": ["'self'", "'unsafe-inline'"] + style_hashes,
|
||||
"img-src": ["'self'", "data:"],
|
||||
|
||||
Reference in New Issue
Block a user