Repository navigation
fix(security): remove unthrottled /session/clear login path (#2338) - #2368
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
#2338) The legacy clear endpoint re-authenticated submitted credentials without the login rate limiter, answered 200/500 as a password oracle, and saved a SecurityContext without rotating the session id. Nothing calls it, so remove the route, restrict the CSRF login exemption to exactly /rest/saiku/session and drop the permitAll rule for session sub-paths. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Semantic model diffSemantic model diffNo model changes and no broken references. saiku#1434 · reproduce locally with |
juanresendiz813
left a comment
There was a problem hiding this comment.
Removing the endpoint rather than patching it is the right fix; one compatibility break needs addressing before merge.
Blocking
-
blocking· Compatibility / blast radius ·saiku-core/saiku-web/src/main/java/org/saiku/web/security/csrf/SaikuCsrfRequestMatcher.java:51andsaiku-webapp/src/main/webapp/WEB-INF/applicationContext-saiku.xml:260(the/rest/saiku/session/**rule that followed is removed)
POST /rest/saiku/session/(trailing slash) loses both its CSRF exemption and itspermitAll. That exact spelling is the login used by the demo pages shipped in the WAR and the showcase:saiku-webapp/src/main/webapp/embed-demo/index.html:490saiku-webapp/src/main/webapp/aqvira-demo/index.html:574saiku-ui/static/showcase/index.html:420saiku-showcase/index.html:406
DemoPagesHardeningTest.java:95-97asserts the pages contain it, andsaiku-showcase/README.md:25/demo/foodmart-ops/README.md:31document it. On this head the request is refused (the pages ignore the response) and every live call after it returns 401. On base it returns 200 with a session.demo.saiku.bideploysdevelopment-green, so it'd show within minutes. CI is green only because nothing exercises the trailing-slash login.
Would accept either:- keep exactly that spelling working and nothing under it:
LOGIN_PATH = ^/rest/saiku/session/?$plus an exact<security:intercept-url pattern="/rest/saiku/session/" access="permitAll"/>(no/**); or - change the four pages to post to
/rest/saiku/session, refresh each page's CSPsha256-hash (the hardening test prints it), and update the test needle and the two READMEs.
Either way, pin the choice with a matcher test for
/rest/saiku/session/and one spec step or IT that posts to it.
Non-blocking
non-blocking· Tests ·acceptance/2338/spec.json:19-25sends a JSON body, so "red on base" is a 415 from content negotiation rather than the real oracle. A form-encoded step would show the actual base behaviour.non-blocking· Correctness ·ISessionService.clearSessionsis now unreachable over HTTP. Delete it or say why it stays (#2389 still edits it).praise· dropping thepermitAllsub-tree and addingsessionSubPathsAreNotCsrfExemptas a negative test.
🤖 Generated with Claude Code
juanresendiz813
left a comment
There was a problem hiding this comment.
Approving. The cleanup items are tracked in #2422. One known effect: POST /rest/saiku/session/ (trailing slash), which the shipped demo pages and showcase use to log in, loses its CSRF exemption and permitAll; #2439 tracks that so it's fixed promptly.
🤖 Generated with Claude Code
PR acceptance metricAcceptance rate: 85.9% — 428 merged / 498 decided PRs (2 still open, excluded from the denominator).
Generated by |
Summary
Removes
POST /rest/saiku/session/clear, an anonymous, unthrottled credential oracle and second login path.Root cause
SessionResource.clearSessioncalledSessionService.clearSessions->authenticate()with noLoginRateLimitercheck, answered 200 vs 500 (with the username echoed), and persisted an authenticatedSecurityContextinto the HttpSession withoutchangeSessionId()or theauthorisationPredicate. The route was CSRF-exempt andpermitAll. No caller exists in saiku-ui or elsewhere in the repo (grepped).Fix (issue's preferred option: remove)
SessionResource.clearSession.SaikuCsrfRequestMatcher.LOGIN_PATHnow matches exactly/rest/saiku/session./rest/saiku/session/**permitAll rule inapplicationContext-saiku.xmlso future sub-paths are not anonymous by default.ISessionService.clearSessionsis left in place (not reachable over HTTP); [security] Plaintext login password is cached in SessionService.sessionHolder for the life of the JVM and returned by getAllSessionObjects() #2341 touches it next.Overlap: #2339, #2341 and #2345 are separate PRs on the same login/session code, each based on development.
Test plan
acceptance/2338/spec.jsonadded as first commit (api spec: POST to /session/clear must be 403/404/405; base answers 415/500 from the resource)mvn -pl saiku-core/saiku-web -am test -Dtest=SessionResourceTest,SaikuCsrfRequestMatcherTest(red before the change, green after)Closes #2338
🤖 Generated with Claude Code