Skip to content

CH-226 CH-229 security updates#822

Merged
filippomc merged 26 commits intodevelopfrom
feature/CH-226
Nov 21, 2025
Merged

CH-226 CH-229 security updates#822
filippomc merged 26 commits intodevelopfrom
feature/CH-226

Conversation

@filippomc
Copy link
Copy Markdown
Collaborator

@filippomc filippomc commented Oct 23, 2025

Closes CH-226
Closes CH-229
Also fixes unrelated Closes CH-207

Some of the changes included in this PR are low impact breaking changes:

  • changed sentry sid source (at works, sentry won't work)
  • regenerating the codefresh pipelines is recommended

Implemented solution

CH-226 Applications and template based on Connexion (python/flask serve openapi generator) are now supporting Connexion 3+
CH-229 base images have all been updated; minimal debian trixie is now used as a base
CH-207 base image names changed to better scope vulnerabilities in applications vs cloud harness

  • removed sentry sid handling in the common microservice in order to remove the unnecessary dependency on the microservice itself

How to test this PR

https://samples.test-ch.dev.metacell.us/ https://workflows.test-ch.dev.metacell.us/ https://common.test-ch.dev.metacell.us/ are deployed with the test pipeline. Might also be useful to test a new generated application.
...

Sanity checks:

  • The pull request is explicitly linked to the relevant issue(s)
  • The issue is well described: clearly states the problem and the general proposed solution(s)
  • In this PR it is explicitly stated how to test the current change
  • The labels in the issue set the scope and the type of issue (bug, feature, etc.)
  • The relevant components are indicated in the issue (if any)
  • All the automated test checks are passing
  • All the linked issues are included in one Sprint
  • All the linked issues are in the Review state
  • All the linked issues are assigned

Breaking changes (select one):

  • The present changes do not change the preexisting api in any way
  • This PR and the issue are tagged as a breaking-change and the migration procedure is well described above

Possible deployment updates issues (select one):

  • There is no reason why deployments based on CloudHarness may break after the current update
  • This PR and the issue are tagged as alert:deployment

Test coverage (select one):

  • Tests for the relevant cases are included in this pr
  • The changes included in this pr are out of the current test coverage scope

Documentation (select one):

  • The documentation has been updated to match the current changes
  • The changes included in this PR are out of the current documentation scope

Nice to have (if relevant):

  • Screenshots of the changes
  • Explanatory video/animated gif

@filippomc filippomc marked this pull request as draft October 23, 2025 13:52
@filippomc filippomc requested a review from Copilot October 23, 2025 13:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades Connexion from version 2.14.2 to version 3.x across the CloudHarness framework and its applications, addressing compatibility issues with the newer API framework version.

Key changes:

  • Migrates from Connexion 2.x to 3.x with corresponding Flask compatibility updates
  • Replaces Flask-CORS with custom CORS handling compatible with Connexion 3.x
  • Updates error handling to work with Connexion 3.x's new exception handling paradigm

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
libraries/cloudharness-common/cloudharness/utils/server.py Core server initialization logic updated for Connexion 3.x compatibility, including JSON encoder changes, CORS setup, and error handling refactoring
infrastructure/common-images/cloudharness-flask/requirements.txt Updated dependency versions for Connexion 3.x, Flask 2.x+, and added uvicorn
infrastructure/cluster-configuration/storageclass.yaml Fixed Kubernetes StorageClass field name from deprecated volumeProvisioner to provisioner
infrastructure/cluster-configuration/storageclass-dockerdesktop.yaml Added new StorageClass configuration for Docker Desktop environments
deployment/codefresh-test.yaml Reorganized CI/CD build steps and updated build order for application images
deployment-configuration/helm/templates/ingress.yaml Added support for whitelisted URI mappings in secured applications and proxy buffering configuration
applications/*/requirements.txt Updated Connexion and related dependencies to version 3.x across all applications
applications/samples/tasks/sum/Dockerfile Changed base image from CLOUDHARNESS_BASE to SAMPLES
applications/samples/backend/samples/controllers/test_controller.py Removed environment variable validation logic from ping endpoint
applications/common/server/common/main.py Removed Flask-CORS initialization as CORS is now handled centrally
application-templates/flask-server/backend/requirements.txt Updated template dependencies to Connexion 3.x

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

try:
import flask
request = flask.request if flask.has_request_context() else None
except:
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except: clause catches all exceptions including system-exiting exceptions. Use except Exception: to catch only standard exceptions.

Suggested change
except:
except Exception:

Copilot uses AI. Check for mistakes.
afonsobspinto

This comment was marked as off-topic.

@filippomc filippomc marked this pull request as ready for review November 19, 2025 15:58
@filippomc filippomc requested a review from alxbrd November 19, 2025 15:59
@filippomc filippomc changed the title CH-226 connexion apps upgrade CH-226 CH-229 security updates Nov 19, 2025
@filippomc filippomc added the alert:deployment Something may break in the scope of this issue/pr in existing deployments label Nov 19, 2025
@@ -1,4 +1,4 @@
FROM quay.io/keycloak/keycloak:26.3.5
FROM quay.io/keycloak/keycloak:26.4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This automatically updates to the latest minor version. It could lead to having different versions across envs for the same app.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be no harm to use the latest patch update for keycloak, they respect semver quite well and release quite often

python_dateutil >= 2.9.0
setuptools >= 21.0.0

gunicorn
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fix a specific version?

swagger-ui-bundle>=1.1.0
python_dateutil>=2.9.0
setuptools>=21.0.0
uvicorn
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fix a specific version?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used to do pip freeze but now I prefer not to fix specific versions on cloud harness because getting security updates requires a lot of work in pinning every single requirement and we end up with outdated libraries. The risk of this simple microservice breaking is pretty low and we are now monitoring vulnerabilities that should catch bad guys coming in

@@ -1,3 +1,3 @@
FROM node:20
FROM node:22-alpine
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency should we use 22-trixie-slim?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just for building, and alpine has less reported vulnerabilities than trixie (easily 0)

Pillow>=9.2.0
python-keycloak
django-prometheus
uvicorn No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix versions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaving that open for the common images so inheritors can pin versions as needed


# # keycloak kafka listener plugin
COPY plugins/metacell-admin-event-listener-module-1.0.0.jar /opt/keycloak/providers/
COPY plugins/* /opt/keycloak/providers/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would specifically list the plugins we want to install. Currently there is only one anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred this option so applications can add plugins without necessarily overriding the docker file

@filippomc filippomc merged commit 2509651 into develop Nov 21, 2025
6 of 7 checks passed
@filippomc filippomc deleted the feature/CH-226 branch November 21, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

alert:deployment Something may break in the scope of this issue/pr in existing deployments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants