12 of ~16 hand-rolled CSRF checks omit csrf_token from their rejection response, breaking client-side resync app-wide #85
Closed
opened 2026-09-01 00:08:16 -04:00 by jared
·
1 comment
No Branch/Tag Specified
main
development
fix/comment-markdown-persist-18
deploy-2026.10.03-279
deploy-2026.10.03-275
deploy-2026.09.26-272
deploy-2026.09.25-268
deploy-2026.09.25-264
deploy-2026.09.24-258
deploy-2026.09.24-254
deploy-2026.09.12-242
deploy-2026.09.12-238
deploy-2026.09.12-234
deploy-2026.09.12-230
deploy-2026.09.12-226
deploy-2026.09.12-222
deploy-2026.09.11-218
deploy-2026.09.11-214
deploy-2026.09.11-210
deploy-2026.09.11-206
deploy-2026.09.11-202
deploy-2026.09.11-198
deploy-2026.09.11-194
deploy-2026.09.11-190
deploy-2026.09.11-186
deploy-2026.09.09-182
deploy-2026.09.09-178
deploy-2026.09.08-172
deploy-2026.09.01-163
deploy-2026.08.08-155
deploy-2026.08.08-151
deploy-2026.08.08-147
deploy-2026.08.08-143
deploy-2026.08.08-139
deploy-2026.07.15-130
deploy-2026.07.15-122
deploy-2026.07.11-107
deploy-2026.06.30-96
deploy-2026.06.30-92
deploy-2026.06.30-88
deploy-2026.06.30-84
deploy-2026.06.30-80
deploy-2026.06.30-76
deploy-2026.06.30-72
deploy-2026.06.30-68
deploy-2026.04.29-49
deploy-2026.04.29-41
deploy-2026.04.18-35
deploy-2026.04.16-31
deploy-2026.04.16-27
deploy-2026.04.16-23
deploy-2026.04.16-11
deploy-2026.04.14-9
Labels
Clear labels
api
bug
concurrency
config
data-integrity
dead-code
documentation
duplicate
enhancement
help wanted
invalid
needs-decision
notifications
performance
priority/docs
priority/high
priority/low
priority/medium
question
rate-limiting
reliability
security
ux
wontfix
workflow
Bearer/internal API surface
Something is not working
Race condition / concurrency bug
Configuration / deployment default
Data correctness / schema / integrity issue
Unused / dead code cleanup
README / docs accuracy
This issue or pull request already exists
New feature
Need some help
Something is wrong
Needs a maintainer decision, not clearly a bug
Matrix / in-app notification bug
Performance or resource-usage concern
Documentation-only gap
High-severity / high-impact issue
Low-severity / cosmetic issue
Medium-severity issue
More information is needed
Rate limiting behavior
Reliability / error-handling gap
Security or access-control impact
User-facing UX/functional bug
This won't be fixed
Ticket status workflow engine
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: LotusGuild/tinker_tickets#85
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: High
api/custom_fields.php,clone_ticket.php,delete_comment.php,delete_attachment.php,bulk_operation.php,generate_api_key.php,manage_templates.php,manage_recurring.php,revoke_api_key.php,manage_workflows.php,ticket_dependencies.php, andupload_attachment.phpall duplicateCsrfMiddleware::validateToken()inline instead of routing throughapi/bootstrap.php, and their 403 rejection body is just{"success":false,"error":"Invalid CSRF token"}— nocsrf_tokenfield.Compare to
api/bootstrap.php(~lines 40-47) and its direct users (add_comment.php,update_ticket.php), which correctly echoCsrfMiddleware::getToken()on rejection specifically solt.api's resync (assets/js/base.js:475) can recover.Impact: Once
window.CSRF_TOKENgoes stale for any reason (token expiry after ~1h idle — see related CSRF-retry issue for the exact numbers, or a write in another tab rotating the shared session-scoped token), the next write against any of these 12 endpoints returns a 403 with no recovery token in the body. The client has no way to self-heal at that point — every subsequent write to any endpoint (even ones that would normally resync fine) keeps failing until the user manually reloads the page. This is strictly broader and more severe than the already-filed #57 (notification bell's rawfetch(), one specific endpoint) — the resync mechanism is effectively only implemented on a minority of the app's write surface.Fix: Either route all 12 of these endpoints through
bootstrap.php's centralized CSRF handling (preferred — also fixes error-shape/display_errors inconsistencies other audit rounds already flagged), or at minimum add'csrf_token' => CsrfMiddleware::getToken()to each of these 12 rejection bodies.Fixed and verified against real MariaDB and real running endpoints (session-based CSRF flow, health-check states, connection charset/timezone sync). Merged to main in commit
bcc732e.