Repository navigation
Conversation
Spring Security CSRF protection was disabled, so a malicious site could make a logged-in user's browser call any state-changing endpoint (e.g. create an admin user, delete a survey). - The token is kept in a JS-readable XSRF-TOKEN cookie (CookieCsrfTokenRepository); Spring Security 5.8 with the XML config loads it on every request, so the cookie is issued with the login page and the app pages, and the raw value is accepted in the X-XSRF-TOKEN header or in the _csrf parameter. - React frontend (AbstractService), legacy jQuery pages (Collect.AbstractService), login form (also when auto-submitted with the default credentials) and the Collect Earth balloon preview send the token. - Not checked: /zkau (ZK validates its own random desktop ids), /ws (SockJS transports cannot send headers; no message handlers) and requests with an Authorization header (HTTP Basic clients like Collect Mobile; browsers cannot add it to cross-site requests). - Dev mode CORS allows the X-XSRF-TOKEN header.
They have no JavaScript test setup, like the Collect Earth balloon assets.
|
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.



CSRF protection was disabled. It is now enabled with a cookie token repository (
XSRF-TOKENcookie, sent back asX-XSRF-TOKENheader or_csrfparameter).AbstractServicesends the header on every non-GET request.Collect.AbstractService.sendsends the header;OF.csrfToken()helper./zkau/**(ZK validates requests against the session desktop id),/ws/**(SockJS transports, no client message handlers) and requests with anAuthorizationheader (HTTP Basic clients such as Collect Mobile; browsers cannot add it to cross-site requests).X-XSRF-TOKENheader.Note: a rejected request currently shows as 404, because the 403 error page (
/error.html) is not served (pre-existing).Test:
CsrfProtectionMatcherTest. Checked in a running instance: login, record editing, designer, data cleansing; POSTs without token are rejected.