Skip to content

Harden secure login cookie#221

Merged
csev merged 1 commit intotsugiproject:masterfrom
ottenhoff:codex/secure-cookie-hardening
Apr 20, 2026
Merged

Harden secure login cookie#221
csev merged 1 commit intotsugiproject:masterfrom
ottenhoff:codex/secure-cookie-hardening

Conversation

@ottenhoff
Copy link
Copy Markdown
Contributor

Summary

  • harden the long-lived secure login cookie with explicit Secure, HttpOnly, and SameSite=None attributes
  • stop accepting legacy AesCtr ciphertext in the secure-cookie path and use AesOpenSSL directly
  • add targeted secure-cookie tests for the cookie options and legacy-ciphertext rejection

Notes

  • this intentionally limits the crypto cleanup to the secure-cookie flow
  • AesCtr is still used elsewhere in the codebase, including badges, RPC, and other legacy-secret paths, so it was not deleted in this PR
  • existing remember-me cookies created with the old secure-cookie format will no longer be accepted and will require a fresh login

Validation

  • php -l lib/src/Crypt/SecureCookie.php
  • php -l lib/tests/Crypt/SecureCookieTest.php
  • custom PHP smoke test covering create/extract, cookie options, and legacy secure-cookie rejection

@csev
Copy link
Copy Markdown
Collaborator

csev commented Apr 20, 2026

@ottenhoff I have been thinking about removing the secure login cookie completely. It is already off by default. That was my first step towards complete removal. None of my production servers use it. Another Tsugi user went through a security audit and they did not like it much. That pushed me down the path of complete removal. Your PR can be merged and is harmless methinks - we can remove later.

@csev csev merged commit 5587bc1 into tsugiproject:master Apr 20, 2026
2 checks 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