Skip to content

Commit c0602e2

Browse files
committed
Doc tweaks, include pickle warning
Documentation
1 parent 431debd commit c0602e2

File tree

9 files changed

+23
-15
lines changed

9 files changed

+23
-15
lines changed

docs/_static/styles.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ table {
1010
width: -moz-available;
1111
width: fill-available;
1212
width: stretch;
13-
}
13+
}

docs/conf.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"flask": ("http://flask.palletsprojects.com/", None),
1515
"werkzeug": ("http://werkzeug.palletsprojects.com/", None),
1616
"flask-sqlalchemy": ("http://flask-sqlalchemy.palletsprojects.com/", None),
17-
"redis": ("http://redis-py.readthedocs.io/", None),
17+
"redis": ("http://redis-py.readthedocs.io/en/stable/", None),
1818
}
1919

2020

@@ -59,6 +59,7 @@
5959
html_static_path = ["_static"]
6060
html_theme = "furo"
6161
html_theme_options = {
62+
"announcement": "Flask-Session is switching serializers to msgpack in 1.0.0. Use version 0.7.0 if you need graceful migration for existing sessions.",
6263
"source_repository": "https://github.com/pallets-eco/flask-session/",
6364
"source_branch": "main",
6465
"source_directory": "docs/",

docs/config_flask.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ modify them at runtime.
3535
.. _SESSION_REFRESH_EACH_REQUEST: https://flask.palletsprojects.com/en/latest/config/#SESSION_REFRESH_EACH_REQUEST
3636

3737
.. note::
38-
``PERMANENT_SESSION_LIFETIME`` is also used to set the expiration time of the session data on the server side, regardless of permanence.
38+
``PERMANENT_SESSION_LIFETIME`` is also used to set the expiration time of the session data on the server side, regardless of ``SESSION_PERMANENT``.

docs/config_security.rst

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Consider the following Flask configurations in production:
1212

1313
.. list-table::
1414
:header-rows: 1
15+
:align: left
1516

1617
* - Setting
1718
- Consideration

docs/installation.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ Install from PyPI using an installer such as pip:
1010
1111
Flask-Session's only required dependency is msgspec for serialization, which has no sub-dependencies.
1212

13-
You need to choose a storage type and install an appropriate client library so the app can communicate with storage. For example, if you want to use Redis as your storage, you will need to install the redis-py client library:
13+
However, you also need to choose a storage type and install an appropriate client library so the app can communicate with storage. For example, if you want to use Redis as your storage, you will need to install the redis-py client library:
1414

1515
.. code-block:: bash
1616
1717
$ pip install redis
1818
1919
Redis is the recommended storage type for Flask-Session, as it has the most complete support for the features of Flask-Session with minimal configuration.
2020

21+
.. warning::
22+
23+
Flask-Session versions below 1.0.0 (not yet released), use pickle_ as the default serializer, which may have security implications in production if your storage is ever compromised.
24+
25+
2126
Direct support
2227
---------------
2328

@@ -60,7 +65,7 @@ Flask-Session also indirectly supports storage and client libraries via cachelib
6065
* - Redis
6166
- redis-py_
6267
* - Memcached
63-
- pylibmc_, memcached, libmc_ or `google.appengine.api.memcached`_
68+
- pylibmc_, python-memcached_, libmc_ or `google.appengine.api.memcached`_
6469
* - MongoDB
6570
- pymongo_
6671
* - DynamoDB
@@ -69,10 +74,10 @@ Flask-Session also indirectly supports storage and client libraries via cachelib
6974

7075
.. warning::
7176

72-
As of writing, cachelib_ still uses pickle_ as the default serializer, which may have security implications in production.
77+
As of writing, cachelib_ still uses pickle_ as the default serializer, which may have security implications in production if your storage is ever compromised.
7378

7479

75-
.. _redis-py: https://github.com/andymccurdy/redis-py
80+
.. _redis-py: https://github.com/redis/redis-py
7681
.. _pylibmc: http://sendapatch.se/projects/pylibmc/
7782
.. _python-memcached: https://github.com/linsomniac/python-memcached
7883
.. _pymemcache: https://github.com/pinterest/pymemcache

docs/usage.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ then create the :class:`Session` object by passing it the application.
1818
app = Flask(__name__)
1919
2020
SESSION_TYPE = 'redis'
21+
SESSION_REDIS = Redis(host='localhost', port=6379)
2122
app.config.from_object(__name__)
2223
Session(app)
2324
@@ -47,21 +48,21 @@ Rather than calling :class:`~Session`, you may initialize later using :meth:`~Se
4748

4849
.. code-block:: python
4950
51+
...
5052
sess = Session()
5153
sess.init_app(app)
5254
5355
Or, if you prefer to directly set parameters rather than using the configuration constants, you can initialize by setting an instance of :class:`flask_session.redis.RedisSessionInterface` directly to the :attr:`flask.Flask.session_interface`.
5456

5557
.. code-block:: python
5658
59+
from flask import Flask, session
5760
from flask_session.redis import RedisSessionInterface
5861
from redis import Redis
59-
...
6062
61-
redis = Redis(
62-
host='localhost',
63-
port=6379,
64-
)
63+
app = Flask(__name__)
64+
65+
redis = Redis(host='localhost', port=6379)
6566
app.session_interface = RedisSessionInterface(
6667
client=redis,
6768
)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .cachelib import CacheLibSessionInterface, CacheLibSession # noqa: F401
1+
from .cachelib import CacheLibSession, CacheLibSessionInterface # noqa: F401

src/flask_session/filesystem/filesystem.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class FileSystemSession(ServerSideSession):
1616
class FileSystemSessionInterface(ServerSideSessionInterface):
1717
"""Uses the :class:`cachelib.file.FileSystemCache` as a session storage.
1818
19-
:param key_prefix: A prefix that is added to stored keys.
19+
:param key_prefix: A prefix that is added to storage keys.
2020
:param use_signer: Whether to sign the session id cookie or not.
2121
:param permanent: Whether to use permanent session or not.
2222
:param sid_length: The length of the generated session id in bytes.

src/flask_session/memcached/memcached.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class MemcachedSessionInterface(ServerSideSessionInterface):
2121
"""A Session interface that uses memcached as session storage. (`pylibmc`, `libmc`, `python-memcached` or `pymemcache` required)
2222
2323
:param client: A ``memcache.Client`` instance.
24-
:param key_prefix: A prefix that is added to all Memcached store keys.
24+
:param key_prefix: A prefix that is added to all storage keys.
2525
:param use_signer: Whether to sign the session id cookie or not.
2626
:param permanent: Whether to use permanent session or not.
2727
:param sid_length: The length of the generated session id in bytes.

0 commit comments

Comments
 (0)