Security/vulnerability hardening#93
Merged
Merged
Conversation
… open redirect, JWT fail-fast
BeraJosh
approved these changes
Jun 25, 2026
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.
Security/vulnerability hardening
Fixes 8 security vulnerabilities identified in an internal audit. All changes include regression tests.
Critical
/enableAdminwas publicly accessible with no authentication. Any user could promote any account to admin with a single GET request. Removed frompermitAll(), added@PreAuthorize("hasAuthority('ADMIN')")at class level onUserController, enabled@EnableMethodSecurity.High
X-Forwarded-Forfirst, which is fully attacker-controlled. Replaced with a configurable strategy (gc.ip.filter.client-ip-source) that trusts only the correct header per deployment (nginx:X-Real-IP, AWS ALB: rightmostX-Forwarded-For, direct:REMOTE_ADDR).email,institution, roles) were interpolated directly into HTML and rendered unsanitized. Fixed withHtmlUtils.htmlEscape()on all user-supplied values.Medium
/authenticateendpoint only. Admin AJAX calls updated from GET to POST with CSRF token injection via$.ajaxSetup./u/deleteand/u/updatewere HTTP GET. Changed to POST; templates updated with CSRF token header./createApiUserwas a GET endpoint, leakingusernameandpasswordinto server logs and browser history. Changed to POST with JSON request body.Low
isSameOrigin()check; external URLs fall back to role-based default redirect.jwt.secret=javainuse(well-known tutorial default) removed from config.JWTUtilnow throwsIllegalStateExceptionat startup if the signing key is under 32 characters.Tests
19 regression tests, all passing. New test classes:
UserControllerXssTest,AuthControllerTest,CustomizeAuthenticationSuccessHandlerTest,UserControllerSecurityTest,GcIpFilterTest.