-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Fix DoS via malicious HDF5 dataset metadata in KerasFileEditor #21880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @HyperPS, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical security vulnerability by enhancing the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses a critical Denial of Service vulnerability by introducing comprehensive validation for HDF5 dataset metadata before loading. The changes include checks for hostile shapes, dimension overflows, and excessive memory allocation, which successfully prevents 'shape bomb' attacks. Additionally, the refactoring of the _extract_weights_from_store method significantly improves code clarity and correctness, notably by fixing a bug in the recursive path handling. The overall implementation is robust and enhances the security of file loading operations.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21880 +/- ##
==========================================
- Coverage 82.57% 82.55% -0.02%
==========================================
Files 577 577
Lines 59599 59620 +21
Branches 9351 9355 +4
==========================================
+ Hits 49213 49220 +7
- Misses 7978 7987 +9
- Partials 2408 2413 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you for the PR!
Do you have references/links for these? |
|
Thanks @hertschuh ,The Huntr report is still private (I reported the issue there), so there’s no public link yet — maintainers can access it via the magic-link email from Huntr. I also submitted the same vulnerability to GHSA, which is currently in the private review queue, so there isn’t a public link for that yet either. |
This PR adds validation for extremely-large HDF5 dataset metadata to prevent
remote DoS via HDF5 shape bombs in .keras files. Includes:
Vuln (Reported on Huntr and GHSA)
• Defensive size validation
• Rejection of hostile shapes and dimension overflows
• Recursion path fix for correct inner_path handling
• Avoids unbounded numpy allocation of multi-gigabyte tensors
Backward compatible with valid Keras weight files.