From 8f289a6abee184095b71718fb9144b767aab42ae Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 1 Feb 2023 14:03:26 +0000 Subject: [PATCH 01/11] chore(deps): update all dependencies (#538) --- background/app/requirements.txt | 2 +- background/function/requirements.txt | 2 +- bookshelf/requirements.txt | 6 +++--- sessions/requirements.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/background/app/requirements.txt b/background/app/requirements.txt index ebd90391..d869b7d5 100644 --- a/background/app/requirements.txt +++ b/background/app/requirements.txt @@ -1,3 +1,3 @@ -google-cloud-firestore==2.9.0 +google-cloud-firestore==2.9.1 google-cloud-pubsub==2.14.0 flask==2.2.2 diff --git a/background/function/requirements.txt b/background/function/requirements.txt index 44dffc3c..7bf21296 100644 --- a/background/function/requirements.txt +++ b/background/function/requirements.txt @@ -1,2 +1,2 @@ google-cloud-translate==3.10.1 -google-cloud-firestore==2.9.0 +google-cloud-firestore==2.9.1 diff --git a/bookshelf/requirements.txt b/bookshelf/requirements.txt index f1cbf765..45969811 100644 --- a/bookshelf/requirements.txt +++ b/bookshelf/requirements.txt @@ -1,7 +1,7 @@ Flask==2.2.2 -google-cloud-firestore==2.9.0 +google-cloud-firestore==2.9.1 google-cloud-storage==2.7.0 -google-cloud-error-reporting==1.8.0 -google-cloud-logging==3.4.0 +google-cloud-error-reporting==1.8.1 +google-cloud-logging==3.5.0 gunicorn==20.1.0 six==1.16.0 diff --git a/sessions/requirements.txt b/sessions/requirements.txt index 09ff17a0..69960348 100644 --- a/sessions/requirements.txt +++ b/sessions/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-firestore==2.9.0 +google-cloud-firestore==2.9.1 flask==2.2.2 From daca19a28d7cab97d833cd8974fd52e6d1688dcd Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Thu, 20 Apr 2023 01:56:27 +0200 Subject: [PATCH 02/11] chore(deps): update dependency cryptography to v39.0.1 [security] (#541) --- authenticating-users/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authenticating-users/requirements.txt b/authenticating-users/requirements.txt index 9725073e..fa01653a 100644 --- a/authenticating-users/requirements.txt +++ b/authenticating-users/requirements.txt @@ -1,6 +1,6 @@ # [START getting_started_requirements] Flask==2.2.2 -cryptography==39.0.0 +cryptography==39.0.1 python-jose[cryptography]==3.3.0 requests==2.28.2 # [END getting_started_requirements] From 787b743af675a6a7e05c0edddbe68fac93bbc97b Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 9 May 2023 08:17:48 +0200 Subject: [PATCH 03/11] chore(deps): update dependency flask to v2.2.5 [security] (#546) --- background/app/requirements.txt | 2 +- gce/requirements.txt | 2 +- sessions/requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/background/app/requirements.txt b/background/app/requirements.txt index d869b7d5..23419a2a 100644 --- a/background/app/requirements.txt +++ b/background/app/requirements.txt @@ -1,3 +1,3 @@ google-cloud-firestore==2.9.1 google-cloud-pubsub==2.14.0 -flask==2.2.2 +flask==2.2.5 diff --git a/gce/requirements.txt b/gce/requirements.txt index a39a519c..b655465f 100644 --- a/gce/requirements.txt +++ b/gce/requirements.txt @@ -1,3 +1,3 @@ -flask==2.2.2 +flask==2.2.5 honcho==1.1.0 gunicorn==20.1.0 diff --git a/sessions/requirements.txt b/sessions/requirements.txt index 69960348..6050da39 100644 --- a/sessions/requirements.txt +++ b/sessions/requirements.txt @@ -1,2 +1,2 @@ google-cloud-firestore==2.9.1 -flask==2.2.2 +flask==2.2.5 From b85542612dedca6e1d11b559863ed3fb9fb339a2 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Tue, 9 May 2023 08:32:02 +0200 Subject: [PATCH 04/11] chore(deps): update all dependencies (#540) * chore(deps): update all dependencies * Apply suggestions from code review --------- Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com> --- authenticating-users/requirements.txt | 6 +++--- background/app/requirements.txt | 4 ++-- background/function/requirements.txt | 4 ++-- bookshelf/requirements.txt | 8 ++++---- requirements.txt | 6 +++--- sessions/requirements.txt | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/authenticating-users/requirements.txt b/authenticating-users/requirements.txt index fa01653a..39aa1b4b 100644 --- a/authenticating-users/requirements.txt +++ b/authenticating-users/requirements.txt @@ -1,6 +1,6 @@ # [START getting_started_requirements] -Flask==2.2.2 -cryptography==39.0.1 +Flask==2.2.5 +cryptography==40.0.2 python-jose[cryptography]==3.3.0 -requests==2.28.2 +requests==2.30.0 # [END getting_started_requirements] diff --git a/background/app/requirements.txt b/background/app/requirements.txt index 23419a2a..7cfba806 100644 --- a/background/app/requirements.txt +++ b/background/app/requirements.txt @@ -1,3 +1,3 @@ -google-cloud-firestore==2.9.1 -google-cloud-pubsub==2.14.0 +google-cloud-firestore==2.11.1 +google-cloud-pubsub==2.16.1 flask==2.2.5 diff --git a/background/function/requirements.txt b/background/function/requirements.txt index 7bf21296..b8e6aaad 100644 --- a/background/function/requirements.txt +++ b/background/function/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-translate==3.10.1 -google-cloud-firestore==2.9.1 +google-cloud-translate==3.11.1 +google-cloud-firestore==2.11.1 diff --git a/bookshelf/requirements.txt b/bookshelf/requirements.txt index 45969811..27d3d4fe 100644 --- a/bookshelf/requirements.txt +++ b/bookshelf/requirements.txt @@ -1,7 +1,7 @@ -Flask==2.2.2 -google-cloud-firestore==2.9.1 -google-cloud-storage==2.7.0 -google-cloud-error-reporting==1.8.1 +Flask==2.2.5 +google-cloud-firestore==2.11.1 +google-cloud-storage==2.9.0 +google-cloud-error-reporting==1.9.1 google-cloud-logging==3.5.0 gunicorn==20.1.0 six==1.16.0 diff --git a/requirements.txt b/requirements.txt index 930cfb5d..c07ff6c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ flake8===5.0.4; python_version < '3.8' flake8==6.0.0; python_version >= '3.8' -pytest==7.2.1 -nox==2022.11.21 -requests==2.28.2 +pytest==7.3.1 +nox==2023.4.22 +requests==2.30.0 diff --git a/sessions/requirements.txt b/sessions/requirements.txt index 6050da39..e0e267b5 100644 --- a/sessions/requirements.txt +++ b/sessions/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-firestore==2.9.1 +google-cloud-firestore==2.11.1 flask==2.2.5 From ce883090665bf309925f8eb0038f268675169b3c Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 5 Jun 2023 13:13:57 +0200 Subject: [PATCH 05/11] chore(deps): update dependency requests to v2.31.0 [security] (#548) --- authenticating-users/requirements.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authenticating-users/requirements.txt b/authenticating-users/requirements.txt index 39aa1b4b..23a31c7d 100644 --- a/authenticating-users/requirements.txt +++ b/authenticating-users/requirements.txt @@ -2,5 +2,5 @@ Flask==2.2.5 cryptography==40.0.2 python-jose[cryptography]==3.3.0 -requests==2.30.0 +requests==2.31.0 # [END getting_started_requirements] diff --git a/requirements.txt b/requirements.txt index c07ff6c2..0fd66f54 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,4 @@ flake8===5.0.4; python_version < '3.8' flake8==6.0.0; python_version >= '3.8' pytest==7.3.1 nox==2023.4.22 -requests==2.30.0 +requests==2.31.0 From f23ce88ab840dcb80cc82c9619658ec936185bc6 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 5 Jun 2023 13:20:12 +0200 Subject: [PATCH 06/11] chore(deps): update dependency cryptography to v41 [security] (#549) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [cryptography](https://togithub.com/pyca/cryptography) ([changelog](https://cryptography.io/en/latest/changelog/)) | `==40.0.2` -> `==41.0.0` | [![age](https://badges.renovateapi.com/packages/pypi/cryptography/41.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/cryptography/41.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/cryptography/41.0.0/compatibility-slim/40.0.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/cryptography/41.0.0/confidence-slim/40.0.2)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [GHSA-5cpq-8wj7-hf2v](https://togithub.com/pyca/cryptography/security/advisories/GHSA-5cpq-8wj7-hf2v) pyca/cryptography's wheels include a statically linked copy of OpenSSL. The versions of OpenSSL included in cryptography 0.5-40.0.2 are vulnerable to a security issue. More details about the vulnerability itself can be found in https://www.openssl.org/news/secadv/20230530.txt. If you are building cryptography source ("sdist") then you are responsible for upgrading your copy of OpenSSL. Only users installing from wheels built by the cryptography project (i.e., those distributed on PyPI) need to update their cryptography versions. --- ### Release Notes
pyca/cryptography ### [`v41.0.0`](https://togithub.com/pyca/cryptography/compare/40.0.2...41.0.0) [Compare Source](https://togithub.com/pyca/cryptography/compare/40.0.2...41.0.0)
--- ### Configuration 📅 **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/GoogleCloudPlatform/getting-started-python). --- authenticating-users/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authenticating-users/requirements.txt b/authenticating-users/requirements.txt index 23a31c7d..aa163f59 100644 --- a/authenticating-users/requirements.txt +++ b/authenticating-users/requirements.txt @@ -1,6 +1,6 @@ # [START getting_started_requirements] Flask==2.2.5 -cryptography==40.0.2 +cryptography==41.0.0 python-jose[cryptography]==3.3.0 requests==2.31.0 # [END getting_started_requirements] From 8be59fc2addafd984309b68b71906c467ab1088e Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 17 Jul 2023 17:53:47 +0200 Subject: [PATCH 07/11] chore(deps): update dependency cryptography to v41.0.2 [security] (#550) --- authenticating-users/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authenticating-users/requirements.txt b/authenticating-users/requirements.txt index aa163f59..0d4a3c36 100644 --- a/authenticating-users/requirements.txt +++ b/authenticating-users/requirements.txt @@ -1,6 +1,6 @@ # [START getting_started_requirements] Flask==2.2.5 -cryptography==41.0.0 +cryptography==41.0.2 python-jose[cryptography]==3.3.0 requests==2.31.0 # [END getting_started_requirements] From 21d4d6bc33a457dc91af0199cffd6211f1fff5a2 Mon Sep 17 00:00:00 2001 From: Jennifer Davis Date: Thu, 22 Aug 2024 13:01:55 -0700 Subject: [PATCH 08/11] fix: update libraries and python for the base image (#570) * fix: update libraries and python for the base image * fix:update python to python3 * fix: removing the python installation and using what's already installed * fix: resolve error around the use of apt instead of apt-get --- .kokoro/docker/Dockerfile | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.kokoro/docker/Dockerfile b/.kokoro/docker/Dockerfile index 6b6c19f1..accdd0bf 100644 --- a/.kokoro/docker/Dockerfile +++ b/.kokoro/docker/Dockerfile @@ -15,8 +15,8 @@ FROM gcr.io/cloud-devrel-kokoro-resources/python-base:latest # Install libraries needed by third-party python packages that we depend on. -RUN apt update \ - && apt install -y \ +RUN apt-get update \ + && apt-get install -y \ graphviz \ libcurl4-openssl-dev \ libffi-dev \ @@ -30,32 +30,19 @@ RUN apt update \ libxml2-dev \ libxslt1-dev \ openssl \ - portaudio19-dev \ - python-pyaudio \ zlib1g-dev \ - && apt clean + && apt-get clean -###################### Install python 3.7.12 - -# Download python 3.7.12 -RUN wget https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tgz - -# Extract files -RUN tar -xvf Python-3.7.12.tgz - -# Install python 3.7.12 -RUN ./Python-3.7.12/configure --enable-optimizations -RUN make altinstall ###################### Check python version -RUN python --version -RUN which python +RUN python3 --version +RUN which python3 # Setup Cloud SDK -ENV CLOUD_SDK_VERSION 369.0.0 +ENV CLOUD_SDK_VERSION 489.0.0 # Use system python for cloud sdk. -ENV CLOUDSDK_PYTHON /usr/bin/python +ENV CLOUDSDK_PYTHON python3.12 RUN wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz RUN tar xzf google-cloud-sdk-$CLOUD_SDK_VERSION-linux-x86_64.tar.gz RUN /google-cloud-sdk/install.sh From d9da8db203f7729f5da28b57be66b69084955bde Mon Sep 17 00:00:00 2001 From: Jennifer Davis Date: Thu, 22 Aug 2024 14:23:10 -0700 Subject: [PATCH 09/11] fix: rev version of python for use noxfile.py (#571) --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 68fb5a37..8f5a921c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -55,7 +55,7 @@ def run_test(session, dir): success_codes=[0, 5]) -@nox.session(python="3.7") +@nox.session(python="3.12") @nox.parametrize('dir', DIRS) def run_tests(session, dir=None): """Run all tests for all directories (slow!)""" From d6097aa561c71d67c953bdeb724b4da372bd2cec Mon Sep 17 00:00:00 2001 From: bhandarivijay-png Date: Mon, 5 Jan 2026 18:43:17 +0000 Subject: [PATCH 10/11] chore: Migrate gsutil usage to gcloud storage (#584) --- optional-kubernetes-engine/Makefile | 4 ++-- optional-kubernetes-engine/README.md | 4 ++-- optional-kubernetes-engine/config.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/optional-kubernetes-engine/Makefile b/optional-kubernetes-engine/Makefile index f275ddf4..4c1cbf3e 100644 --- a/optional-kubernetes-engine/Makefile +++ b/optional-kubernetes-engine/Makefile @@ -12,8 +12,8 @@ create-cluster: .PHONY: create-bucket create-bucket: - gsutil mb gs://$(GCLOUD_PROJECT) - gsutil defacl set public-read gs://$(GCLOUD_PROJECT) + gcloud storage buckets create gs://$(GCLOUD_PROJECT) + gcloud storage buckets update gs://$(GCLOUD_PROJECT) --predefined-default-object-acl=public-read .PHONY: build build: diff --git a/optional-kubernetes-engine/README.md b/optional-kubernetes-engine/README.md index e3c17236..9acb98b4 100644 --- a/optional-kubernetes-engine/README.md +++ b/optional-kubernetes-engine/README.md @@ -36,8 +36,8 @@ Alternatively, you can use make: The bookshelf application uses [Google Cloud Storage](https://cloud.google.com/storage) to store image files. Create a bucket for your project: - gsutil mb gs:// - gsutil defacl set public-read gs:// + gcloud storage buckets create gs:// + gcloud storage buckets update gs:// --predefined-default-object-acl=public-read Alternatively, you can use make: diff --git a/optional-kubernetes-engine/config.py b/optional-kubernetes-engine/config.py index 0fd601ed..7da9b4cc 100644 --- a/optional-kubernetes-engine/config.py +++ b/optional-kubernetes-engine/config.py @@ -78,12 +78,12 @@ # Typically, you'll name your bucket the same as your project. To create a # bucket: # -# $ gsutil mb gs:// +# $ gcloud storage buckets create gs:// # # You also need to make sure that the default ACL is set to public-read, # otherwise users will not be able to see their upload images: # -# $ gsutil defacl set public-read gs:// +# $ gcloud storage buckets update --predefined-default-object-acl=public-read gs:// # # You can adjust the max content length and allow extensions settings to allow # larger or more varied file types if desired. From 08418ec52153b88a7148abca245ea29eb352f8df Mon Sep 17 00:00:00 2001 From: Jennifer Davis Date: Thu, 15 Jan 2026 13:06:12 -0800 Subject: [PATCH 11/11] fix: modernize background app (#572) * fix: modernize background app * fix: attempt to fix linting issues * fix: resolve server-side cross-site scripting * fix: resolve lint issue with import order. * chore: add temporary use of storage to check if auth is working correctly. * fix: moving the bucket_name to the right level of indentation. * tmp: adding an assert to use the bucket variable that should be removed. * fix: based on https://github.com/pallets/flask/pull/5223/files moving to the use of markupsafe for escape * fix: import order * fix: really fix the library order --- background/app/app.yaml | 2 +- background/app/main.py | 18 ++++++++---------- background/app/main_test.py | 7 +++++-- background/app/requirements.txt | 6 +++--- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/background/app/app.yaml b/background/app/app.yaml index fb63451a..02c0651c 100644 --- a/background/app/app.yaml +++ b/background/app/app.yaml @@ -13,5 +13,5 @@ # limitations under the License. # [START getting_started_background_config] -runtime: python37 +runtime: python312 # [END getting_started_background_config] diff --git a/background/app/main.py b/background/app/main.py index 5474d54c..fad93d46 100644 --- a/background/app/main.py +++ b/background/app/main.py @@ -21,8 +21,8 @@ import os from flask import Flask, redirect, render_template, request -from google.cloud import firestore -from google.cloud import pubsub +from google.cloud import firestore, pubsub +from markupsafe import escape app = Flask(__name__) @@ -61,15 +61,13 @@ def translate(): language (form field 'lang'), by sending a PubSub message to a topic. """ source_string = request.form.get("v", "") - to_language = request.form.get("lang", "") + to_language = escape(request.form.get("lang", "")) if source_string == "": - error_message = "Empty value" - return error_message, 400 + return "Invalid request, you must provide a value.", 400 if to_language not in ACCEPTABLE_LANGUAGES: - error_message = "Unsupported language: {}".format(to_language) - return error_message, 400 + return f"Unsupported language: {to_language}", 400 message = { "Original": source_string, @@ -78,11 +76,11 @@ def translate(): "OriginalLanguage": "", } - topic_name = "projects/{}/topics/{}".format( - os.getenv("GOOGLE_CLOUD_PROJECT"), "translate" + topic_name = ( + f"projects/{os.getenv('GOOGLE_CLOUD_PROJECT')}/topics/translate" ) publisher.publish( - topic=topic_name, data=json.dumps(message).encode("utf8") + topic=topic_name, data=json.dumps(message).encode("utf-8") ) return redirect("/") diff --git a/background/app/main_test.py b/background/app/main_test.py index f3bf28c2..41b529d3 100644 --- a/background/app/main_test.py +++ b/background/app/main_test.py @@ -16,8 +16,7 @@ import uuid import google.auth -from google.cloud import firestore -from google.cloud import pubsub +from google.cloud import firestore, pubsub, storage import main import pytest @@ -39,7 +38,10 @@ def clear_collection(collection): for doc in collection.stream(): doc.reference.delete() + bucket_name = 'system-test-bucket' client = firestore.Client() + storage_client = storage.Client() + bucket = storage_client.bucket(bucket_name) translations = client.collection("translations") clear_collection(translations) translations.add( @@ -51,6 +53,7 @@ def clear_collection(collection): }, document_id="test translation", ) + assert bucket in locals() yield client diff --git a/background/app/requirements.txt b/background/app/requirements.txt index 7cfba806..f70d16b7 100644 --- a/background/app/requirements.txt +++ b/background/app/requirements.txt @@ -1,3 +1,3 @@ -google-cloud-firestore==2.11.1 -google-cloud-pubsub==2.16.1 -flask==2.2.5 +google-cloud-firestore==2.18.0 +google-cloud-pubsub==2.23.0 +flask==3.0.3