Skip to content

[Snyk] Security upgrade keras from 2.6.0 to 3.12.3 - #13105

Open
sestinj wants to merge 1 commit into
mainfrom
snyk-fix-a695ecedd72d41d16e20c4d4855babdb
Open

[Snyk] Security upgrade keras from 2.6.0 to 3.12.3#13105
sestinj wants to merge 1 commit into
mainfrom
snyk-fix-a695ecedd72d41d16e20c4d4855babdb

Conversation

@sestinj

@sestinj sestinj commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

snyk-top-banner

Snyk has created this PR to fix 1 vulnerabilities in the pip dependencies of this project.

Snyk changed the following file(s):

  • manual-testing-sandbox/requirements.txt
⚠️ Warning
typer 0.3.2 has requirement click<7.2.0,>=7.1.1, but you have click 8.1.8.
thinc 8.0.17 requires preshed, which is not installed.
thinc 8.0.17 requires cymem, which is not installed.
thinc 8.0.17 requires murmurhash, which is not installed.
spacy 3.1.2 requires preshed, which is not installed.
spacy 3.1.2 requires cymem, which is not installed.
spacy 3.1.2 requires murmurhash, which is not installed.
qtconsole 5.4.4 requires pyzmq, which is not installed.
notebook 6.5.7 requires pyzmq, which is not installed.
jupyter-server 1.24.0 requires pyzmq, which is not installed.
jupyter-console 6.6.3 requires pyzmq, which is not installed.
jupyter-client 7.4.9 requires pyzmq, which is not installed.
ipykernel 6.16.2 requires pyzmq, which is not installed.
exceptiongroup 1.3.1 has requirement typing-extensions>=4.6.0; python_version < "3.13", but you have typing-extensions 3.10.0.2.

Breaking Change Risk

Merge Risk: High

Notice: This assessment is enhanced by AI.


Important

  • Check the changes in this PR to ensure they won't cause issues with your project.
  • Max score is 1000. Note that the real score may have changed since the PR was raised.
  • This PR was automatically created by Snyk using the credentials of a real user.
  • Some vulnerabilities couldn't be fully fixed and so Snyk will still find them when the project is tested again. This may be because the vulnerability existed within more than one direct dependency, but not all of the affected dependencies could be upgraded.

Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open fix PRs.

For more information:
🧐 View latest project report
📜 Customise PR templates
🛠 Adjust project settings
📚 Read about Snyk's upgrade logic


Learn how to fix vulnerabilities with free interactive lessons:

🦉 Deserialization of Untrusted Data

The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-KERAS-18592339
@sestinj

sestinj commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Merge Risk: High

The upgrade from Keras 2.6.0 to 3.12.3 is a major version jump involving a complete rewrite of the library. Keras 3 is a multi-backend framework that can run on top of TensorFlow, PyTorch, or JAX, which is a fundamental architectural shift from the TensorFlow-specific tf.keras in version 2. This upgrade requires significant code and dependency changes.

Key Breaking Changes:

  • Multi-Backend Architecture: Keras is no longer tied to TensorFlow. You must choose and configure a backend (TensorFlow, JAX, or PyTorch) before importing the library. While this offers flexibility, code using TensorFlow-specific APIs (e.g., tf.Variable, tf.GradientTape) will need to be updated to use backend-agnostic alternatives like keras.ops and keras.Variable to be portable.
  • Import Path Changes: All imports must be updated. For example, from tensorflow.keras import layers must be changed to from keras import layers.
  • Default JIT Compilation: The jit_compile argument in the Model constructor is now True by default on GPUs. This can improve performance but may cause XLA-related errors with custom code or unsupported TensorFlow operations, requiring you to explicitly set jit_compile=False.
  • Variable Tracking: Setting a tf.Variable as a layer attribute will no longer be automatically tracked. You must use self.add_weight() or keras.Variable instead.
  • Model Serialization: The .keras format has been updated. While backward compatibility is intended, you should ensure models are saved in the latest v3 format. Version 3.12.3 includes important security hardening for model loading.

Recommendation:

This is a high-risk upgrade that requires a careful migration. Do not merge without thorough testing.

  1. Update Imports: Change all tensorflow.keras imports to keras.
  2. Configure Backend: Set your desired backend (e.g., os.environ["KERAS_BACKEND"] = "tensorflow") before importing Keras.
  3. Refactor Custom Code: Review all custom layers, models, and training loops. Replace TensorFlow-specific API calls with their keras.ops equivalents to ensure compatibility.
  4. Test Thoroughly: Pay close attention to model performance, saved model loading, and potential XLA-related errors if using GPUs.

Notice 🤖: This content was augmented using artificial intelligence. AI-generated content may contain errors and should be reviewed for accuracy before use.

@sestinj
sestinj requested a review from a team as a code owner August 9, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants