From fb3fccd311f5a0a3c6401e2d376dda024ef79cdc Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 21:50:29 -0800 Subject: [PATCH 01/10] fix(backend): Prevent double Base64 encoding of profile href --- husky_directory/models/search.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/husky_directory/models/search.py b/husky_directory/models/search.py index 854e221a..dc59e9ad 100644 --- a/husky_directory/models/search.py +++ b/husky_directory/models/search.py @@ -220,7 +220,25 @@ class Person(DirectoryBaseModel): @validator("href") def b64_encode_href(cls, value: str) -> str: - return base64.b64encode(value.encode("UTF-8")).decode("UTF-8") + """ + Base64 encode href only if not already encoded. + Prevents double-encoding after browser back navigation when href + from previous page state is already encoded. + """ + encoding = "UTF-8" + if not cls._is_base64_encoded(value, encoding): + return base64.b64encode(value.encode(encoding)).decode(encoding) + return value + + @staticmethod + def _is_base64_encoded(value: str, encoding: str = "UTF-8") -> bool: + """ + Check if a string is already base64 encoded. + """ + try: + return base64.b64decode(value.encode(encoding)).decode(encoding) is not None + except (ValueError, UnicodeDecodeError): + return False @validator("sort_key", always=True) def set_default_sort_key(cls, v: Optional[str], values: Dict): From 9277cb2bae79c4940203b4babe8297d3401a77ca Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:23:35 -0800 Subject: [PATCH 02/10] fix(ci): Update pull-request.yml --- .github/workflows/pull-request.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2a01aa18..2678c048 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,16 +21,16 @@ jobs: new-version: ${{ steps.update-version.outputs.new-version }} steps: - name: Python Poetry Action - uses: abatilo/actions-poetry@v2.1.6 + run: pipx install poetry - uses: uwit-iam/actions/require-semver-guidance-label@0.1 id: guidance with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ github.token }} - - uses: uwit-iam/actions/update-pr-branch-version@0.1.16 + - uses: uwit-iam/actions/update-pr-branch-version@0.1.20 with: - github-token: ${{ env.GITHUB_TOKEN }} + github-token: ${{ github.token }} version-guidance: ${{ steps.guidance.outputs.guidance }} id: update-version From 72eda8e1d7f5475cd0dab284fb85009c8e431f31 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 06:24:17 +0000 Subject: [PATCH 03/10] [Bot] Update version to 2.2.8 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4fba84ef..9a4ee93c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "uw-husky-directory" -version = "2.2.7" +version = "2.2.8" description = "An updated version of the UW Directory" authors = ["Thomas Thorogood "] license = "MIT" From 098a6499bed1fba59c0a91876dd15668b227826c Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:32:16 -0800 Subject: [PATCH 04/10] fix(ci): Update pull-request.yml > alidate-image-quality to use pipx --- .github/workflows/pull-request.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 2678c048..56ca6f9a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,7 +49,12 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} - - uses: abatilo/actions-poetry@v2.1.6 + # Install Poetry using pipx + - name: Install Poetry with pipx + run: | + pipx install poetry + poetry --version # Verify that Poetry was installed correctly + - run: | sudo apt-get -y install jq poetry run pip install tox uw-it-build-fingerprinter From deaec46a19eed5399a22450272f48a26a24f2ae9 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:36:35 -0800 Subject: [PATCH 05/10] fix(ci): Update pull-request.yml > alidate-image-quality to use Python 3.11 --- .github/workflows/pull-request.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 56ca6f9a..02b11ff0 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,7 +49,11 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} - # Install Poetry using pipx + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install Poetry with pipx run: | pipx install poetry From 1546abef1c4f1c96e11c8d0f2bc60d58c61577c4 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:38:53 -0800 Subject: [PATCH 06/10] fix(ci): Update pull-request.yml > validate-image-quality to use Python 3.10 --- .github/workflows/pull-request.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 02b11ff0..26453a81 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,19 +49,18 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} - - name: Set up Python 3.11 - uses: actions/setup-python@v4 - with: - python-version: '3.11' - - name: Install Poetry with pipx run: | pipx install poetry poetry --version # Verify that Poetry was installed correctly + - name: Configure Poetry environment with Python 3.10 + run: | + poetry env use python3.10 + - run: | sudo apt-get -y install jq - poetry run pip install tox uw-it-build-fingerprinter + poetry run pip install tox uw-it-build-fingerprinter # Install required Python dependencies id: configure name: Set up environment From 3af6067f8130653c71d83f9ee9195992c33ab743 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:41:48 -0800 Subject: [PATCH 07/10] fix(ci): Attempt to fix failing pull-request.yml --- .github/workflows/pull-request.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 26453a81..4c001b35 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -49,18 +49,20 @@ jobs: with: ref: ${{ github.event.pull_request.head.ref }} - - name: Install Poetry with pipx - run: | - pipx install poetry - poetry --version # Verify that Poetry was installed correctly + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' - - name: Configure Poetry environment with Python 3.10 + - name: Install Poetry with pip run: | - poetry env use python3.10 + python -m pip install --upgrade pip + python -m pip install poetry + poetry --version - run: | sudo apt-get -y install jq - poetry run pip install tox uw-it-build-fingerprinter # Install required Python dependencies + poetry run pip install tox uw-it-build-fingerprinter id: configure name: Set up environment From 03faff8511bd4230662c773e7e82452a3fc7d962 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Wed, 15 Jan 2025 22:46:27 -0800 Subject: [PATCH 08/10] fix(ci): Bump google auth dependencies on configure-docker/action.yml --- .github/actions/configure-docker/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/configure-docker/action.yml b/.github/actions/configure-docker/action.yml index 3569dc20..03d8386e 100644 --- a/.github/actions/configure-docker/action.yml +++ b/.github/actions/configure-docker/action.yml @@ -12,10 +12,10 @@ inputs: runs: using: composite steps: - - uses: google-github-actions/auth@v0 + - uses: google-github-actions/auth@v2 with: credentials_json: ${{ inputs.gcr-token }} - - uses: google-github-actions/setup-gcloud@v1.0.1 + - uses: google-github-actions/setup-gcloud@v2.1.0 # archiving leaving this "with" section, might b a handy reference at a later date. # It was there when the above "uses" was uses: google-github-actions/setup-gcloud@v0 From c07d54edc022b27ca8eacce63d3eb53dfea97fd4 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Thu, 16 Jan 2025 09:10:17 -0800 Subject: [PATCH 09/10] chore(ci): Revert back github token change --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 4c001b35..0d86060c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -26,11 +26,11 @@ jobs: - uses: uwit-iam/actions/require-semver-guidance-label@0.1 id: guidance with: - github-token: ${{ github.token }} + github-token: ${{ secrets.GITHUB_TOKEN }} - uses: uwit-iam/actions/update-pr-branch-version@0.1.20 with: - github-token: ${{ github.token }} + github-token: ${{ env.GITHUB_TOKEN }} version-guidance: ${{ steps.guidance.outputs.guidance }} id: update-version From 47217d09b9cbdfc577d7a3c47377da69dcb55c89 Mon Sep 17 00:00:00 2001 From: soufianerafik Date: Thu, 16 Jan 2025 09:17:44 -0800 Subject: [PATCH 10/10] chore(ci): Match the id: guidance step --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 0d86060c..620bf53c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -30,7 +30,7 @@ jobs: - uses: uwit-iam/actions/update-pr-branch-version@0.1.20 with: - github-token: ${{ env.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} version-guidance: ${{ steps.guidance.outputs.guidance }} id: update-version