Upgrade Spring Boot 2.0.2 → 2.7.18, add Spring Security, fix insecure HTTP URLs#10
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
Conversation
…e URLs - Upgrade spring-boot-starter-parent from 2.0.2.RELEASE to 2.7.18 - Fix packaging from 'pom' to 'jar' to enable compilation - Replace deprecated new Object[] JdbcTemplate query with varargs - Add spring-boot-starter-security dependency - Create SecurityConfig with public GET for / and /greeting, auth required elsewhere - Add application.properties with H2 console and datasource config - Change http:// to https:// for external API URLs in Application.java Co-Authored-By: marcel.schwager <marcel.schwager@codeium.com>
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:
|
…ttps URL - Both external quote service calls now use https:// - Wrapped in try-catch so the app starts even when the service is unavailable - The gturnquist-quoters.cfapps.io service is defunct; errors are logged as warnings Co-Authored-By: marcel.schwager <marcel.schwager@codeium.com>
Author
End-to-End Test ResultsRan app locally with Security Tests (primary change)
Spring Boot 2.7.18 Upgrade
HTTPS + try-catch fix
Note: |
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
Three changes in this PR:
Spring Boot upgrade (2.0.2.RELEASE → 2.7.18): Updated parent version in
pom.xml. Fixed<packaging>frompomtojar(the originalpompackaging caused Maven to skip Java compilation entirely). Replaced deprecatednew Object[]{"Josh"}parameter style inJdbcTemplate.query()with varargs.Spring Security: Added
spring-boot-starter-securitydependency and a newSecurityConfig.java. Unauthenticated GET access is allowed to/and/greeting; all other endpoints require HTTP Basic auth. CSRF is disabled (REST API pattern). No default credentials are committed — Spring Security will generate a random password at startup (printed to console). To set credentials, use env varsSPRING_SECURITY_USER_NAME/SPRING_SECURITY_USER_PASSWORD.HTTP → HTTPS: Changed both external API URLs in
Application.javafromhttp://tohttps://. Both calls are now wrapped in try-catch so the app starts cleanly even though the external service (gturnquist-quoters.cfapps.io) is defunct — failures are logged as warnings.Added
src/main/resources/application.propertieswith H2 console enabled and explicit datasource URL for Spring Boot 2.7.x compatibility.Updates since last revision
run(RestTemplate)that was missed in the first commitUnknownHostException→ app crash)Review & Testing Checklist for Human
GET /andGET /greeting. All other GETs (e.g.GET /topic,GET /topic/{id},GET /datetime) also require auth. If read-only topic endpoints should be public, theantMatchersneed to be expanded.SecurityConfigusesauthorizeRequests()/antMatchers()which are deprecated in Spring Security 5.7+ (shipped with Boot 2.7). These still work but the modern API isauthorizeHttpRequests()/requestMatchers(). Decide if this is acceptable.admin/changemeinapplication.propertiesbut these were omitted because the commit security scanner blocked them. Credentials must be provided via environment variables at runtime.pom→jar: This was necessary to make Maven actually compile the source code. Verify this doesn't conflict with any existing build/CI expectations.SPRING_SECURITY_USER_NAME=admin SPRING_SECURITY_USER_PASSWORD=changeme mvn spring-boot:run, then confirm:GET /→ 200 without credentialsPOST /topic→ 401 without credentialsPOST /topicwith Basic Auth (admin:changeme) → 200Notes
spring-boot-properties-migratordependency (already present) is kept to help surface any deprecated property warnings at runtime. It can be removed once migration is fully verified.gturnquist-quoters.cfapps.io) is offline. The try-catch wrappers log warnings but allow the app to start and serve requests normally.Link to Devin session: https://app.devin.ai/sessions/9e07a75f2ea24062b512e60aca5b050f
Requested by: @marcelschwager-ux