fix(security): Patch Critical RCE in H2 Database — CVE-2021-42392 [COG-422]#16
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
fix(security): Patch Critical RCE in H2 Database — CVE-2021-42392 [COG-422]#16devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…G-422] - Pin com.h2database:h2 to 2.1.210 in pom.xml (was 1.4.200 via Spring Boot parent) - Fixes CVE-2021-42392 / SNYK-JAVA-COMH2DATABASE-2348247 (CVSS 9.8) - Disable H2 console as defense-in-depth - Configure H2 2.x LEGACY mode and DB_CLOSE_ON_EXIT for compatibility - Set hibernate.id.new_generator_mappings=false for GenerationType.AUTO - Add H2SecurityTest with version and console-disabled regression checks Co-Authored-By: patrick.bradley <patrick.bradley@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
com.h2database:h2from 1.4.200 to 2.1.210 to remediate CVE-2021-42392 (CVSS 9.8) — a Remote Code Execution vulnerability via JDBC URL manipulation (CWE-94: Code Injection).Vulnerability: An unauthenticated attacker could execute arbitrary Java code on the server by crafting malicious JDBC URLs. If the H2 console were exposed, this would be directly exploitable from the network.
Root cause: The application inherited H2 1.4.200 from Spring Boot 2.2.6.RELEASE parent POM, which contains the vulnerable code path.
Fix applied:
com.h2database:h2to version2.1.210inmonolith/pom.xml, overriding the Spring Boot managed versionspring.h2.console.enabled=false) as defense-in-depthMODE=LEGACY,DB_CLOSE_ON_EXIT=FALSE,hibernate.id.new_generator_mappings=false) to ensure seamless upgradeTests added:
h2Version_isAtLeast_2_1_210_CVE2021_42392— asserts runtime H2 version >= 2.1.210h2Console_isDisabled_CVE2021_42392— asserts H2 console is disabled in configAll 9 tests pass (7 existing integration tests + 2 new security regression tests).
Review & Testing Checklist for Human
com.h2database:h2:2.1.210appears in the resolved dependency tree (./mvnw dependency:tree | grep h2)cd monolith && ./mvnw clean test) and confirm 9/9 pass/h2-consolewhen running the app (./mvnw spring-boot:runthen visithttp://localhost:8080/h2-console)/bondsreturns US912828YK15, GET/counterpartiesreturns Acme Asset Management)/rfqsand confirm the saga still works end-to-endNotes
MODE=LEGACYsetting preserves H2 1.x SQL behavior (case-insensitive identifiers, etc.) so no application code changes were neededDB_CLOSE_ON_EXIT=FALSEsetting eliminates benign shutdown warnings from H2 2.xLink to Devin session: https://app.devin.ai/sessions/bc498da494ea494680373fa9416dcc25
Requested by: @patrickbradley-cog
Devin Review