Menu

Your Flask session cookie is readable: decoding it by hand (and why some start with a dot)
📰

Your Flask session cookie is readable: decoding it by hand (and why some start with a dot)

DEV Community: flask·Mind vs Drive·4 days ago
#FnyFCDjS
#devtoflask#devto#dev#cookie#session
Long article (1144 words) — no AI summary yet.
Reading 0:00
15s threshold

Open your browser's dev tools on almost any Flask app that uses the built-in session , and you'll find a cookie that looks like random noise:

session=eyJyb2xlIjoiZWRpdG9yIiwidXNlcl9pZCI6NDJ9.aw5RVg.6RzRlPX-o-hiOKp2Li-B87K_pWY

Enter fullscreen mode

Exit fullscreen mode

It isn't noise, and it isn't encrypted. The Flask docs say so directly: the session "signs the cookies cryptographically. What this means is that the user could look at the contents of your cookie but not modify it, unless they know the secret key used for signing." (Flask 3.1.x quickstart, "Sessions", checked 1 Dec 2026.)

This post takes a real cookie apart, piece by piece, so you know exactly what your users (and anyone who grabs the cookie) can read.

The setup (illustrative)

Everything below came from a tiny app run locally with Flask 3.1.3 and itsdangerous 2.2.0. The secret key is a throwaway value for this article. Never use a key like this in production.

from flask import Flask , session

app = Flask ( __name__ ) app .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.