From f9f2c66734d7225e87510b861ba2770d3ee8687b Mon Sep 17 00:00:00 2001 From: Mike Cheng Date: Thu, 3 Sep 2020 13:04:55 -0700 Subject: [PATCH] Update Jupyter config to new Cloud Shell domain. --- containers/base/Dockerfile | 16 +++++----- containers/base/license.sh | 2 +- containers/base/third_party_licenses.csv | 37 ++++++++++++++---------- sources/web/datalab/config/settings.json | 2 +- sources/web/datalab/server.ts | 4 +++ 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/containers/base/Dockerfile b/containers/base/Dockerfile index f73de6578..83946a080 100644 --- a/containers/base/Dockerfile +++ b/containers/base/Dockerfile @@ -33,7 +33,8 @@ ENV PYTHON_3_ENV py3env SHELL ["/bin/bash", "-c"] # Setup OS and core packages -RUN echo "deb-src http://ftp.us.debian.org/debian testing main" >> /etc/apt/sources.list && \ +RUN echo "deb-src http://ftp.us.debian.org/debian stretch main" >> /etc/apt/sources.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EF0F382A1A7B6500 04EE7237B7D453EC && \ apt-get update -y && \ apt-get install -y -q debian-archive-keyring debian-keyring && \ apt-get update -y && \ @@ -94,7 +95,7 @@ RUN echo "deb-src http://ftp.us.debian.org/debian testing main" >> /etc/apt/sour plotly==1.12.5 \ psutil==4.3.0 \ pygments==2.1.3 \ - python-dateutil==2.5.0 \ + python-dateutil==2.8.1 \ python-snappy==0.5.1 \ pytz==2018.4 \ pyyaml==3.13 \ @@ -103,10 +104,10 @@ RUN echo "deb-src http://ftp.us.debian.org/debian testing main" >> /etc/apt/sour scikit-image==0.13.0 \ scikit-learn==0.19.1 \ scipy==1.0.0 \ - seaborn==0.7.0 \ + seaborn==0.9.0 \ six==1.11.0 \ statsmodels==0.8.0 \ - sympy==0.7.6.1 \ + sympy==1.1.1 \ tornado==4.5.1 \ widgetsnbextension==3.2.1 \ xgboost==0.6a2 && \ @@ -148,12 +149,13 @@ RUN echo "deb-src http://ftp.us.debian.org/debian testing main" >> /etc/apt/sour pandas-gbq==0.3.0 \ pandas==0.22.0 \ pandocfilters==1.4.2 \ + parso==0.7.0 \ pillow==5.0.0 \ pip==18.0 \ plotly==1.12.5 \ psutil==4.3.0 \ pygments==2.1.3 \ - python-dateutil==2.5.0 \ + python-dateutil==2.8.1 \ python-snappy==0.5.1 \ pytz==2018.4 \ pyzmq==17.1.0 \ @@ -161,10 +163,10 @@ RUN echo "deb-src http://ftp.us.debian.org/debian testing main" >> /etc/apt/sour scikit-image==0.13.0 \ scikit-learn==0.19.1 \ scipy==1.0.0 \ - seaborn==0.7.0 \ + seaborn==0.9.0 \ six==1.11.0 \ statsmodels==0.8.0 \ - sympy==0.7.6.1 \ + sympy==1.1.1 \ tornado==4.5.1 \ widgetsnbextension==3.2.1 \ xgboost==0.6a2 && \ diff --git a/containers/base/license.sh b/containers/base/license.sh index a02485013..2c6af3add 100755 --- a/containers/base/license.sh +++ b/containers/base/license.sh @@ -60,7 +60,7 @@ do if [[ " ${INSTALLED_PACKAGES[@]} " =~ " ${col1} " ]]; then wget -O $2/$col1.LICENSE $col2 if [[ "${col3}" == *GPL* ]]; then - pip install -t "$2/source/${col1}" ${col1} + pip download -d "$2/source/${col1}" ${col1} fi fi done < $1 diff --git a/containers/base/third_party_licenses.csv b/containers/base/third_party_licenses.csv index fd903efa2..647407142 100644 --- a/containers/base/third_party_licenses.csv +++ b/containers/base/third_party_licenses.csv @@ -7,11 +7,11 @@ python-editor,https://raw.githubusercontent.com/fmoo/python-editor/master/LICENS tzlocal,https://raw.githubusercontent.com/regebro/tzlocal/master/LICENSE.txt,MIT itsdangerous,https://raw.githubusercontent.com/pallets/itsdangerous/master/LICENSE.rst,3-Clause BSD Werkzeug,https://raw.githubusercontent.com/pallets/werkzeug/master/LICENSE.rst,3-Clause BSD -click,https://raw.githubusercontent.com/pallets/click/master/LICENSE,3-Clause BSD +click,https://raw.githubusercontent.com/pallets/click/master/LICENSE.rst,3-Clause BSD alembic,https://raw.githubusercontent.com/zzzeek/alembic/master/LICENSE,MIT sqlalchemy,https://raw.githubusercontent.com/zzzeek/sqlalchemy/master/LICENSE,MIT APScheduler,https://raw.githubusercontent.com/agronholm/apscheduler/master/LICENSE.txt,MIT -Flask,https://raw.githubusercontent.com/pallets/flask/master/LICENSE,3-Clause BSD +Flask,https://raw.githubusercontent.com/pallets/flask/master/LICENSE.rst,3-Clause BSD chainerui,https://raw.githubusercontent.com/chainer/chainerui/master/LICENSE,MIT chainercv,https://raw.githubusercontent.com/chainer/chainercv/master/LICENSE,MIT pyglet,https://raw.githubusercontent.com/adamlwgriffiths/Pyglet/master/LICENSE,3-Clause BSD @@ -40,7 +40,7 @@ pexpect,https://raw.githubusercontent.com/pexpect/pexpect/ab7d99a670794fc2b03654 setuptools,https://raw.githubusercontent.com/pypa/setuptools/master/LICENSE,MIT tornado,https://raw.githubusercontent.com/tornadoweb/tornado/stable/LICENSE,Apache Software License 2.0 traitlets,https://raw.githubusercontent.com/ipython/traitlets/master/COPYING.md,BSD -subprocess32,https://raw.githubusercontent.com/google/python-subprocess32/master/LICENSE,Python Software Foundation License +subprocess32,https://raw.githubusercontent.com/google/python-subprocess32/main/LICENSE,Python Software Foundation License jinja2,https://raw.githubusercontent.com/pallets/jinja/master/LICENSE,BSD html5lib,https://raw.githubusercontent.com/html5lib/html5lib-python/master/LICENSE,MIT opencv-python,https://raw.githubusercontent.com/skvark/opencv-python/master/LICENSE.txt,MIT @@ -87,14 +87,14 @@ funcsigs,https://raw.githubusercontent.com/aliles/funcsigs/master/LICENSE,Apache gapic-google-cloud-pubsub-v1,https://raw.githubusercontent.com/googleapis/api-client-staging/master/generated/python/gapic-google-cloud-pubsub-v1/LICENSE,Apache 2.0 google-apitools,https://raw.githubusercontent.com/google/apitools/master/LICENSE,Apache 2.0 google-auth-library-python-httplib2,https://raw.githubusercontent.com/GoogleCloudPlatform/google-auth-library-python-httplib2/master/LICENSE,Apache 2.0 -google-cloud-bigquery,https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-python/master/bigquery/LICENSE,Apache 2.0 -google-cloud-core,https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-python/master/core/LICENSE,Apache 2.0 -google-cloud-pubsub,https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-python/master/pubsub/LICENSE,Apache 2.0 +google-cloud-bigquery,https://raw.githubusercontent.com/googleapis/google-cloud-python/master/LICENSE,Apache 2.0 +google-cloud-core,https://raw.githubusercontent.com/googleapis/google-cloud-python/master/LICENSE,Apache 2.0 +google-cloud-pubsub,https://raw.githubusercontent.com/googleapis/google-cloud-python/master/LICENSE,Apache 2.0 google-gax,https://raw.githubusercontent.com/googleapis/gax-python/master/LICENSE,Apache 2.0 googleapis-common-protos,https://raw.githubusercontent.com/googleapis/api-common-protos/master/LICENSE,Apache 2.0 -googledatastore,https://raw.githubusercontent.com/GoogleCloudPlatform/google-cloud-datastore/master/LICENSE,Apache 2.0 +googledatastore,https://raw.githubusercontent.com/googleapis/google-cloud-python/master/LICENSE,Apache 2.0 hdfs,https://github.com/mtth/hdfs/blob/master/LICENSE,MIT -idna,https://raw.githubusercontent.com/kjd/idna/master/LICENSE.rst,BSD-like +idna,https://raw.githubusercontent.com/kjd/idna/master/LICENSE.md,BSD-like Markdown,https://raw.githubusercontent.com/Python-Markdown/markdown/master/LICENSE.md,BSD monotonic,https://raw.githubusercontent.com/atdt/monotonic/master/LICENSE,Apache 2.0 oauth2client,https://raw.githubusercontent.com/google/oauth2client/master/LICENSE,Apache 2.0 @@ -121,11 +121,11 @@ PyJWT,https://raw.githubusercontent.com/jpadilla/pyjwt/master/LICENSE,MIT requests-oauthlib,https://raw.githubusercontent.com/requests/requests-oauthlib/master/LICENSE,BSD retrying,https://raw.githubusercontent.com/rholder/retrying/master/LICENSE,Apache 2.0 websocket-client,https://raw.githubusercontent.com/websocket-client/websocket-client/master/LICENSE,LGPL -enum34,https://bitbucket.org/stoneleaf/enum34/raw/f24487b45cd041fc9406d67441d2186ac70772b7/enum/LICENSE,BSD +enum34,https://raw.githubusercontent.com/GoodRx/enum34/master/enum/LICENSE,BSD futures,https://raw.githubusercontent.com/agronholm/pythonfutures/master/LICENSE,PSF backports-abc,https://raw.githubusercontent.com/cython/backports_abc/master/LICENSE,PSF backports.shutil-get-terminal-size,https://raw.githubusercontent.com/chrippa/backports.shutil_get_terminal_size/master/LICENSE,MIT -configparser,https://bitbucket.org/ambv/configparser/raw/78998f2ded2e840376adc712337545014fa9b622/README.rst,MIT +configparser,https://raw.githubusercontent.com/jaraco/configparser/master/LICENSE,MIT crcmod,https://raw.githubusercontent.com/gsutil-mirrors/crcmod/master/LICENSE,MIT decorator,https://raw.githubusercontent.com/micheles/decorator/master/LICENSE.txt,2-Clause BSD entrypoints,https://raw.githubusercontent.com/takluyver/entrypoints/master/LICENSE,MIT @@ -134,10 +134,10 @@ functools32,https://raw.githubusercontent.com/michilu/python-functools32/master/ grpc-google-iam-v1,https://raw.githubusercontent.com/googleapis/googleapis/master/LICENSE,Apache 2.0 ipython-genutils,https://raw.githubusercontent.com/ipython/ipython_genutils/master/COPYING.md,BSD ipywidgets,https://raw.githubusercontent.com/jupyter-widgets/ipywidgets/master/LICENSE,3-Clause BSD -Jinja2,https://raw.githubusercontent.com/pallets/jinja/master/LICENSE,BSD +Jinja2,https://raw.githubusercontent.com/pallets/jinja/master/LICENSE.rst,BSD jsonschema,https://raw.githubusercontent.com/Julian/jsonschema/master/COPYING,MIT -jupyter,https://raw.githubusercontent.com/jupyter/notebook/master/COPYING.md,BSD -notebook,https://raw.githubusercontent.com/jupyter/notebook/master/COPYING.md,BSD +jupyter,https://raw.githubusercontent.com/jupyter/notebook/master/LICENSE,BSD +notebook,https://raw.githubusercontent.com/jupyter/notebook/master/LICENSE,BSD jupyter-client,https://raw.githubusercontent.com/jupyter/jupyter_client/master/COPYING.md,BSD jupyter-console,https://raw.githubusercontent.com/jupyter/jupyter_console/master/COPYING.md,BSD jupyter-core,https://raw.githubusercontent.com/jupyter/jupyter_core/master/COPYING.md,BSD @@ -160,7 +160,7 @@ simplegeneric,https://opensource.org/licenses/ZPL-2.0,ZPL 2.1 singledispatch,https://opensource.org/licenses/MIT,MIT tensorflow-model-analysis,https://github.com/tensorflow/model-analysis/blob/master/LICENSE,Apache 2.0 terminado,https://raw.githubusercontent.com/jupyter/terminado/master/LICENSE,BSD -wcwidth,https://raw.githubusercontent.com/jquast/wcwidth/master/LICENSE.txt,MIT +wcwidth,https://raw.githubusercontent.com/jquast/wcwidth/master/LICENSE,MIT widgetsnbextension,https://raw.githubusercontent.com/jupyter-widgets/ipywidgets/master/widgetsnbextension/LICENSE,BSD pandas,https://raw.githubusercontent.com/pandas-dev/pandas/master/LICENSE,3-Clause BSD scikit-learn,https://raw.githubusercontent.com/scikit-learn/scikit-learn/master/COPYING,BSD @@ -178,10 +178,10 @@ PySocks,https://raw.githubusercontent.com/Anorov/PySocks/master/LICENSE,BSD ruamel-yaml,https://bitbucket.org/ruamel/yaml/raw/1364db82e3ad5680351e8a96323fa74ef9e662da/LICENSE,MIT apache-airflow,https://raw.githubusercontent.com/apache/incubator-airflow/master/LICENSE,Apache 2.0 backports.functools-lru-cache,https://raw.githubusercontent.com/jaraco/backports.functools_lru_cache/master/LICENSE,MIT -backports.ssl-match-hostname,https://bitbucket.org/brandon/backports.ssl_match_hostname/raw/76440258eb5e2aaac7c6f3d0b0a5afdbe335a502/LICENSE.txt,PSF +backports.ssl-match-hostname,https://raw.githubusercontent.com/exoscale/pkg-backports.ssl-match-hostname/precise/debian/copyright,PSF beautifulsoup4,https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/download/head:/copying-20110228012957-7ptf6yxua0sj3vhn-1/LICENSE,MIT blinker,https://raw.githubusercontent.com/jek/blinker/master/LICENSE,MIT -bokeh,https://raw.githubusercontent.com/bokeh/bokeh/master/LICENSE.txt,3-Clause BSD +bokeh,https://raw.githubusercontent.com/bokeh/bokeh/main/LICENSE.txt,3-Clause BSD brewer2mpl,https://raw.githubusercontent.com/jiffyclub/palettable/master/license.txt,MIT bs4,https://bazaar.launchpad.net/~leonardr/beautifulsoup/bs4/download/head:/copying-20110228012957-7ptf6yxua0sj3vhn-1/LICENSE,MIT Click,https://raw.githubusercontent.com/pallets/click/master/LICENSE.rst,BSD @@ -252,3 +252,8 @@ zict,https://raw.githubusercontent.com/dask/zict/master/LICENSE.txt,BSD zope.deprecation,https://raw.githubusercontent.com/zopefoundation/zope.deprecation/master/LICENSE.txt,ZPL google-cloud-dataflow,https://raw.githubusercontent.com/apache/beam/master/LICENSE,Apache 2.0 soupsieve,https://raw.githubusercontent.com/facelessuser/soupsieve/master/LICENSE.md,MIT +gmpy2,https://raw.githubusercontent.com/aleaxit/gmpy/master/COPYING,LGPL +HeapDict,https://raw.githubusercontent.com/DanielStutzbach/heapdict/master/LICENSE,BSD +mpmath,https://raw.githubusercontent.com/fredrik-johansson/mpmath/master/LICENSE,BSD +natsort,https://raw.githubusercontent.com/SethMMorton/natsort/master/LICENSE,MIT +smmap,https://raw.githubusercontent.com/gitpython-developers/smmap/master/LICENSE,BSD diff --git a/sources/web/datalab/config/settings.json b/sources/web/datalab/config/settings.json index b12b56ad6..a1ce15367 100644 --- a/sources/web/datalab/config/settings.json +++ b/sources/web/datalab/config/settings.json @@ -19,7 +19,7 @@ "--no-browser", "--log-level=DEBUG", "--debug", - "--NotebookApp.allow_origin_pat=\".*-dot-devshell.appspot.com$\"", + "--NotebookApp.allow_origin_pat=\"(.*-dot-devshell[.]appspot[.]com$)|(.*[.]cloudshell[.]dev$)\"", "--NotebookApp.log_format=\"%(message)s\"", "--NotebookApp.token=", "--Session.key=b'\"\"'", diff --git a/sources/web/datalab/server.ts b/sources/web/datalab/server.ts index f527dc11c..644462d27 100644 --- a/sources/web/datalab/server.ts +++ b/sources/web/datalab/server.ts @@ -300,6 +300,10 @@ function stopVmHandler(request: http.ServerRequest, response: http.ServerRespons function requestIsCrossOrigin(request: http.ServerRequest) { if (request.headers.origin) { + // Explicitly whitelist Cloud Shell's domain for cross-origin requests. + if (url.parse(request.headers.origin).host.endsWith('.cloudshell.dev')) { + return false; + } return url.parse(request.headers.origin).host !== request.headers.host; } else if (request.headers.referer) { return url.parse(request.headers.referer).host !== request.headers.host;