Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix: app.js reads CSRF cookies in the reverse of the backend's precedence

Open Beginner friendly
#489 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, python
Domain
backend, security

Research direction

Read dashboard/frontend/app.js near line 3910 and compare its cookie order with dashboard/backend/csrf.py near line 79. Then inspect the existing CSRF tests and add a regression case with both cookies set to different values. Done means the frontend and backend select the same token and the regression test passes.

Written by the indexing model from the issue text.

Description

dashboard/frontend/app.js:3910 iterates the CSRF cookie names dev-first:

for (const name of ['atl_csrf', '__Host-atl_csrf']) {

dashboard/backend/csrf.py:79 reads them host-first, unconditionally:

for name in (_HOST_CSRF, _DEV_CSRF):

Double-submit only compares equal when both sides pick the same cookie, so wherever the jar holds both with different values the frontend submits one token and the backend validates against the other — every write 403s until the user clears cookies.

When both coexist. The backend sets only one (csrf_cookie_name(), :52, on cookie_secure()), so this is not a steady state — it is a transition. A browser holding atl_csrf from before ATL_COOKIE_SECURE/RENDER became truthy keeps it (the __Host- prefix forbids Domain, so the new cookie cannot overwrite the old name), and the server then issues __Host-atl_csrf beside it. :74 clears both, so a logout/login cycle resolves it — which is also why this can look intermittent and user-specific.

Fix: swap the array to ['__Host-atl_csrf', 'atl_csrf'] to match csrf.py:79.

Introduced by #285. The same defect was copied into dashboard/frontend/js/admin-shell.js and fixed there in #488, which deliberately leaves this call site alone — the two are independent copies, and this one is not that PR's to change.

A regression test needs to set both cookies to different values; the existing CSRF tests set one at a time and are structurally blind to ordering.

🤖 Filed with Claude Code

Dominant language
Python
Stars
767
Forks
156
Avg merge
22h 57m
Merged PRs (30d)
84

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Open-Finance-Lab/AgenticTrading

All issues in Open-Finance-Lab/AgenticTrading

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.