Repository navigation
bug: upgrade UserFront to Spring Boot 2.7.18 to clear spring-security-core CVE-2021-22112 - #474
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Author
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
Author
|
Ran the app in a browser on Boot 2.7.18 (JDK 17) against a real MySQL 5.7 database.
Not covered: remember-me persistence, appointment confirmation in the AdminPortal, running on a Java 8 JVM, and a Snyk rescan (Snyk's API is blocked from this environment). |
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
Fixes code-scan finding
sfind-88c741b8(SNYK-JAVA-ORGSPRINGFRAMEWORKSECURITY-1078232 / CVE-2021-22112, privilege escalation viaSecurityContextnot re-saved).UserFrontgotspring-security-core4.2.3.RELEASE throughspring-boot-starter-security1.5.4. The vulnerable range is everything below 5.2.9, so a 4.2.x patch pin can't fix it. Spring Security 5.x needs Spring 5 and Boot 2.This is a major bump (Boot 1.5.4 -> 2.7.18, Spring Security 4.2.3 -> 5.7.11).
java.versionstays at 1.8.Why 2.7.18 and not Snyk's minimum path (Boot 2.3.9 -> Security 5.3.8): 2.3.x is EOL, and its starters/BOM aren't available in this build environment, so it couldn't be built or verified. 2.7.18 is the last OSS Boot 2.x release that still supports Java 8, and it builds and runs end to end here. If you'd rather have the smaller 2.3.9 bump, it's a one-line parent change on top of this PR.
Code changes Boot 2 requires:
SecurityConfig:@Autowired configureGlobal(AuthenticationManagerBuilder)becomes@Override configure(AuthenticationManagerBuilder).AppointmentServiceImpl.findAppointment:findOne(id)becomesfindById(id).orElse(null)(Spring Data 2.x API).application.properties:spring.main.allow-circular-references=true: the existingUserServiceImpl<->AccountServiceImplcycle is rejected by Boot 2.6+.spring.jpa.hibernate.use-new-id-generator-mappings=false: keeps the Boot 1.5GenerationType.AUTO-> MySQLAUTO_INCREMENTbehaviour instead of a newhibernate_sequencetable, so existing schemas keep working.UserFrontApplicationTests: JUnit 4SpringRunner-> JUnit 5 (Boot 2.7's starter-test is Jupiter-only).Overlap: open PRs #227 / #184 / #281 make the same Boot 2.7.18 move for other spring-security CVEs. Only one of them should land. This PR differs by not pinning
spring-security.version(5.7.11 already clears this CVE) and by adding the id-generator setting.Verification
mvn -o -DskipTests package(JDK 17,--release 8target): BUILD SUCCESS.mastercan't be built in this environment because the 1.5.4 parent isn't in the local Maven cache.dependency:tree -Dincludes=org.springframework.security:spring-security-{config,core,web}:5.7.11.UserFrontApplicationTests.contextLoadsagainst MySQL 5.7: 1 found / 1 successful / 0 failed. It was run with the JUnit Platform launcher 1.9.3, because the surefire junit-platform provider isn't cached offline.rolerows seeded) and tested with curl. Every check behaved as expected:/userFront-> 302/index.POST /signup-> 302./index?error. Correct password ->/userFront(200).POST /account/depositof 150 -> balance 150.00 and aprimary_transactionrow./logout->/index?logout, after which/userFrontredirects to login again.AUTO_INCREMENTids, and the log has no errors.snyk testfails here with SNYK-CLI-0000 because the network is restricted, so there is no rescan result. Counted by hand against the advisory's vulnerable range (spring-security-core < 5.2.9): before 1 (4.2.3.RELEASE), after 0 (5.7.11). Please confirm with the Snyk/code-scan rescan in CI.Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/27982402420f4e7487f724ecc88cab1e
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/27982402420f4e7487f724ecc88cab1e?variant=devin
Devin Review