Kpmp 6695 monitor ep#58
Conversation
WalkthroughThis PR adds a public monitoring endpoint at ChangesStatus Endpoint Authorization and Implementation
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/org/kpmp/filters/AuthorizationFilter.java (1)
84-89:⚠️ Potential issue | 🟠 Major | ⚡ Quick winShort-circuit whitelisted endpoints before user/session resolution.
Line 88 allows bypass, but Lines 85-87 still execute first. That can break
/v1/statusfor unauthenticated calls (or trigger avoidable auth work) before the whitelist is even checked.Suggested fix
- Cookie[] cookies = request.getCookies(); - ShibbolethUser user = shibUserService.getUser(request); - String shibId = user.getShibId(); - - if (hasExistingSession(shibId, cookies, request) || allowedEndpoints.contains(request.getRequestURI())) { + if (allowedEndpoints.contains(request.getRequestURI())) { + chain.doFilter(request, response); + return; + } + + Cookie[] cookies = request.getCookies(); + ShibbolethUser user = shibUserService.getUser(request); + String shibId = user.getShibId(); + + if (hasExistingSession(shibId, cookies, request)) { chain.doFilter(request, response); } else {
🧹 Nitpick comments (1)
src/main/java/org/kpmp/monitor/MonitorController.java (1)
27-27: 🏗️ Heavy liftAvoid full participant fetch on a monitoring endpoint.
Line 27 materializes all participants just to compute a count. For a frequently-polled status endpoint, this is an expensive path; prefer a dedicated count query (
countParticipants()-style) inSlideService.Suggested direction
- String status = "Status OK. " + slideService.getAllParticipants().size() + " participants found."; + long participantCount = slideService.countParticipants(); + String status = "Status OK. " + participantCount + " participants found.";
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d5d7d727-cb22-4c34-bb6a-30ce213b9dea
📒 Files selected for processing (3)
src/main/java/org/kpmp/filters/AuthorizationFilter.javasrc/main/java/org/kpmp/monitor/MonitorController.javasrc/main/resources/application.properties
Summary by CodeRabbit
/v1/status) that provides system health information and current participant count.