You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zhaohai666 (via GitHub)" <gi...@apache.org> on 2026/07/29 06:49:27 UTC
[PR] [studio] Add CSRF token support for mutating HTTP requests [rocketmq-dashboard]
zhaohai666 opened a new pull request, #662:
URL: https://github.com/apache/rocketmq-dashboard/pull/662
## Summary
Add CSRF (Cross-Site Request Forgery) protection to the HTTP client to
complement the backend's CookieCsrfTokenRepository configuration.
- Read XSRF-TOKEN from cookies (set by backend with httpOnly=false)
- Request interceptor now attaches X-XSRF-TOKEN header for mutating
methods: POST, PUT, DELETE, PATCH
- On first request, if XSRF cookie is not present, fetch
`/rocketmq-dashboard/csrf-token` endpoint to trigger cookie creation
- Deduplicate concurrent CSRF fetch requests via shared promise
- Non-mutating requests (GET, HEAD, OPTIONS) are unaffected
## Test plan
- [ ] GET requests should NOT include X-XSRF-TOKEN header
- [ ] POST/PUT/DELETE requests should include X-XSRF-TOKEN from cookie
- [ ] First mutating request should trigger /csrf-token fetch if no cookie
- [ ] Existing Authorization header behavior unchanged
- [ ] 401 handling and auth session clearing still work correctly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Add CSRF token support for mutating HTTP requests [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #662: [Studio] Add CSRF token support for mutating HTTP requests
URL: https://github.com/apache/rocketmq-dashboard/pull/662
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Studio] Add CSRF token support for mutating HTTP requests [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #662:
URL: https://github.com/apache/rocketmq-dashboard/pull/662#issuecomment-5140752553
Closing: the studio backend has no CSRF infrastructure (no CookieCsrfTokenRepository, no /csrf-token endpoint — the fetched path /rocketmq-dashboard/csrf-token belongs to the legacy dashboard and would 404 here). Authentication uses a Bearer token from localStorage attached via header, which is not subject to cookie-based CSRF, so this interceptor would only add a failing pre-flight fetch to every first mutating request. If CSRF protection is introduced server-side later, a matching frontend PR would be welcome. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org