[loop-generated] [bug] CSRF middleware docstring shows hardcoded secret placeholder #485

Closed
opened 2026-03-19 19:47:52 +00:00 by Timmy · 0 comments
Owner

Problem

Line 103 of src/dashboard/middleware/csrf.py shows secret="***" in the docstring usage example. While this is just a docstring, it sets a bad example. The actual init correctly accepts the secret parameter.

More importantly, the CSRF middleware secret parameter (line 117-123) is stored but never actually used for token signing - tokens are just random values compared via cookie. This means the secret serves no cryptographic purpose.

Acceptance Criteria

  • Either implement HMAC-signed CSRF tokens using the secret, or remove the unused secret parameter
  • Update docstring to show proper usage
  • All tests pass

Files

  • src/dashboard/middleware/csrf.py
  • tests/ (CSRF-related tests)
## Problem Line 103 of src/dashboard/middleware/csrf.py shows `secret="***"` in the docstring usage example. While this is just a docstring, it sets a bad example. The actual init correctly accepts the secret parameter. More importantly, the CSRF middleware `secret` parameter (line 117-123) is stored but never actually used for token signing - tokens are just random values compared via cookie. This means the secret serves no cryptographic purpose. ## Acceptance Criteria - Either implement HMAC-signed CSRF tokens using the secret, or remove the unused secret parameter - Update docstring to show proper usage - All tests pass ## Files - src/dashboard/middleware/csrf.py - tests/ (CSRF-related tests)
Timmy closed this issue 2026-03-19 19:52:31 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#485