webology,
@webology@mastodon.social avatar

👀 So it's a rare Saturday when I'm working because I shifted my week to take a Monday off, and I'm getting logged out of the Django Admin (localhost + Django 5.0.4) every ~5 seconds.

My console shows:

> django.security.SuspiciousSession WARNING Session data corrupted

This issue seemed to go away after I re-ran collectstatic to fix a few broken images. (It already gets ran at least twice).

🤔 I am not sure if this is a new Django bug or if anyone else is seeing this?

webology,
@webology@mastodon.social avatar

My spidey senses are tingling because I'm on Django 5.0.4, and I have never run into this before this version.

This is probably a red herring, but Mastodon, let me know if you have ever stumbled on this or you have recently.

webology,
@webology@mastodon.social avatar

Ah, even worse, but I figured out how to repeat it.

Every time runserver auto-reloads, it logs me out.

🤔 Now I'm wondering if it is new Django or some allauth change.

bmispelon,
@bmispelon@mastodon.social avatar

@webology That looks like a fun bug to track down 😁

Could it be you have some kind of in-memory session storage that gets wiped out on reload?

webology,
@webology@mastodon.social avatar
webology,
@webology@mastodon.social avatar

💥 FOUND IT 💥

A recent change to SECRET_KEY, which rotates the value based on secrets, was the culprit.

More importantly, this was a project setting change, NOT a Django change.

That's 30 minutes I'll never get back.

josh,
@josh@joshthomas.dev avatar

@webology Oops 😬

webology,
@webology@mastodon.social avatar

@josh Issues were filed 😉

fallenhitokiri,
@fallenhitokiri@social.screamingatmyscreen.com avatar

@webology I am a bit slow today, but secrets in settings.py or environment variable?

I’ve seen “Session data corrupt” in the logs of an internal project last night but didn’t dig in it yet. The project is on 4.2.6.

webology,
@webology@mastodon.social avatar

@fallenhitokiri It was a clever use of Python's import secrets and then usage of secrets.token_hex(32) for SECRET_KEY's default value if left blank.

fallenhitokiri,
@fallenhitokiri@social.screamingatmyscreen.com avatar

@webology ok, so I’ll definitely have to look for a different reason why I’ve seen this message :) thanks!

webology,
@webology@mastodon.social avatar

@fallenhitokiri Oh no. Did you wake up to one today too?

fallenhitokiri,
@fallenhitokiri@social.screamingatmyscreen.com avatar

@webology yep, didn’t plan to work today, but still had the terminal open and saw the message first thing in the morning.

webology,
@webology@mastodon.social avatar

@fallenhitokiri My hunch was that the broken media links were tricking Django into thinking I was trying to hack something.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • ngwrru68w68
  • tacticalgear
  • magazineikmin
  • Youngstown
  • khanakhh
  • rosin
  • slotface
  • InstantRegret
  • everett
  • kavyap
  • cisconetworking
  • JUstTest
  • cubers
  • modclub
  • GTA5RPClips
  • ethstaker
  • osvaldo12
  • Durango
  • provamag3
  • normalnudes
  • tester
  • anitta
  • megavids
  • Leos
  • lostlight
  • All magazines