Fix critical security vulnerabilities (XXE, outdated deps, info leak)#2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Fix critical security vulnerabilities (XXE, outdated deps, info leak)#2devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Fix XXE vulnerability in XmlBeanDefinitionReader by disabling external entity processing in DocumentBuilderFactory (CWE-611) - Upgrade outdated dependencies: JUnit 4.7->4.13.2, cglib-nodep 2.1_3->3.3.0, aspectjweaver 1.6.11->1.9.21 - Upgrade Java source/target from 1.6 to 1.8 (required for Java 17 compat) - Add maven-surefire-plugin 3.2.5 with --add-opens for Java 17 module access - Replace e.printStackTrace() with proper exception propagation in BeanDefinition.setBeanClassName() - Add input validation for null/empty class names in BeanDefinition - Fix resource leak: wrap InputStream close in try-finally block - Applied fixes to both src/ and src+/ copies of affected files Co-Authored-By: Scoldfield <[email protected]>
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
Security audit of the codebase identified several vulnerabilities. This PR fixes the critical and medium-severity issues:
Critical — XXE Vulnerability (CWE-611):
XmlBeanDefinitionReader.doLoadBeanDefinitions()created aDocumentBuilderFactorywithout disabling external entity processing. An attacker who controls the XML input could read arbitrary files, perform SSRF, or cause DoS. Fixed by disabling DOCTYPE declarations, external general/parameter entities, external DTD loading, XInclude, and entity reference expansion.Critical — Outdated Dependencies with Known CVEs:
4.7→4.13.2(CVE-2020-15250: temp directory info leak)2.1_3→3.3.0(severely outdated, no longer maintained at old version)1.6.11→1.9.21Medium — Information Leak via
e.printStackTrace():BeanDefinition.setBeanClassName()swallowedClassNotFoundExceptionand printed the stack trace to stderr, leaking internal paths. Replaced with proper exception propagation (IllegalStateException).Medium — Input Validation:
Added null/empty check for class names in
BeanDefinition.setBeanClassName().Medium — Resource Leak:
InputStreaminXmlBeanDefinitionReader.doLoadBeanDefinitions()was not closed if parsing threw an exception. Wrapped in try-finally.Build Compatibility:
--add-opensfor Java 17 module system compatibilityAll fixes applied to both
src/andsrc+/copies of affected files.Review & Testing Checklist for Human
XmlBeanDefinitionReader.doLoadBeanDefinitions()— confirmDocumentBuilderFactoryfeatures are set correctly before any parsing occursmvn clean testto confirm 9/10 tests pass (the 1 failure —testPostBeanProcessor— is a pre-existing bug:OutputServiceImpllacks thehelloWorldServicefield thattinyioc-postbeanprocessor.xmltries to inject)Notes
setAccessible(true)usage inAutowireCapableBeanFactoryis noted but not changed — it's inherent to how IoC property injection works via reflection.testPostBeanProcessorfailure is pre-existing and unrelated to this PR.Link to Devin session: https://app.devin.ai/sessions/975441d382b1410ea460df014f50e55f
Requested by: @scoldfield