Skip to content

fix(security): remove unthrottled /session/clear login path (#2338) - #2368

Merged
juanresendiz813 merged 2 commits into
developmentfrom
fix/2338-session-clear
Nov 19, 2026
Merged

juanresendiz813 merged 2 commits into
developmentfrom
fix/2338-session-clear

Conversation

@buggtb

@buggtb buggtb commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes POST /rest/saiku/session/clear, an anonymous, unthrottled credential oracle and second login path.

Root cause

SessionResource.clearSession called SessionService.clearSessions -> authenticate() with no LoginRateLimiter check, answered 200 vs 500 (with the username echoed), and persisted an authenticated SecurityContext into the HttpSession without changeSessionId() or the authorisationPredicate. The route was CSRF-exempt and permitAll. No caller exists in saiku-ui or elsewhere in the repo (grepped).

Fix (issue's preferred option: remove)

Overlap: #2339, #2341 and #2345 are separate PRs on the same login/session code, each based on development.

Test plan

  • acceptance/2338/spec.json added 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)
  • CI acceptance proof (red on base, green on head)

Closes #2338

🤖 Generated with Claude Code

buggtb and others added 2 commits November 12, 2026 17:02
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>
@buggtb buggtb added the security Created by Hive for agent-filed issue provenance label Nov 12, 2026
@github-actions github-actions Bot added risk/high Change risk tier: high (see docs/risk-tiers.md) area/web labels Nov 12, 2026
@github-actions

Copy link
Copy Markdown

Semantic model diff

Semantic model diff

No model changes and no broken references.

saiku#1434 · reproduce locally with saiku model diff

@juanresendiz813 juanresendiz813 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the endpoint rather than patching it is the right fix; one compatibility break needs addressing before merge.

Blocking

  1. blocking · Compatibility / blast radius · saiku-core/saiku-web/src/main/java/org/saiku/web/security/csrf/SaikuCsrfRequestMatcher.java:51 and saiku-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 its permitAll. 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:490
    • saiku-webapp/src/main/webapp/aqvira-demo/index.html:574
    • saiku-ui/static/showcase/index.html:420
    • saiku-showcase/index.html:406

    DemoPagesHardeningTest.java:95-97 asserts the pages contain it, and saiku-showcase/README.md:25 / demo/foodmart-ops/README.md:31 document 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.bi deploys development-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 CSP sha256- 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-25 sends 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.clearSessions is now unreachable over HTTP. Delete it or say why it stays (#2389 still edits it).
  • praise · dropping the permitAll sub-tree and adding sessionSubPathsAreNotCsrfExempt as a negative test.

🤖 Generated with Claude Code

@juanresendiz813 juanresendiz813 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@juanresendiz813
juanresendiz813 added this pull request to the merge queue Nov 19, 2026
Merged via the queue into development with commit 01d1866 Nov 19, 2026
28 checks passed
@github-actions

Copy link
Copy Markdown

PR acceptance metric

Acceptance rate: 85.9% — 428 merged / 498 decided PRs (2 still open, excluded from the denominator).

Metric Value
Acceptance rate 85.9%
Accepted / rejected / open 428 / 70 / 2
Median time to first review (merged) 125.1 h
Median time to merge (merged) 14.1 h
Median time open (decided) 18.7 h
Mean review rounds on merged PRs 1.3
Authors with at least one merged PR 8
Author Merged Rejected Acceptance
buggtb 214 19 91.8%
app/dependabot 98 41 70.5%
juanresendiz813 96 1 99.0%
app/spicule-hive 8 1 88.9%
spicule-hive-bot 8 1 88.9%
oiacub1 2 0 100.0%
k-jm 1 3 25.0%
Prithvi1994 1 0 100.0%
laborima 0 3 0.0%
rezamuliawijaya 0 1 0.0%

Generated by scripts/pr-metrics.mjs — see docs/metrics.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/web risk/high Change risk tier: high (see docs/risk-tiers.md) security Created by Hive for agent-filed issue provenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[security] POST /rest/saiku/session/clear is an unthrottled password oracle and a second login path with no session-id rotation

2 participants