Skip to content

Harden auth flow, CSP, and UI event handling - #79

Merged
jamesjhs merged 6 commits into
mainfrom
copilot/security-analysis-penetration-testing
May 26, 2026
Merged

Harden auth flow, CSP, and UI event handling#79
jamesjhs merged 6 commits into
mainfrom
copilot/security-analysis-penetration-testing

Conversation

Copilot AI commented May 26, 2026

Copy link
Copy Markdown
Contributor

This change implements the requested medium‑severity hardening: enforce CSRF on logout, tighten 2FA handling, remove inline handlers to allow stricter CSP, enforce production session secrets, and add login/2FA rate limits. It addresses the plan items end‑to‑end without altering core app behavior.

  • Auth/session hardening
    • CSRF required for /api/auth/logout
    • SESSION_SECRET required in production
    • login + 2FA rate limiting
    • 2FA fallback logging gated behind ALLOW_2FA_LOG_FALLBACK
  • CSP tightening
    • CSP nonce added for JSON‑LD scripts
    • script-src-attr 'none' to disallow inline handlers
  • UI event handling
    • replaced inline on* handlers with data-action dispatch and centralized event delegation
    • removed inline history.back() handlers in static help/policy/dpia/guide pages

Example (inline handler → delegated action):

<!-- before -->
<button onclick="doLogin()">Log in</button>

<!-- after -->
<button data-action="doLogin">Log in</button>

Copilot AI and others added 5 commits May 26, 2026 08:33
Agent-Logs-Url: https://github.com/jamesjhs/Tasker/sessions/0d3e6b03-297c-4119-8d17-3add73d86fff

Co-authored-by: jamesjhs <168957462+jamesjhs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesjhs/Tasker/sessions/0d3e6b03-297c-4119-8d17-3add73d86fff

Co-authored-by: jamesjhs <168957462+jamesjhs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesjhs/Tasker/sessions/0d3e6b03-297c-4119-8d17-3add73d86fff

Co-authored-by: jamesjhs <168957462+jamesjhs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesjhs/Tasker/sessions/0d3e6b03-297c-4119-8d17-3add73d86fff

Co-authored-by: jamesjhs <168957462+jamesjhs@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jamesjhs/Tasker/sessions/0d3e6b03-297c-4119-8d17-3add73d86fff

Co-authored-by: jamesjhs <168957462+jamesjhs@users.noreply.github.com>
Copilot AI changed the title Harden trust proxy handling and Excel export sanitization Harden auth flow, CSP, and UI event handling May 26, 2026
@jamesjhs
jamesjhs marked this pull request as ready for review May 26, 2026 15:52
@jamesjhs
jamesjhs merged commit 8cd0c0d into main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants