Security: hash passwords, remove hardcoded GraphHopper key, validate auth input, guard /internal endpoints - #16
Open
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.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:
|
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 the critical findings of a security scan of
acme-mobility. Full findings list (including issues left unfixed) is in the session message.1. Passwords were stored and compared in plaintext (
AuthService). Now BCrypt-hashed via aPasswordEncoderbean, with an in-place upgrade path so existing rows keep working:authenticatealso encodes on the unknown-email path so response time doesn't reveal whether an email exists.2. Live GraphHopper API key was hardcoded in
fm-gateway/application.yml→key: ${GRAPHHOPPER_API_KEY:}, wired through docker-compose;GraphHopperClient.getRoutereturns an empty route (linear fallback) when unset instead of calling the API with an empty key. The leaked key03df4cc7-…is still in git history and must be rotated at GraphHopper.3.
/api/auth/**accepted arbitrary payloads.LoginRequest/RegisterRequestnow carry@NotBlank/@Email/@Size(min=8,max=72)and the controller methods use@Valid(spring-boot-starter-validationadded). Frontendregisterform validators were aligned (email format, 8–72 char password) plus a 400 error branch, so client and server agree.4. Session fixation. Login previously reused the pre-auth session id;
loginSuccessnow callsHttpServletRequest.changeSessionId()before storing the user. Session cookies gethttp-only/same-site: laxandsecure: ${SESSION_COOKIE_SECURE:false}.5.
/internal/station/events/**was unauthenticated while rental-service publishes port 8080 — any host could injectVEHICLE_RECHARGEDmessages into running BPMN processes. AddedInternalApiKeyFilterrequiringX-Internal-Api-Key(constant-time compare) for/internal/**, and stations-service now sends that header on its callback. Both readINTERNAL_API_KEY(set in.env, required by compose); when unset the guard stays open and logs a warning so a baremvn spring-boot:runstill works.6. Camunda actuator leak. Dropped
management.endpoints.configprops.show-values: alwaysfromacme-mobility/application.yaml, which exposed configured secret values through/actuator/configprops.7. Frontend dependencies.
npm audit fix(lockfile only): 46 → 32 advisories, all 3 criticals (tar,shell-quote,websocket-driver) and the@angular/core/@angular/commonhigh resolved.Verification
mvn test: rental-service 70/70 (incl. newAuthServiceTest,InternalApiKeyFilterTest), stations-service and fm-gateway green.ng buildOK;ng test45/47 — the 2 failures (ActiveRideComponent,rideCompletionGuard) reproduce identically onmain.Link to Devin session: https://app.devin.ai/sessions/474cf914ce04480cb7cf2c6d0e619e3f
Requested by: @NicolasCola7