Debian Codegraph @

CHANGES.rst

raw
1 Flask-Security Changelog
2 ========================
3
4 Here you can see the full list of changes between each Flask-Security release.
5
6 Version 5.9.1
7 -------------
8
9 Released September 30, 2026
10
11 Fixes
12 +++++
13 -(:pr:`1293`) Fix for open-redirect GHSA-ccgp-pv8r-95wm
14
15
16 Version 5.9.0
17 -------------
18
19 Released September 24, 2026
20
21 This release adds support for refresh tokens (finally!). In addition there are
22 several configuration changes that try to align Flask-Security with latest
23 best-practices.
24
25 Please read these notes carefully - in particular the change to the default auth
26 token lifetime might severely impact some applications.
27
28 Features & Improvements
29 +++++++++++++++++++++++
30 - (:issue:`1206`) Add support for refresh tokens. See :ref:`token_topic`
31 - (:pr:`1233`) Change :py:data:`SECURITY_TOKEN_MAX_AGE` from an int to a timedelta.
32 Also - *change default from ``never expire`` to 15 minutes*.
33 - (:pr:`1235`) Change default :py:data:`SECURITY_LOGOUT_METHODS` to be just ``"POST"``
34 - (:issue:`1228`) Change default ``csrf`` and ``tf_validity`` cookie config to ``secure=True``
35 - (:issue:`1228`) The ``tf_validity`` cookie name is now configurable via :py:data:`SECURITY_TWO_FACTOR_VALIDITY_COOKIE_NAME`
36 - (:issue:`1237`) Add support for CSRF on logout (default ``False``)
37 - (:pr:`1241`) Convert all _WITHIN configuration variables to use timedelta
38 - (:issue:`1153`) Enable localization of %(within)s variables using humanize
39 - (:pr:`1249`) Add link expiration to confirmation and reset password email templates.
40 - (:issue:`536` Add template path configuration variables for all email templates.
41 - (:issue:`1254`) Webauthn/passkey name input value is now sanitized and normalized. A new utility method
42 :py:meth:`flask_security.input_svn` is now used and is available for applications to use.
43 - (:pr:`1271`) Username validation and normalization now uses the new :py:meth:`flask_security.input_svn` utility. This has some
44 backwards compatibility concerns - see below.
45 - (:pr:`1259`) Allow redirects to exactly :py:data:`SECURITY_REDIRECT_BASE_DOMAIN` by adding '.' to :py:data:`SECURITY_REDIRECT_ALLOWED_SUBDOMAINS`.
46
47 Fixes
48 +++++
49 - (:issue:`1108`) ``/verify`` and ``/us-verify`` forms now include the optional
50 ``next`` field so form-posted redirect URLs are validated and preserved. (DSeaStar)
51 - (:issue:`1212`) Newly introduced :py:meth:`.UserMixin.is_locked` logic is inverted.
52 - (:pr:`1234`) Fix for GHSA-f66q-9rf6-8795 - WebAuthn reauthentication freshness bypass. (tonghuaroot)
53 - (:issue:`1244`) Fix login form remember me checkbox.
54 - (:pr:`1258`) A JSON request body can set a form field (email, password,
55 username, identity, name, phone, refresh token, recovery/2FA code, ...) to a
56 non-string value (e.g. a dict), which used to crash with an unhandled
57 ``TypeError`` instead of failing validation cleanly. (miettal)
58 - (:issue:`1263`) :py:data:`SECURITY_CACHE_CONTROL` directives were added to every
59 application response instead of just responses from Flask-Security endpoints
60 as documented.
61 - (:issue:`1272`) Properly re-export public methods (using redundant symbol aliases).
62
63
64 Docs and Chores
65 +++++++++++++++
66 - (:issue:`1208`) Remove support for Pony ORM
67 - (:pr:`1240`) Remove deprecated get_token_status() and convert uses to check_and_get_token_status()
68 - (:pr:`1252`) Replace ``bleach`` (deprecated/unmaintained) with ``nh3`` for username sanitization (tkfoss)
69 - (:pr:`1273`) Improve translation tests to not use real french translations
70 - (:pr:`1275`) Update Spanish and Catalan translations. (arielvb)
71 - (:pr:`1283`) Improve (from 54% to 74%) pyright --verifytypes
72 - (:pr:`1284`) Change dependencies to dependency-groups
73 - (:pr:`1286`) Remove dependabot
74 - (:pr:`1287`) Drop support for Python 3.10
75
76 Backwards Compatibility Concerns
77 +++++++++++++++++++++++++++++++++
78 - The fix for the inverted `is_locked` logic will require any application using it
79 to invert their logic.
80 - The change to :py:data:`SECURITY_TOKEN_MAX_AGE` default improves a long-standing
81 'insecure-out-of-the-box' concern. Applications will have to either change the
82 value if they really want a long-lasting token or use the new refresh token
83 feature.
84 - The default for :py:data:`SECURITY_LOGOUT_METHODS` has been changed to just
85 allowing ``"POST"``. This is considered modern best practice.
86 - The default configuration for :py:data:`SECURITY_TWO_FACTOR_VALIDITY_COOKIE`
87 has been change to ``secure=True``.
88 - The default configuration for :py:data:`SECURITY_CSRF_COOKIE` has been
89 changed to ``secure=True``
90 - All _WITHIN configuration variables now take a timedelta instead of the
91 home-grown ``<#> <period>``. The old form is still accepted, with a deprecation
92 warning, and converted at flask-security app init time into a timedelta.
93 - With the addition of email template path configuration variables, the
94 :py:meth:`flask_security.send_mail` method's ``template`` parameter now requires a
95 complete template path (relative to the application or blueprint root).
96 - Username sanitization now uses ``nh3`` instead of ``bleach``. If you enabled
97 :py:data:`SECURITY_USERNAME_ENABLE` you must now install ``nh3`` (included in the
98 ``common`` extra) rather than ``bleach``.
99 - Webauthn names are now sanitized, validated for certain allowable characters,
100 and normalized. It is possible that some existing names could now be
101 considered illegal and won't match (so can't be deleted via API). The allowed
102 character categories can be set with :py:data:`SECURITY_WAN_NAME_ALLOWED_CHARS`.
103 The module ``nh3`` is used to sanitize input - the application must have that
104 package installed.
105 - Username form input now uses the newer input sanitization and normalization utility class.
106 The configuration variable ``SECURITY_USERNAME_NORMALIZE_FORM`` has been replaced
107 with :py:data:`SECURITY_INPUT_NORMALIZE_FORM` (default is still "NKFD"). There is a new configuration
108 option :py:data:`SECURITY_USERNAME_ALLOWED_CHARS` which can be used to change
109 which unicode character classes are permitted in the username for validation
110 (the default is ``["L", "N"]`` which is the same as before).
111 The error message ``SECURITY_MSG_USERNAME_ILLEGAL_CHARACTERS`` has been replaced with
112 ``SECURITY_MSG_INVALID_INPUT``.
113 - The UsernameUtil.check_username method has been removed.
114
115 Notes
116 +++++
117 - The refresh token feature requires a new DB model - FsRefreshTracker - which must
118 be added by the application. This model has been added to the `fsqla` and `sqla`
119 all-inclusive models and their respective versions have been bumped.
120
121 Version 5.8.2
122 -------------
123
124 Released August 11, 2026
125
126 Fixes
127 +++++
128 - (:pr:`1265`) Fix for GHSA-f66q-9rf6-8795 - WebAuthn reauthentication freshness bypass. (tonghuaroot)
129 - (:issue:`1263`) :py:data:`SECURITY_CACHE_CONTROL` directives were added to every
130 application response instead of just responses from Flask-Security endpoints
131 as documented. (Ceirced)
132 - (:issue:`1212`) Newly introduced :py:meth:`.UserMixin.is_locked` logic is inverted.
133 - (:issue:`1244`) Fix login form remember me checkbox.
134
135 Backwards Compatibility Concerns
136 +++++++++++++++++++++++++++++++++
137 - The fix for the inverted `is_locked` logic will require any application using it
138 to invert their logic.
139
140 Version 5.8.1
141 -------------
142
143 Released May 21, 2026
144
145 Fixes
146 +++++
147 - (:issue:`1222`) Fix for GHSA-w2j7-f3c6-g8cw - Possible open-redirect with ALLOW_SUBDOMAIN option.
148 - (:issue:`1215`) Fix for GHSA-97r5-pg8x-p63p - possible oauth bypass in /verify
149
150 Version 5.8.0
151 -------------
152
153 Released April 15, 2026
154
155 Features & Improvements
156 +++++++++++++++++++++++
157 - (:pr:`1170`) Add API :py:meth:`.UserMixin.check_tf_required` to allow applications to control which users
158 require two-factor authentication.
159 - (:issue:`1178`) Add Cache-Control headers.
160 - (:issue:`1165`) Add support for using Social Login (OAuth) for verification.
161 - (:issue:`1188`) Add tracking of failed authentication attempts via :py:meth:`.UserMixin.track_failed_authn`
162 and signal :py:data:`user_failed_authn`
163 - (:issue:`1192`) Add API for application to decide if a particular user account is locked.
164
165 Fixes
166 +++++
167 - (:issue:`1179`) Fix verify_password for bcrypt 5.0 (mephi42)
168 - (:issue:`1200`) Fix username_recovery w.r.t. inactive and non-confirmed users
169 - (:issue:`1189`) Return additional fields for JSON responses with QR codes
170
171 Docs and Chores
172 +++++++++++++++
173 - (:pr:`1150`) Update de_DE translations (swaeberle)
174 - (:pr:`1151`) Update ca_ES translations (arielvb)
175 - (:pr:`1152`) Update es_ES translations (arielvb)
176 - (:pr:`1196`) Update arabic translations (samialfattani)
177 - (:pr:`1199`) Update it_IT translations (gissimo)
178 - (:pr:`1185`) Change external facing terminology from 'Social OAuth' to 'Social Login'.
179
180 Version 5.7.1
181 -------------
182
183 Released November 23, 2025
184
185 Fixes
186 +++++
187 - (:issue:`1147`) Regression when updating hash algorithm from bcrypt (willcroft)
188
189 Version 5.7.0
190 -------------
191
192 Released November 14, 2025
193
194 This release contains a set of small backward incompatible changes. Please read these notes carefully.
195
196 Features & Improvements
197 +++++++++++++++++++++++
198 - (:pr:`1132`) Add Arabic translations (samialfattani)
199 - (:issue:`1123`) Enable forgot-password workflow for authenticated users.
200
201 Fixes
202 +++++
203 - (:pr:`1115`) Fix broken link in docs and improve docstrings/typing for util classes.
204 - (:issue:`1127`) Add nonce to script tags if configured to support nonce-based Content-Security-Policy (ahanak).
205 - (:issue:`1133`) Remove unnecessary (optional) dependency on sqlalchemy_utils.
206 - (:pr:`1140`) Fix localization of tf_select choices.
207 - (:pr:`1143`) Support bcrypt 5.0 - See below for important compatibility concerns.
208 This also replaces passlib with libpass for all versions.
209
210 Docs and Chores
211 +++++++++++++++
212 - (:pr:`1144`) Update ES and IT translations (gissimo)
213 - (:pr:`1106`) Drop support for Python 3.9. This removes the dependency on importlib_resources,
214 updates pypy to 3.10, and uses 3.12 as base python for tests/tox.
215 - (:pr:`1112`) Flip :py:data:`SECURITY_USE_REGISTER_V2` default to ``True``.
216 - (:pr:`1117`) Flip default mail package back to Flask-Mail (from Flask-Mailman).
217 - (:issue:`1139`) Change external facing terminology from 'WebAuthn Credential' to 'passkey'.
218 - (:pr:`1142`) Setting of xx_util_cls from kwargs which was deprecated in 5.6.1 has been removed.
219 The BACKWARDS_COMPAT_UNAUTHN option (code) which has been deprecated since 5.4 has been removed.
220
221 Backwards Compatibility Concerns
222 +++++++++++++++++++++++++++++++++
223 - Flask-Security now depends on ``libpass`` (https://pypi.org/project/libpass/) for all versions. Be sure to UNINSTALL
224 passlib, ensure the passlib directory is empty and then install libpass - we have seen reports when both are installed -
225 it doesn't work!
226
227 In bcrypt 5.0 they started throwing a ValueError for passwords/secrets longer than 72 bytes. It is important to know that by default
228 Flask-Security performs a double hash - taking the secret, using HMAC(SHA512) then b64encodng the result. This means that ANY password
229 will be longer than 72 bytes (86 to be exact). In the past bcrypt would silently truncate the input - now we have to do that explicitly.
230 OWASP says truncation concerns are negligible: https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#input-limits-of-bcrypt
231
232 - The default RegisterForm is now the new RegisterFormV2 - Please read :ref:`register_form_migration`.
233 Flask-Security will emit a DeprecationWarning if the :py:data:`SECURITY_USE_REGISTER_V2` is set to False.
234
235 - In 5.0 we changed the default mailer package to Flask-Mailman since Flask-Mail was no longer supported.
236 Flask-Mail is again supported and is part of Pallets-Eco. Both packages are still supported based on which one
237 an application initializes. The only backwards compatibility concern is that if you use the setup extras 'common',
238 it will install Flask-Mail rather than Flask-Mailman.
239
240 - In the optional dependencies 'fsqla' we removed sqlalchemy_utils - while many applications might want these useful
241 add-ons - they aren't required for standard SQLAlchemy use.
242
243 Version 5.6.2
244 -------------
245
246 Released May 4, 2025
247
248 Fixes
249 +++++
250 - (:issue:`1032` and :issue:`1096`) Use libpass for python >= 3.12
251 - (:pr:`1086`) Fix FR translation test for Change Password (nickcuenca)
252 - (:issue:`1090`) Properly document context variables available in email templates.
253 - (:issue:`1093`) Add confirmation link/token and reset link/token to welcome_existing email template.
254
255 Notes
256 +++++
257 Since Python 3.12 no longer contains setuptools - the old passlib failed to import.
258 Rather than require setuptools, for Python >=3.12 we now depend on the fork ``libpass`` (https://pypi.org/project/libpass/)
259 This is a very new package and rather than possibly cause backwards compat issues for projects
260 not using Python >=3.12 - Flask-Security maintains the dependency on passlib for Python <3.12.
261
262 Note: you can still use passlib for 3.12 and 3.13 - you have to manually add setuptools.
263
264 Version 5.6.1
265 -------------
266
267 Released March 18, 2025
268
269 Fixes
270 +++++
271 - (:issue:`1077`) Fix runtime modification of a config string (TWO_FACTOR_METHODS)
272 - (:issue:`1078`) Fix CLI user_create when model doesn't contain username
273 - (:issue:`1076`) xxx_util_cls instances should be public and documented.
274
275 Backwards Compatibility Concerns
276 +++++++++++++++++++++++++++++++++
277 As part of :issue:`1076` the following cleanup was done:
278
279 - The xxx_util_cls arguments are now stored in 'private' instance variables - they are never
280 used after Flask-Security initialization and have never been documented.
281 - The xxx_util_cls options should only be set as part of Flask-Security construction.
282 Setting them via init_app(kwargs) or app.config["SECURITY_XX"] has been deprecated.
283
284 Version 5.6.0
285 -------------
286
287 Released February 12, 2025
288
289 Features & Improvements
290 +++++++++++++++++++++++
291 - (:issue:`1038`) Add support for 'secret_key' rotation (jamesejr)
292 - (:issue:`980`) Add support for username recovery in simple login flows (jamesejr)
293 - (:issue:`1055`) Add support for changing username
294 - (:pr:`1048`) Add support for Python 3.13
295 - (:issue:`1043`) Unify Register forms (and split out re-type password option) Please read :ref:`register_form_migration`.
296
297 Fixes
298 +++++
299 - (:pr:`1062`) Fix duplicate HTML ids in templates.
300 - (:pr:`1067`) Fix more duplicate HTML ids in templates.
301 - (:issue:`1064`) Ensure templates pass W3C validation (see below)
302
303 Docs and Chores
304 +++++++++++++++
305 - (:pr:`1052`) Remove deprecated TWO_FACTOR configuration variables
306 - (:pr:`1069`) Update ES and IT translations (gissimo)
307 - (:pr:`1071`) Improve templates - two-factor is hyphenated, re-authenticate is not.
308 Also try to embed links into xlatable strings.
309
310 Notes
311 +++++
312 Python 3.13 removed ``crypt``, which passlib attempts to import and use as
313 part of its safe_crypt() method (fallback is to return None).
314 However - that method only appears to be called in a few crypt handlers and
315 for bcrypt - only for the built-in bcrypt - not if the bcrypt package is installed.
316 passlib is not maintained - a new fork (10/1/2024) (https://pypi.org/project/libpass/)
317 seems promising and has been tested with python 3.13 and Flask-Security. If that fork matures we will
318 change the dependencies appropriately.
319
320 The register forms have been combined - or more accurately - there is a new RegisterFormV2
321 that subsumes the features of both the old RegisterForm and ConfirmRegisterForm.
322 Please read :ref:`register_form_migration`.
323
324 The SECURITY_TWO_FACTOR_{SECRET, URI_SERVICE_NAME, SMS_SERVICE, SMS_SERVICE_CONFIG}
325 have been removed (they have been deprecated for a while). Use the equivalent
326 :py:data:`SECURITY_TOTP_SECRETS`, :py:data:`SECURITY_TOTP_ISSUER`, :py:data:`SECURITY_SMS_SERVICE` and
327 :py:data:`SECURITY_SMS_SERVICE_CONFIG`.
328
329 Backwards Compatibility Concerns
330 +++++++++++++++++++++++++++++++++
331 The fixes to all the templates to pass W3C validation could introduce some incompatibilities:
332
333 - All templates now have a default <title> - before, the <title> element was empty.
334 - The HTML id of the rescue form submit button was changed to 'rescue'
335 - The HTML id of the webauthn delete form name field was changed to 'delete-name'
336 - Some template headings were changed to improve consistency
337 - The csrf_token HTML id was changed on us_setup.html, wan_register.html, two_factor_setup.html
338 two_factor_verify_code.html, us_verify.html, verify.html for the second form on the page.
339 - On us_setup.html and two_factor_setup.html the submit code button HTML id was changed.
340
341 Version 5.5.2
342 -------------
343
344 Released August 5, 2024
345
346 More attempts to upload to pypi both flask-security and flask-security-too.
347 No code changes - however the build manifest changed so the source distribution
348 contents might be slightly different.
349
350 Docs and Chores
351 +++++++++++++++
352 - (:pr:`1019`) Separate publish workflows for each pypi package
353
354 Version 5.5.1
355 -------------
356
357 Released August 1, 2024
358
359 I am pleased to announce that Flask-Security-Too is now part of pallets-eco and has returned
360 to be released as 'Flask-Security'. For the foreseeable future, we will publish the same release to both
361 Flask-Security and Flask-Security-Too on PyPI.
362
363 There are no code changes.
364
365 Docs and Chores
366 +++++++++++++++
367 - (:pr:`1015`) Convert docs, links, badges, etc to pallets-eco
368
369 Version 5.5.0
370 -------------
371
372 Released July 24, 2024
373
374 Features & Improvements
375 +++++++++++++++++++++++
376 - (:issue:`956`) Add support for changing registered user's email (:py:data:`SECURITY_CHANGE_EMAIL`).
377 - (:issue:`944`) Change default password hash to argon2 (was bcrypt). See below for details.
378 - (:pr:`990`) Add freshness capability to auth tokens (enables /us-setup to function w/ just auth tokens).
379 - (:pr:`991`) Add support to /tf-setup to not require sessions (use a state token).
380 - (:issue:`994`) Add support for Flask-SQLAlchemy-Lite - including new all-inclusive models
381 that conform to sqlalchemy latest best-practice (type-annotated).
382 - (:pr:`1007`) Convert other sqlalchemy-based datastores from legacy 'model.query' to best-practice 'select'
383 - (:issue:`983`) Allow applications more flexibility defining allowable redirects.
384
385 Fixes
386 +++++
387 - (:pr:`972`) Set :py:data:`SECURITY_CSRF_COOKIE` at beginning (GET /login) of authentication
388 ritual - just as we return the CSRF token. (thanks @e-goto)
389 - (:issue:`973`) login and unified sign in should handle GET for authenticated user consistently.
390 - (:pr:`995`) Don't show sms options if not defined in US_ENABLED_METHODS. (fredipevcin)
391 - (:pr:`1009`) Change :py:data:`SECURITY_DEPRECATED_HASHING_SCHEMES` to ``["auto"]``.
392
393 Docs and Chores
394 +++++++++++++++
395 - (:pr:`979`) Update Russian translations (ademaro)
396 - (:pr:`1004`) Update ES and IT translations (gissimo)
397 - (:pr:`981` and :pr:`977`) Improve docs
398 - (:pr:`992`) The long deprecated `get_token_status` is no longer exported
399 - (:pr:`992`) Drop Python 3.8 support.
400 - (:issue:`1001`) Try a different approach to typing User and Role models.
401
402 Backwards Compatibility Concerns
403 +++++++++++++++++++++++++++++++++
404 - Notes around the change to argon2 as the default password hash:
405 - applications should add the argon2_cffi package to their requirements (it is included in the flask_security[common] extras).
406 - leave bcrypt installed so that old passwords still work.
407 - the default configuration will re-hash passwords with argon2 upon first use.
408 - Changes to /tf-setup
409 The old path - using state set in the session still works as before. The new path is
410 just for the case an authenticated user wants to change their 2FA setup.
411 - Changes to sqlalchemy-based datastores
412 Flask-Security no longer uses the legacy model.query - all DB access is done via
413 `select(xx).where(xx)`. As a result the find_user() method now only takes a SINGLE
414 column:value from its kwargs - in prior releases all kwargs were passed into the query.filter.
415
416 Version 5.4.3
417 -------------
418
419 Released March 23, 2024
420
421 Fixes
422 +++++
423 - (:issue:`950`) Regression - some templates no longer getting correct config (thanks pete7863).
424 - (:issue:`954`) CSRF not properly ignored for application forms using :py:data:`SECURITY_CSRF_PROTECT_MECHANISMS`.
425 - (:pr:`957`) Improve jp translations (e-goto)
426 - (:issue:`959`) Regression - datetime_factory should still be an attribute (thanks TimotheeJeannin)
427 - (:issue:`942`) :py:data:`SECURITY_RETURN_GENERIC_RESPONSES` hid email validation/syntax errors.
428
429 Version 5.4.2
430 -------------
431
432 Released March 8, 2024
433
434 Fixes
435 +++++
436 - (:issue:`946`) OpenAPI spec missing.
437 - (:pr:`945`) Doc fixes (e-goto)
438 - (:pr:`941`) Update ES/IT translations (gissimo)
439
440 Version 5.4.0 & 5.4.1
441 ----------------------
442
443 Released February 26, 2024
444
445 Among other changes, this continues the process of dis-entangling Flask-Security
446 from Flask-Login and may require some application changes due to backwards incompatible changes.
447
448 Features & Improvements
449 +++++++++++++++++++++++
450 - (:issue:`879`) Work with Flask[async]. view decorators and signals support async handlers.
451 - (:pr:`900`) CI support for python 3.12
452 - (:pr:`901`) Work with py_webauthn 2.0 (and only 2.0+)
453 - (:pr:`899`) Improve (and simplify) Two-Factor setup. See below for backwards compatability issues and new functionality.
454 - (:issue:`912`) Improve oauth debugging support. Handle next propagation in a more general way.
455 - (:pr:`877`) Make AnonymousUser (Flask-Login) optional and deprecated.
456 - (:pr:`906`) Remove undocumented and untested looking in session for possible 'next'
457 redirect location.
458 - (:pr:`881`) No longer rely on Flask-Login.unauthorized callback. See below for implications.
459 - (:issue:`904`) Changes to default unauthorized handler - remove use of referrer header (see below) and document precise behavior.
460 - (:pr:`927`) The authentication_token format has changed - adding per-token expiry time and future session ID.
461 Old tokens are still accepted.
462
463
464 Docs and Chores
465 +++++++++++++++
466 - (:pr:`889`) Improve method translations for unified signin and two factor. Remove support for Flask-Babelex.
467 - (:pr:`911`) Chore - stop setting all config as attributes. init_app(\*\*kwargs) can only
468 set forms, flags, and utility classes (see below for compatibility concerns).
469 - (:pr:`873`) Update Spanish and Italian translations. (gissimo)
470 - (:pr:`855`) Improve translations for two-factor method selection. (gissimo)
471 - (:pr:`866`) Improve German translations. (sr-verde)
472 - (:pr:`911`) Remove deprecation of AUTO_LOGIN_AFTER_CONFIRM - it has a reasonable use case.
473 - (:pr:`931`) Update message extraction - note that the CONFIRM_REGISTRATION message was changed to improve
474 readability.
475
476 Fixes
477 +++++
478
479 - (:issue:`845`) us-signin magic link should use fs_uniquifier (not email).
480 - (:issue:`893`) Improve open-redirect vulnerability mitigation. (see below)
481 - (:issue:`875`) user_datastore.create_user has side effects on mutable inputs. (NoRePercussions)
482 - (:pr:`878`) The long deprecated _unauthorized_callback/handler has been removed.
483 - (:issue:`884`) Oauth re-used POST_LOGIN_VIEW which caused confusion. See below for the new configuration and implications.
484 - (:pr:`908`) Improve CSRF documentation and testing. Fix bug where a CSRF failure could
485 return an HTML page even if the request was JSON.
486 - (:issue:`925`) Register with JSON and authentication token failed CSRF. (lilz-egoto)
487 - (:issue:`870`) Fix 2 issues with CSRF configuration.
488 - (:pr:`914`) It was possible that if :data:`SECURITY_EMAIL_VALIDATOR_ARGS` were set that
489 deliverability would be checked even for login.
490
491 Backwards Compatibility Concerns
492 +++++++++++++++++++++++++++++++++
493
494 - Passing in an AnonymousUser class as part of Security initialization has been removed.
495 - The never-public method _get_unauthorized_response has been removed.
496 - Social-Oauth - a new configuration variable :py:data:`SECURITY_POST_OAUTH_LOGIN_VIEW` was introduced
497 and it replaces :py:data:`SECURITY_POST_LOGIN_VIEW` in the oauthresponse logic when
498 :py:data:`SECURITY_REDIRECT_BEHAVIOR` == `"spa"`.
499 - Two-Factor setup. Prior to this release when setting up "SMS" the `/tf-setup` endpoint could
500 be POSTed to w/o a phone number, and then another POST could be made to set the phone number.
501 This has always been confusing and added complexity to the code. Now, if "SMS" is selected, the phone number
502 must be supplied (which has always been supported).
503 Other changes:
504
505 - The default two-factor-setup.html template now has a more generic `"Enter code to complete setup"` message.
506 - Make sure the `"disable"` option first.
507 - Adding any currently configured two-factor method on setup failure.
508 - The two_factor_verify template won't show the rescue form if it isn't set.
509 - A GET on /tf-validate now returns the two-factor-validate-form always - before
510 if the client was validating a new method, it would return the two-factor-setup-form
511 - After successfully disabling two-factor the client is redirected to :py:data:`SECURITY_TWO_FACTOR_POST_SETUP_VIEW`
512 rather than :py:data:`SECURITY_POST_LOGIN_VIEW`.
513
514 - Bring unauthenticated handling completely into Flask-Security:
515 Prior to this release, Flask-Security's :meth:`.Security.unauthn_handler` - called when
516 a request wasn't properly authenticated - handled JSON requests then delegated
517 form responses to Flask-Login's unauthenticated_callback. That logic has been moved
518 into Flask-Security and Flask-Login is configured to call back into Flask-Security's
519 handler. While the logic is very similar the following differences might be observed:
520
521 - Flask-Login's FORCE_HOST_FOR_REDIRECTS configuration isn't honored
522 - Flask-Login's USE_SESSION_FOR_NEXT configuration isn't honored
523 - The flashed message is SECURITY_MSG_UNAUTHENTICATED rather than SECURITY_MSG_LOGIN.
524 Furthermore, SECURITY_MSG_UNAUTHENTICATED was reworded to read better.
525 - Flask-Login uses `urlencode` to encode the `next` query param - which quotes the '/' character.
526 Werkzeug (which Flask-Security uses to build the URL) uses `quote`
527 which considers '/' a safe character and isn't encoded.
528 - The signal sent on an unauthenticated request has changed to :data:`user_unauthenticated`.
529 Flask-Login used to send a `user_unauthorized` signal.
530
531 - Flask-Security no longer configures anything related to Flask-Login's `fresh_login` logic.
532 This shouldn't be used - instead use Flask-Security's :meth:`flask_security.auth_required` decorator.
533 - Support for Flask-Babelex has been removed. Please convert to Flask-Babel.
534 - JSON error response has changed due to issue with WTForms form-level errors. When WTForms
535 introduced form-level errors they added it to the form.errors response using `None` as a key.
536 When serializing it, it would turn into "null". However, if there is more than one error
537 the default settings for JSON serialization in Flask attempt to sort the keys - which fails
538 with the `None` key. An issue has been filed with WTForms - and maybe it will be changed.
539 Flask-Security now changes any `None` key to `""`.
540 - The default unauthorized handler behavior has changed slightly and is now documented. The default
541 (:data:`SECURITY_UNAUTHORIZED_VIEW` == ``None``) has not changed (a default HTTP 403 response).
542 The precise behavior when :data:`SECURITY_UNAUTHORIZED_VIEW` is set was never documented.
543 The important change is that Flask-Security no longer ever looks at the request.referrer header and
544 will never redirect to it. If an application needs that, it can provide a callable that can return
545 that or any other header.
546 - Configuration variables (and other things) are no longer added as attributes on the Security instance.
547 For example `security.username_enable` no longer exists - this could be an issue in code or templates.
548 For templates, Flask places `config` in the Jinja context - so rather than using an attribute, use
549 `config["SECURITY_USERNAME_ENABLE"]` for the example above.
550 - Open Redirect mitigation. Release 4.1.0 had a fix for :issue:`486` involving a potential
551 open redirect. This was very low priority since the default configuration of Werkzeug (always
552 convert the Location header to absolute URL) rendered the vulnerability un-exploitable. The solution at that
553 time was to add an optional regex looking for these bizarre URLs that from a HTTP spec perspective
554 are relative, but various browsers would interpret as absolute. In Werkzeug release 2.1 the
555 default was changed so that the Location header was allowed to be a relative URL. This made the
556 open redirect vulnerability much more likely to be exploitable. More recently, additional bizarre
557 URLs were found, as documented in :issue:`893`. More work was done and a patch release 5.3.3
558 was published. This fix utilized changing the Werkzeug default back to absolute and an updated
559 regex. Comments and thoughts by @gmanfuncky proposed a much better solution and that is in 5.4.
560 This implementation is independent of Werkzeug (and relative Location headers are again the default).
561 The entire regex option has been removed.
562 Instead, any user-supplied path used as a redirect is parsed and quoted.
563
564 Notes
565 ++++++
566 - Historically, the **current_user** proxy (managed by Flask-Login) always pointed to a user object.
567 If the user wasn't authenticated, it pointed to an AnonymousUser object. With this release,
568 setting :py:data:`SECURITY_ANONYMOUS_USER_DISABLED` to `True` will force **current_user** to be set
569 to `None` if the requesting user isn't authenticated. It should be noted that this is in support
570 of a proposal by the Pallets team to remove AnonymousUser from Flask-Login - as well as deprecating
571 the `is_authenticated` property. The default behavior (`False`) should be the same as prior releases.
572 A new function `_fs_is_user_authenticated` is now part of the render_template context that
573 templates can use instead of `current_user.is_authenticated`.
574
575 Version 5.3.3
576 -------------
577
578 Released December 29, 2023
579
580 Fixes
581 +++++
582 - (:issue:`893`) Once again work on open-redirect vulnerability - this time due to newer Werkzeug.
583 Addresses: CVE-2023-49438
584
585 Version 5.3.2
586 -------------
587
588 Released October 23, 2023
589
590 Fixes
591 ++++++
592
593 - (:issue:`859`) Update Quickstart to show how to properly handle SQLAlchemy connections.
594 - (:issue:`861`) Auth Token not returned from /tf-validate. (thanks lilz-egoto)
595 - (:pr:`864`) Fix for latest email_validator deprecation - bump minimum to 2.0.0
596 - (:pr:`865`) Deprecate passing in the anonymous_user class (sent to Flask-Login).
597
598 Version 5.3.1
599 -------------
600
601 Released October 14, 2023
602
603 **Please Note:**
604
605 - If your application uses webauthn you must use pydantic < 2.0
606 until the issue with user_handle is resolved.
607
608 Fixes
609 ++++++
610
611 - (:issue:`847`) Compatability with Flask 3.0 (wangsha)
612 - (:issue:`829`) Revert change in 5.3.0 that added a Referrer-Policy header.
613 - (:issue:`826`) Fix error in quickstart (codycollier)
614 - (:pr:`835`) Update Armenian translations (amkrtchyan-tmp)
615 - (:pr:`831`) Update German translations. (sr-verde)
616 - (:issue:`853`) Fix 'next' propagation when passed as form.next (thanks cariaso)
617
618 Version 5.3.0
619 -------------
620
621 Released July 27, 2023
622
623 This is a minor version bump due to some small backwards incompatible changes to
624 WebAuthn, recoverability (/reset), confirmation (/confirm) and the two factor validity feature.
625
626 Fixes
627 ++++++
628
629 - (:pr:`807`) Webauthn Updates to handling of transport.
630 - (:pr:`809`) Fix MongoDB support by eliminating dependency on flask-mongoengine.
631 Improve MongoDB quickstart.
632 - (:issue:`801`) Fix Quickstart for SQLAlchemy with scoped session.
633 - (:issue:`806`) Login no longer, by default, checks for email deliverability.
634 - (:issue:`791`) Token authentication is no longer accepted on endpoints which only allow
635 'session' as authentication-method. (N247S)
636 - (:issue:`814`) /reset and /confirm and GENERIC_RESPONSES and additional form args don't mix.
637 - (:issue:`281`) Reset password can be exploited and other OWASP improvements.
638 - (:pr:`817`) Confirmation can be exploited and other OWASP improvements.
639 - (:pr:`819`) Convert to pyproject.toml, build, remove setup.py/.cfg.
640 - (:pr:`823`) the tf_validity feature now ONLY sets a cookie - and the token is no longer
641 returned as part of a JSON response.
642 - (:pr:`825`) Fix login/unified signin templates to properly send CSRF token. Add more tests.
643 - (:pr:`826`) Improve Social Oauth example code.
644
645 Backwards Compatibility Concerns
646 +++++++++++++++++++++++++++++++++
647
648 - To align with the W3C WebAuthn Level2 and 3 spec - transports are now part of the registration response.
649 This has been changed BOTH in the server code (using webauthn data structures) as well as the sample
650 JavaScript code. If an application has their own JavaScript front end code - it might need to be changed.
651 - The tf_validity feature :py:data:`SECURITY_TWO_FACTOR_ALWAYS_VALIDATE` used to set a cookie if the request was
652 form based, and return the token as part of a JSON response. Now, this feature is ONLY cookie based and the token
653 is no longer returned as part of any response.
654 - Reset password was changed to adhere to OWASP recommendations and reduce possible exploitation:
655
656 - A new email (with new token) is no longer sent upon expired token. Users must restart
657 the reset password process.
658 - The user is no longer automatically logged in upon successful password reset. For
659 backwards compatibility :py:data:`SECURITY_AUTO_LOGIN_AFTER_RESET` can be set to ``True``.
660 Note that this compatibility feature is deprecated and will be removed in a future release.
661 - Identity information (identity, email) is no longer sent as part of the URL redirect
662 query params.
663 - The SECURITY_MSG_PASSWORD_RESET_EXPIRED message no longer contains the user's identity/email.
664 - The default for :py:data:`SECURITY_RESET_PASSWORD_WITHIN` has been changed from `5 days` to `1 days`.
665 - The response to GET /reset/<token> sets the HTTP header `Referrer-Policy` to `no-referrer` as suggested
666 by OWASP. *PLEASE NOTE: this was backed out in 5.3.1*
667 - Confirm email was changed to adhere to OWASP recommendations and reduce possible exploitation:
668
669 - A new email (with new token) is no longer sent upon expired token. Users must restart
670 the confirmation process.
671 - Identity information (identity, email) is no longer sent as part of the URL redirect
672 query params.
673 - The :py:data:`SECURITY_AUTO_LOGIN_AFTER_CONFIRM` configuration variable now defaults to ``False`` - meaning
674 after a successful email confirmation, the user must still sign in using the usual mechanisms. This is to
675 align better with OWASP best practices. Setting it to ``True`` will restore prior behavior.
676 - The SECURITY_MSG_CONFIRMATION_EXPIRED message no longer contains the user's identity/email.
677 - The response to GET /reset/<token> sets the HTTP header `Referrer-Policy` to `no-referrer` as suggested
678 by OWASP. *PLEASE NOTE: this was backed out in 5.3.1*
679
680 Version 5.2.0
681 -------------
682
683 Released May 6, 2023
684
685 Note: Due to rapid deprecation and removal of APIs from the Pallets team,
686 maintaining the testing of back versions of various packages is taking too
687 much time and effort. In this release only current versions of the various
688 dependent packages are being tested.
689
690 Fixes
691 +++++
692
693 - (:issue:`764`) Remove old Werkzeug compatibility check.
694 - (:issue:`777`) Compatibility with Quart.
695 - (:pr:`780`) Remove dependence on pkg_resources / setuptools (use importlib_resources package)
696 - (:pr:`792`) Fix tests to work with latest Werkzeug/Flask. Update requirements_low to match current releases.
697 - (:pr:`792`) Drop support for Python 3.7
698
699 Known Issues
700 ++++++++++++
701
702 - Flask-mongoengine hasn't released in a while and currently will not work with latest Flask and Flask-Security-Too/Flask-Security
703 (this is due to the JSONEncoder being deprecated and removed).
704
705 Backwards Compatibility Concerns
706 +++++++++++++++++++++++++++++++++
707 - The removal of pkg_resources required changing the config variable :py:data:`SECURITY_I18N_DIRNAME`.
708 If your application modified or extended this configuration variable, a small change will be required.
709
710 Version 5.1.2
711 -------------
712
713 Released March 12, 2023
714
715 Fixes
716 +++++
717
718 - (:issue:`771`) Hungarian translations not working.
719 - (:pr:`769`) Fix documentation for send_mail. (gg)
720 - (:pr:`768`) Fix for latest mongoengine and mongomock.
721 - (:pr:`766`) Fix inappropriate use of &thinsp& in French translations. (maxdup)
722 - (:pr:`773`) Improve documentation around subclassing forms.
723
724 Version 5.1.1
725 -------------
726
727 Released March 1, 2023
728
729 Fixes
730 +++++
731
732 - (:issue:`740`) Fix 2 Flask apps in same thread with USERNAME_ENABLE set.
733 There was a too aggressive config check.
734 - (:pr:`739`) Update Russian translations. (ademaro)
735 - (:pr:`743`) Run all templates through a linter. (ademaro)
736 - (:pr:`757`) Fix json/flask backwards compatibility hack.
737 - (:issue:`759`) Fix quickstarts - make sure they run using `flask run`
738 - (:pr:`755`) Fix unified signup when two-factor not enabled. (sebdroid)
739 - (:pr:`763`) Add dependency on setuptools (pkg_resources). (hroncok)
740
741 Version 5.1.0
742 -------------
743
744 Released January 23, 2023
745
746 Features
747 ++++++++
748
749 - (:issue:`667`) Expose form instantiation. See :ref:`form_instantiation`.
750 - (:issue:`693`) Option to encrypt recovery codes.
751 - (:pr:`716`) Support for authentication via 'social' oauth.
752 - (:pr:`721`) Support for Python 3.11
753
754 Fixes
755 +++++
756
757 - (:pr:`678`) Fixes for Flask-SQLAlchemy 3.0.0. (jrast)
758 - (:pr:`680`) Fixes for sqlalchemy 2.0.0 (jrast)
759 - (:issue:`697`) Webauthn and Unified signin features now properly take into
760 account blueprint prefixes.
761 - (:issue:`699`) Properly propagate `?next=/xx` - the verify, webauthn, and unified
762 signin endpoints, that had multiple redirects, needed fixes.
763 - (:pr:`696`) Add Hungarian translations. (xQwexx)
764 - (:issue:`701`) Two factor redirects ignored url_prefix. Added a :py:data:`SECURITY_TWO_FACTOR_ERROR_VIEW`
765 configuration option.
766 - (:issue:`704`) Add configurations for static folder/URL and make sure templates reference
767 blueprint relative static folder.
768 - (:issue:`709`) Make (some) templates look better by using single quotes instead of
769 double quotes.
770 - (:issue:`690`) Send entire context to MailUtil::send_mail (patrickyan)
771 - (:pr:`728`) Support for Flask-Babel 3.0.0
772 - (:issue:`692`) Add configuration option :py:data:`SECURITY_TWO_FACTOR_POST_SETUP_VIEW` which
773 is redirected to upon successful change of a two factor method.
774 - (:pr:`733`) The ability to pass in a LoginManager instance which was deprecated in
775 5.0 has been removed.
776 - (:issue:`732`) If :py:data:`SECURITY_USERNAME_REQUIRED` was ``True`` then users couldn't login
777 with just an email.
778 - (:issue:`734`) If :py:data:`SECURITY_USERNAME_ENABLE` is set, bleach is a requirement.
779 - (:pr:`736`) The unauthz_handler now takes a function name, not the function!
780
781 Backwards Compatibility Concerns
782 +++++++++++++++++++++++++++++++++
783
784 - Each form class used to be set as an attribute on the Security object. With
785 the new form instantiation model, they no longer are.
786 - After a successful update/change of a two-factor method, the user was redirected to
787 :py:data:`SECURITY_POST_LOGIN_VIEW`. Now it redirects to :py:data:`SECURITY_TWO_FACTOR_POST_SETUP_VIEW`
788 which defaults to `".two_factor_setup"`.
789 - The :meth:`.Security.unauthz_handler` now takes a function name - not the function -
790 which never made sense.
791
792 Version 5.0.2
793 -------------
794
795 Released September 23, 2022
796
797 Fixes
798 +++++
799 - (:issue:`673`) Role permissions backwards compatibility bug. For SQL based datastores
800 that use Flask-Security's models.fsqla_vx - there should be NO issues. If you declare
801 your own models - please see the 5.0.0 releases notes for required change.
802
803 Version 5.0.1
804 -------------
805
806 Released September 6, 2022
807
808 Fixes
809 +++++
810 - (:pr:`662`) Fix Change Password regression. (tysonholub)
811
812 Version 5.0.0
813 -------------
814
815 Released August 27, 2022
816
817 **PLEASE READ CHANGE NOTES CAREFULLY - THERE ARE LIKELY REQUIRED CHANGES YOU WILL HAVE TO MAKE.**
818
819 Features
820 ++++++++
821 - (:issue:`475`) Support for WebAuthn.
822 - (:issue:`479`) Support Two-factor recovery codes.
823 - (:issue:`585`) Provide option to prevent user enumeration (i.e. Generic Responses).
824 - (:pr:`532`) Support for Python 3.10.
825 - (:pr:`657`, :pr:`655`) Support for Flask >= 2.2.
826 - (:pr:`540`) Improve Templates in support of JS required by WebAuthn.
827 - (:pr:`608`) Add Icelandic translations. (ofurkusi)
828 - (:pr:`650`) Update German translations. (sr-verde)
829 - (:issue:`256`) Add custom HTML attributes to improve user experience.
830 This changed LoginForm quite a bit - please see backwards compatability concerns
831 below. The default LoginForm and template should be the same as before.
832 - (:pr:`638`) The JSON errors response has been unified. Please see backwards
833 compatibility concerns below.
834 - Updated all-inclusive data models (fsqla_v3). Add fields necessary for the new WebAuthn and
835 Two-Factor recovery codes features.
836 Changed `us_phone_number` to be unique (but not required). Changed `password` to be nullable.
837
838 Deprecations
839 ++++++++++++
840 - (:pr:`568`) Deprecate the old passwordless feature in favor of Unified Signin.
841 - (:pr:`568`) Deprecate replacing login_manager so we can possibly vendor that in in the future.
842 - (:pr:`654`) The previously deprecated methods RoleMixin.add_permissions and
843 RoleMixin.remove_permissions have been removed.
844 - (:pr:`657`) The ability to pass in a json_encoder_cls as part of initialization has been removed
845 since Flask 2.2 has deprecated and replaced that functionality.
846 - (:pr:`655`) Flask has deprecated @before_first_request. This was used mostly in examples/quickstart.
847 These have been changed to use app.app_context() prior to running the app. Flask-Security itself used it in
848 2 places - to populate `_` in jinja globals if Babel wasn't initialized and to perform
849 various configuration sanity checks w.r.t. WTF CSRF. All Flask-Security templates have been converted
850 to use `_fsdomain` rather than ``_`` so Flask-Security no longer sets ``_`` into jinja2 globals.
851 The configuration checks
852 have been moved to the end of Security::init_app() - so it is now imperative that `FlaskWTF::CSRFProtect()`
853 be called PRIOR to initializing Flask-Security.
854 - encrypt_password method has been removed. It has been deprecated since 2.0.2
855 - get_token_status has been deprecated.
856
857 Fixes
858 +++++
859 - (:pr:`591`) Make the required zxcvbn complexity score configurable. (mephi42)
860 - (:issue:`531`) Get rid of Flask-Mail. Flask-Mailman is now the default preferred email package.
861 Flask-Mail is still supported so there should be no backwards compatability issues.
862 - (:issue:`597`) A delete option has been added to us-setup (form and view).
863 - (:pr:`625`) Improve username support - the LoginForm now has a separate field for username if
864 ``SECURITY_USERNAME_ENABLE`` is True, and properly displays input fields only if the associated
865 field is an identity attribute (as specified by :py:data:`SECURITY_USER_IDENTITY_ATTRIBUTES`).
866 - (:pr:`627`) Improve empty password handling. Prior, an unguessable password was set into the user
867 record when a user registered without a password - now, the DB user model has been changed to
868 allow nullable passwords. This provides a better user experience since Flask-Security now
869 knows if a user has an empty password or not. Since registering without a password is not
870 a mainstream feature, a new configuration variable :py:data:`SECURITY_PASSWORD_REQUIRED`
871 has been added (defaults to ``True``).
872 - (:issue:`479`) A new configuration option :py:data:`SECURITY_TWO_FACTOR_RESCUE_EMAIL` has been added
873 that allows disabling that feature - defaults to backwards compatible ``True``
874 - (:issue:`658`) us_phone_number needs to be validated to be unique.
875
876
877 Backward Compatibility Concerns
878 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
879
880 For unified signin:
881
882 - The redirect after a successful us-setup used to redirect to ``SECURITY_US_POST_SETUP_VIEW`` or
883 ``SECURITY_POST_LOGIN_VIEW`` (which would default to '/'). Now it just redirects to
884 ``SECURITY_US_POST_SETUP_VIEW`` which defaults back to the ``/us-setup`` view.
885 - The ability to authenticate using a one-time email link was automatically setup by the system
886 for all users.
887 "email" now behaves like the other unified sign in methods and must be explicitly set up - with the
888 exception that if a user registers WITHOUT a password, the system will setup the one-time email link
889 option - since otherwise the user would never be able to authenticate.
890 - ``/us-signin/send-code`` didn't used to check if the user account required confirmation it just sent a code
891 and the ``/us-signin`` endpoint did the confirmation check. Now ``send-code`` does the confirmation check and
892 won't send a code unless the user is confirmed.
893 - In ``us-verify`` the 'code_methods' item now lists just active/setup methods that generate a code
894 not ALL possible methods that generate a code.
895 - ``SECURITY_US_VERIFY_SEND_CODE_URL`` and ``SECURITY_US_SIGNIN_SEND_CODE_URL`` endpoints are now POST only.
896 - Empty passwords were always permitted when ``SECURITY_UNIFIED_SIGNIN`` was enabled - now an additional configuration
897 variable ``SECURITY_PASSWORD_REQUIRED`` must be set to False.
898 - ``SECURITY_US_VERIFY_SEND_CODE_URL`` and ``SECURITY_US_SIGNIN_SEND_CODE_URL`` used to send ``code_sent`` to the template.
899 Now they flash the ``SECURITY_MSG_CODE_HAS_BEEN_SENT`` message.
900 - With the addition of being able to delete a previously setup up sign in method, the signal `us_profile_changed` arguments
901 have changed. `method` is now `methods` and is a list, and a new argument `delete` is True if a sign in option was deleted.
902
903 Login:
904
905 - Since the beginning of time, the flask-security login form has accepted any input in the
906 'email' field, and used that to check if it corresponds to any field in ``SECURITY_USER_IDENTITY_ATTRIBUTES``.
907 This has always been problematic and confusing - and with the addition of HTML attributes for various
908 form fields - having a field with multiple possible inputs is no longer a viable user experience.
909 This is no longer supported, and the LoginForm now declares the ``email`` field to be of type ``EmailField``
910 which requires a valid (after normalization) email address. The most common usage of this legacy feature was to allow
911 an email or username - Flask-Security now has core support for a ``username`` option - see :py:data:`SECURITY_USERNAME_ENABLE`.
912 Please see :ref:`custom_login_form` for an example of how to replicate the legacy behavior.
913 - Some error messages have changed - ``USER_DOES_NOT_EXIST`` is now returned for any identity error including an empty value.
914
915 Other:
916
917 - A very old piece of code in registrable, would immediately commit to the DB when a new user was created.
918 It is now consistent with all other views, and has the caller responsible for committing the transaction - usually by
919 setting up a flask ``after_this_request`` action. This could affect an application that captured the registration signal
920 and stored the ``user`` object for later use - this user object would likely be invalid after the request is finished.
921 - Some fields have custom HTML attributes attached to them (e.g. autocomplete, type, etc). These are stored as part of the
922 form in the ``render_kw`` attribute. This could cause some confusion if an app had its own templates and set different
923 attributes.
924 - The keys for "/tf-rescue" select options have changed to be more 'action' oriented:
925
926 - `lost_device` -> `email`
927 - `no_mail_access` -> `help`
928 - JSON error responses. **THIS IS A BREAKING CHANGE**.
929 In earlier releases, the JSON error response could have either a `error` key which was for rare cases
930 where there was a single non-form related error, or an `errors` key which was a a dict as defined by WTForms.
931 Now, the `errors` key will contain a list of (localized) messages - both non-form related as well as any form related.
932 The key `field_errors` will contain the dict as specified by WTForms. Please note that starting with WTForms 3.0
933 form-level errors are supported and show up in the dict with the field name/key of "none". There are no changes to non-error
934 related JSON responses.
935 - Permissions **THIS IS A BREAKING CHANGE**. The Role Model now stores permissions as a list, and requires that the underlying DB ORM map that to a supported
936 DB type. For SQLAlchemy, this is mapped to a comma separated string (as before). For
937 SQLAlchemy DBs the underlying Column type (UnicodeText) didn't change so no data migration should be required.
938 However, the ORM Column type did change and requires the following change to your model::
939
940 from flask_security import AsaList
941 from sqlalchemy.ext.mutable import MutableList
942 class Role(Base, RoleMixin):
943 ...
944 permissions = Column(MutableList.as_mutable(AsaList()), nullable=True)
945 ...
946
947 If your application makes use of Flask-Security's models.fsqla_vX classes - no changes are required.
948 For Mongo, a ListField can be directly used.
949 - CSRF - As mentioned above, it is now required that `FlaskWTF::CSRFProtect()`, if used, must be called PRIOR to initializing Flask-Security.
950 - json_encoder_cls - As mentioned above - Flask-Security initialization no longer accepts overriding the json_encoder class. If this is required,
951 update to Flask >=2.2 and implement Flask's JSONProvider interface.
952
953 For templates:
954
955 - Pretty much every template was modified to replace <p> with <div class=xx> to make
956 styling possible and to make more complex forms more readable.
957 - Many forms had places where things weren't properly localizable - that has (hopefully) been fixed.
958 - The ``us_setup.html`` template was modified to add ability to delete an existing set up method.
959
960 DB Migration
961 ~~~~~~~~~~~~
962
963 To use the new WebAuthn feature a new table and two new columns in the User model are required.
964 To ease updates - Flask-Security will automatically create a fs_webauthn_user_handle
965 upon first use for existing users.
966 If you are using Alembic the schema migration is easy::
967
968 op.add_column('user', sa.Column('fs_webauthn_user_handle', sa.String(length=64), nullable=True, unique=True))
969
970
971 If you want to allow for empty passwords as part of registration then set :py:data:`SECURITY_PASSWORD_REQUIRED` to ``False``.
972 In addition you need to change your DB schema to allow the ``password`` field to be nullable.
973
974 Version 4.1.5
975 -------------
976
977 Released July 28, 2022
978
979 Fixes
980 +++++
981 - (:pr:`644`) Fix test and other failures with newer Flask-Login/Werkzeug versions.
982
983 Version 4.1.4
984 -------------
985
986 Released April 19, 2022
987
988 Fixes
989 +++++
990 - (:issue:`594`) Fix test failures with newer Flask versions.
991
992 Version 4.1.3
993 -------------
994
995 Released March 2, 2022
996
997 Fixes
998 +++++
999 - (:issue:`581`) Fix bug when attempting to disable register_blueprint. (halali)
1000 - (:pr:`539`) Fix example documentation re: generating localized messages. (kazuhei2)
1001 - (:pr:`546`) Make roles joinedload compatible with SQLAlchemy 2.0. (keats)
1002 - (:pr:`586`) Ship py.typed as part of package.
1003 - (:issue:`580`) Improve documentation around use of bleach and include in common install extra.
1004
1005 Version 4.1.2
1006 -------------
1007
1008 Released September 22, 2021
1009
1010 Fixes
1011 +++++
1012 - (:issue:`526`) default_reauthn_handler doesn't honor SECURITY_URL_PREFIX
1013 - (:pr:`528`) Improve German translations (sr-verde)
1014 - (:pr:`527`) Fix two-factor sample code (djpnewton)
1015
1016 Version 4.1.1
1017 --------------
1018
1019 Released September 10, 2021
1020
1021 Fixes
1022 +++++
1023 - (:issue:`518`) Fix corner case where Security object was being reused in tests.
1024 - (:issue:`512`) If USERNAME_ENABLE is set, change LoginForm field from EmailField
1025 to StringField. Also - dynamically add fields to Login and Registration forms
1026 rather than always having them - this made the RegistrationForm much simpler.
1027 - (:issue:`516`) Improved username feature handling solved issue of always requiring
1028 bleach.
1029 - (:issue:`513`) Improve documentation of default username validation.
1030
1031 Version 4.1.0
1032 -------------
1033
1034 Released July 23, 2021
1035
1036 Features
1037 ++++++++
1038 - (:issue:`474`) Add public API and CLI command to change a user's password.
1039 - (:issue:`140`) Add type hints. Please note that many of the packages that flask-security
1040 depends on aren't typed yet - so there are likely errors in some of the types.
1041 - (:issue:`466`) Add first-class support for using username for signing in.
1042
1043 Fixes
1044 +++++
1045 - (:issue:`483`) 4.0 doesn't accept 3.4 authentication tokens. (kuba-lilz)
1046 - (:issue:`490`) Flask-Mail sender name can be a tuple. (hrishikeshrt)
1047 - (:issue:`486`) Possible open redirect vulnerability.
1048 - (:pr:`478`) Improve/update German translation. (sr-verde)
1049 - (:issue:`488`) Improve handling of Babel packages.
1050 - (:pr:`496`) Documentation improvements, distribution extras, fix single message
1051 override.
1052 - (:issue:`497`) Improve cookie handling and default ``samesite`` to ``Strict``.
1053
1054 Backwards Compatibility Concerns
1055 +++++++++++++++++++++++++++++++++
1056 - (:pr:`488`) In 4.0.0, with the addition of Flask-Babel support, Flask-Security enforced that
1057 if it could import either Flask-Babel or Flask-BabelEx, that those modules had
1058 been initialized as proper Flask extensions. Prior to 4.0.0, just Flask-BabelEx
1059 was supported - and that didn't require any explicit initialization. Flask-Babel
1060 DOES require explicit initialization. However for some applications that don't
1061 completely control their environment (such as system pre-installed versions of
1062 python) this caused applications that didn't even want translation services to
1063 fail on startup. With this release, Flask-Security still attempts to import
1064 one or the other package - however if those modules are NOT initialized,
1065 Flask-Security will simply ignore them and no translations will occur.
1066 - (:issue:`497`) The CSRF_COOKIE and TWO_FACTOR_VALIDITY cookie had their defaults
1067 changed to set ``samesite=Strict``. This follows the Flask-Security goal of
1068 making things more secure out-of-the-box.
1069 - (:issue:`140`) Type hinting. For the most part this of course has no runtime effects.
1070 However, this required a fairly major overhaul of how Flask-Security is initialized in
1071 order to provide valid types for the many constructor attributes. There are no known
1072 compatability concerns - however initialization used to convert all arguments into kwargs
1073 then add those as attributes and merge with application constants. That no longer happens
1074 and it is possible that some corner cases don't behave precisely as they did before.
1075
1076 Version 4.0.1
1077 -------------
1078
1079 Released April 2, 2021
1080
1081 Features
1082 ++++++++
1083
1084 Fixes
1085 +++++
1086 - (:issue:`461`) 4.0 doesn't accept 3.4 authentication tokens. (kuba-lilz)
1087 - (:issue:`460`) 2-fa error: Failed to send code - improved documentation and debuggability.
1088 - (:issue:`454`) 2-fa error: TypeError - fixed documentation.
1089 - (:issue:`443`) Calling create user without any arguments - fixed underlying cause
1090 of translating form errors in the CLI.
1091 - (:issue:`442`) Email validation confusion - added documentation.
1092 - (:issue:`450`) Add documentation on how to override specific error messages.
1093 - (:pr:`439`) Don't install global-scope tests. (mgorny)
1094 - (:pr:`470`) Add note about updating DB using MySQL. (jugmac00)
1095 - (:pr:`468`) Fix documentation - uia_phone_number should be uia_phone_mapper. (dvrg)
1096 - (:pr:`457`) Improve chinese translations. (zxjlm)
1097 - (:pr:`453`) Improve basque and spanish translations. (mmozos)
1098 - (:pr:`448`) Add Afrikaans translations. (lonelyvikingmichael)
1099 - (:pr:`467`) Add Blinker as explicit dependency, improve/fix celery usage docs,
1100 dont require pyqrcode unless authenticator configured, improve SMS configuration
1101 variables documentation.
1102
1103
1104
1105 Version 4.0.0
1106 -------------
1107
1108 Released January 26, 2021
1109
1110 **PLEASE READ CHANGE NOTES CAREFULLY - THERE ARE LIKELY REQUIRED CHANGES YOU WILL HAVE TO MAKE TO EVEN START YOUR APPLICATION WITH 4.0**
1111
1112 Start Here
1113 +++++++++++
1114 - Your UserModel must contain ``fs_uniquifier``
1115 - Either uninstall Flask-BabelEx (if you don't need translations) or add either Flask-Babel (>=2.0) or Flask-BabelEx to your
1116 dependencies AND be sure to initialize it in your app.
1117 - Add Flask-Mail to your dependencies.
1118 - If you have unicode emails or passwords read change notes below.
1119
1120 Version 4.0.0rc2
1121 ----------------
1122
1123 Released January 18, 2021
1124
1125 Features & Cleanup
1126 +++++++++++++++++++
1127 - Removal of python 2.7 and <3.6 support
1128 - Removal of token caching feature (a relatively new feature that had some systemic issues)
1129 - (:pr:`328`) Remove dependence on Flask-Mail and refactor.
1130 - (:pr:`335`) Remove two-factor `/tf-confirm` endpoint and use generic `freshness` mechanism.
1131 - (:pr:`336`) Remove ``SECURITY_BACKWARDS_COMPAT_AUTH_TOKEN_INVALID(ATE)``. In addition to
1132 not making sense - the documentation has never been correct.
1133 - (:pr:`339`) Require ``fs_uniquifier`` in the UserModel and stop using/referencing the UserModel
1134 primary key.
1135 - (:pr:`349`) Change ``SECURITY_USER_IDENTITY_ATTRIBUTES`` configuration variable semantics.
1136 - Remove (all?) requirements around having an 'email' column in the UserModel. API change -
1137 JSON SPA redirects used to always include a query param 'email=xx'. While that is still sent
1138 (if and only if) the UserModel contains an 'email' columns, a new query param 'identity' is returned
1139 which returns the value of :meth:`.UserMixin.calc_username()`.
1140 - (:pr:`382`) Improvements and documentation for two-factor authentication.
1141 - (:pr:`394`) Add support for email validation and normalization (see :class:`.MailUtil`).
1142 - (:issue:`231`) Normalize unicode passwords (see :class:`.PasswordUtil`).
1143 - (:issue:`391`) Option to redirect to `/confirm` if user hits an endpoint that requires
1144 confirmation. New option :py:data:`SECURITY_REQUIRES_CONFIRMATION_ERROR_VIEW` which if set and the user
1145 hits the `/login`, `/reset`, or `/us-signin` endpoint, and they require confirmation the response will be a redirect. (SnaKyEyeS)
1146 - (:issue:`366`) Allow redirects on sub-domains. Please see :py:data:`SECURITY_REDIRECT_ALLOW_SUBDOMAINS`. (willcroft)
1147 - (:pr:`376`) Have POST redirects default to Flask's ``APPLICATION_ROOT``. Previously the default configuration was ``/``.
1148 Now it first looks at Flask's `APPLICATION_ROOT` configuration and uses that (which also by default is ``/``. (tysonholub)
1149 - (:pr:`401`) Add 2FA Validity Window so an application can configure how often the second factor has to be entered. (baurt)
1150 - (:pr:`403`) Add HTML5 Email input types to email fields. This has some backwards compatibility concerns outlined below. (drola)
1151 - (:pr:`413`) Add hy_AM translations. (rudolfamirjanyan)
1152 - (:pr:`410`) Add Basque and fix Spanish translations. (mmozos)
1153 - (:pr:`408`) Polish translations. (kamil559)
1154 - (:pr:`390`) Update ru_RU translations. (TitaniumHocker)
1155
1156 Fixed
1157 +++++
1158 - (:issue:`389`) Fixes for translations. First - email subjects were never being translated. Second, converted
1159 all templates to use _fsdomain(xx) rather than _(xx) so that they get translated regardless of the app's domain.
1160 - (:issue:`381`) Support Flask-Babel 2.0 which has backported Domain support. Flask-Security now supports
1161 Flask-Babel (>=2.00), Flask-BabelEx, as well as no translation support. Please see backwards compatibility notes below.
1162 - (:pr:`352`) Fix issue with adding/deleting permissions - all mutating methods must be at the datastore layer so that
1163 db.put() can be called. Added :meth:`.UserDatastore.add_permissions_to_role` and :meth:`.UserDatastore.remove_permissions_from_role`.
1164 The methods `.RoleMixin.add_permissions` and `.RoleMixin.remove_permissions` have been deprecated.
1165 - (:issue:`395`) Provide ability to change table names for User and Role tables in the fsqla model.
1166 - (:issue:`338`) All sessions are invalidated when a user changes or resets their password. This is accomplished by
1167 changing the user's `fs_uniquifier`. The user is automatically re-logged in (and a new session
1168 created) after a successful change operation.
1169 - (:issue:`418`) Two-factor (and to a lesser extent unified sign in) QRcode fetching wasn't protected via CSRF. The
1170 fix makes things secure and simpler (always good); however read below for compatibility concerns. In addition, the elements that make up the QRcode (key, username, issuer) area also made available to the form
1171 and returned as part of the JSON return value - this allows for manual or other ways to initialize the authenticator
1172 app.
1173 - (:issue:`421`) GET on `/login` and `/change` could return the callers authentication_token. This is a security
1174 concern since GETs don't have CSRF protection. This bug was introduced in 3.3.0.
1175
1176 Backwards Compatibility Concerns
1177 +++++++++++++++++++++++++++++++++
1178 - (:pr:`328`) Remove dependence on Flask-Mail and refactor. The ``send_mail_task`` and
1179 ``send_mail`` methods as part of Flask-Security initialization
1180 have been removed and replaced with a new :class:`.MailUtil` class.
1181 The utility method :func:`.send_mail` can still be used.
1182 If your application didn't use either of the deprecated methods, then the only change required
1183 is to add Flask-Mail to your package requirements (since Flask-Security no longer lists it).
1184 Please see the :ref:`emails_topic` for updated examples.
1185
1186 - (:pr:`335`) Convert two-factor setup flow to use the freshness feature rather than
1187 its own verify password endpoint. This COMPLETELY removes the ``/tf-confirm`` endpoint
1188 and associated form: ``two_factor_verify_password_form``. Now, when /tf-setup is invoked,
1189 the :meth:`flask_security.check_and_update_authn_fresh` is invoked, and if the current session isn't 'fresh'
1190 the caller will be redirected to a verify endpoint (either :py:data:`SECURITY_VERIFY_URL` or
1191 :py:data:`SECURITY_US_VERIFY_URL`). The simplest change would be to call ``/verify`` everywhere
1192 the application used to call ``/tf-confirm``.
1193
1194 - (:pr:`339`) Require ``fs_uniquifier``. In 3.3 the ``fs_uniquifier`` was added in the UserModel to fix
1195 the slow authentication token issue. In 3.4 the ``fs_uniquifier`` was used to implement Flask-Login's
1196 `Alternative Token` feature - thus decoupling the primary key (id) from any security context.
1197 All along, there have been a few issues with applications not wanting to use the name 'id' in their
1198 model, or wanting a different type for their primary key. With this change, Flask-Security no longer
1199 interprets or uses the UserModel primary key - just the ``fs_uniquifier`` field. See the changes section for 3.3
1200 for information on how to do the schema and data upgrades required to add this field. There is also an API change -
1201 the JSON response (via UserModel.get_security_payload()) returned the ``user.id`` field. With this change
1202 the default is an empty directory - override :meth:`.UserMixin.get_security_payload()` to return any portion of the UserModel you need.
1203
1204 - (:pr:`349`) :py:data:`SECURITY_USER_IDENTITY_ATTRIBUTES` has changed syntax and semantics. It now contains
1205 the combined information from the old ``SECURITY_USER_IDENTITY_ATTRIBUTES`` and the newly introduced in 3.4 :py:data:`SECURITY_USER_IDENTITY_MAPPINGS`.
1206 This enabled changing the underlying way we validate credentials in the login form and unified sign in form.
1207 In prior releases we simply tried to look up the form value as the PK of the UserModel - this often failed and then
1208 looped through the other ``SECURITY_USER_IDENTITY_ATTRIBUTES``. This had a history of issues, including many applications not
1209 wanting to have a standard PK for the user model. Now, using the mapping configuration, the UserModel attribute/column the input
1210 corresponds to is determined, then the UserModel is queried specifically for that *attribute:value* pair. If you application
1211 didn't change the variable, no modifications are required.
1212
1213 - (:pr:`354`) The :class:`flask_security.PhoneUtil` is now initialized as part of Flask-Security initialization rather than
1214 ``@app.before_first_request`` (since that broke the CLI). Since it isn't called in an application context, the *app* being initialized is
1215 passed as an argument to *__init__*.
1216
1217 - (:issue:`381`) When using Flask-Babel (>= 2.0) it is required that the application initialize Flask-Babel (e.g. Babel(app)).
1218 Flask-BabelEx would self-initialize so it didn't matter. Flask-Security will throw a run time error upon first request if Flask-Babel
1219 OR FLask-BabelEx
1220 is installed, but not initialized. Also, Flask-Security no longer has a dependency on either Flask-Babel or Flask-BabelEx - if neither
1221 are installed, it falls back to a dummy translation. *If your application expects translation services, it must specify the appropriate*
1222 *dependency AND initialize it.*
1223
1224 - (:pr:`394`) Email input is now normalized prior to being stored in the DB. Previously, it was validated, but the raw input
1225 was stored. Normalization and validation rely on the `email_validator <https://pypi.org/project/email-validator/>`_ package.
1226 The :class:`.MailUtil` class provides the interface for normalization and validation - allowing all this to be customized.
1227 If you have unicode local or domain parts - existing users may have difficulties logging in. Administratively you need to
1228 read each user record, normalize the email (see :class:`.MailUtil`), and write it back.
1229
1230 - (:issue:`381`) Passwords are now, by default, normalized using Python's unicodedata.normalize() method.
1231 The :py:data:`SECURITY_PASSWORD_NORMALIZE_FORM` defaults to "NKFD". This brings Flask-Security
1232 in line with the NIST recommendations outlined in `Memorized Secret Verifiers <https://pages.nist.gov/800-63-3/sp800-63b.html#sec5>`_
1233 If your users have unicode passwords
1234 they may have difficulty authenticating. You can turn off this normalization or have your users reset their passwords.
1235 Password normalization and validation has been encapsulated in a new :class:`.PasswordUtil` class. This replaces
1236 the method ``password_validator`` introduced in 3.4.0.
1237
1238 - (:pr:`403`) By default all forms that have an email as input now use the wtforms html5 ``EmailField``. For most applications this will
1239 make the user experience slightly nicer - especially for mobile devices. Some applications use the email form field for other
1240 identity attributes (such as username). If your application does this you will probably need to subclass ``LoginForm`` and change
1241 the email type back to StringField.
1242
1243 - (:issue:`338`) By default, both passwords and authentication tokens use the same attribute ``fs_uniquifier`` to
1244 uniquely identify the user. This means that if the user changes or resets their password, all authentication tokens
1245 also become invalid. This could be viewed as a feature or a bug. If this behavior isn't desired, add another
1246 uniquifier: ``fs_token_uniquifier`` to your UserModel and that will be used to generate authentication tokens.
1247
1248 - (:issue:`418`) Fix CSRF vulnerability w.r.t. getting QRcodes. Both two-factor and unified-signup had a separate
1249 GET endpoint to fetch the QRcode when setting up an authenticator app. GETS don't have any CSRF protection. Both
1250 of those endpoints have been completely removed, and the QRcode is embedded in a successful POST of the setup form.
1251 The changes to the templates are minimal and of course if you didn't override the template - there is no
1252 compatibility concern.
1253
1254 - (:issue:`421`) Fix CSRF vulnerability on `/login` and `/change` that could return the callers authentication token.
1255 Now, callers can only get the authentication token on successful POST calls.
1256
1257 Version 3.4.5
1258 --------------
1259
1260 Released January 8, 2021
1261
1262 Security Vulnerability Fix.
1263
1264 Two CSRF vulnerabilities were reported: `qrcode`_ and `login`_. This release
1265 fixes the more severe of the 2 - the `/login` vulnerability. The QRcode issue
1266 has a much smaller risk profile since a) it is only for two-factor authentication
1267 using an authenticator app b) the qrcode is only available during the time
1268 the user is first setting up their authentication app.
1269 The QRcode issue has been fixed in 4.0.
1270
1271 .. _qrcode: https://github.com/pallets-eco/flask-security/issues/418
1272 .. _login: https://github.com/pallets-eco/flask-security/issues/421
1273
1274 Fixed
1275 +++++
1276
1277 - (:issue:`421`) GET on `/login` and `/change` could return the callers authentication_token. This is a security
1278 concern since GETs don't have CSRF protection. This bug was introduced in 3.3.0.
1279
1280 Backwards Compatibility Concerns
1281 ++++++++++++++++++++++++++++++++
1282
1283 - (:issue:`421`) Fix CSRF vulnerability on `/login` and `/change` that could return the callers authentication token.
1284 Now, callers can only get the authentication token on successful POST calls.
1285
1286 Version 3.4.4
1287 --------------
1288
1289 Released July 27, 2020
1290
1291 Bug/regression fixes.
1292
1293 Fixed
1294 +++++
1295
1296 - (:issue:`359`) Basic Auth broken. When the unauthenticated handler was changed to provide a more
1297 uniform/consistent response - it broke using Basic Auth from a browser, since it always redirected rather than
1298 returning 401. Now, if the response headers contain ``WWW-Authenticate``
1299 (which is set if ``basic`` @auth_required method is used), a 401 is returned. See below
1300 for backwards compatibility concerns.
1301
1302 - (:pr:`362`) As part of figuring out issue 359 - a redirect loop was found. In release 3.3.0 code was put
1303 in to redirect to :py:data:`SECURITY_POST_LOGIN_VIEW` when GET or POST was called and the caller was already authenticated. The
1304 method used would honor the request ``next`` query parameter. This could cause redirect loops. The pre-3.3.0 behavior
1305 of redirecting to :py:data:`SECURITY_POST_LOGIN_VIEW` and ignoring the ``next`` parameter has been restored.
1306
1307 - (:issue:`347`) Fix peewee. Turns out - due to lack of unit tests - peewee hasn't worked since
1308 'permissions' were added in 3.3. Furthermore, changes in 3.4 around get_id and alternative tokens also
1309 didn't work since peewee defines its own `get_id` method.
1310
1311 Compatibility Concerns
1312 ++++++++++++++++++++++
1313
1314 In 3.3.0, :meth:`flask_security.auth_required` was changed to add a default argument if none was given. The default
1315 include all current methods - ``session``, ``token``, and ``basic``. However ``basic`` really isn't like the others
1316 and requires that we send back a ``WWW-Authenticate`` header if authentication fails (and return a 401 and not redirect).
1317 ``basic`` has been removed from the default set and must once again be explicitly requested.
1318
1319 Version 3.4.3
1320 -------------
1321
1322 Released June 12, 2020
1323
1324 Minor fixes for a regression and a couple other minor changes
1325
1326 Fixed
1327 +++++
1328
1329 - (:issue:`340`) Fix regression where tf_phone_number was required, even if SMS wasn't configured.
1330 - (:pr:`342`) Pick up some small documentation fixes from 4.0.0.
1331
1332 Version 3.4.2
1333 -------------
1334
1335 Released May 2, 2020
1336
1337 Only change is to move repo to the Flask-Middleware github organization.
1338
1339 Version 3.4.1
1340 --------------
1341
1342 Released April 22, 2020
1343
1344 Fix a bunch of bugs in new unified sign in along with a couple other major issues.
1345
1346 Fixed
1347 +++++
1348 - (:issue:`298`) Alternative ID feature ran afoul of postgres/psycopg2 finickiness.
1349 - (:issue:`300`) JSON 401 responses had WWW-Authenticate Header attached - that caused
1350 browsers to pop up their own login/password form. Not what applications want.
1351 - (:issue:`280`) Allow admin/api to setup TFA (and unified sign in) out of band.
1352 Please see :meth:`.UserDatastore.tf_set`, :meth:`.UserDatastore.tf_reset`,
1353 :meth:`.UserDatastore.us_set`, :meth:`.UserDatastore.us_reset` and
1354 :meth:`.UserDatastore.reset_user_access`.
1355 - (:pr:`305`) We used form._errors which wasn't very pythonic, and it was
1356 removed in WTForms 2.3.0.
1357 - (:pr:`310`) WTForms 2.3.0 made email_validator optional - we need it.
1358
1359
1360 Version 3.4.0
1361 -------------
1362
1363 Released March 31, 2020
1364
1365 Features
1366 ++++++++
1367 - (:pr:`257`) Support a unified sign in feature. Please see :ref:`configuration:unified signin`.
1368 - (:pr:`265`) Add phone number validation class. This is used in both unified sign in
1369 as well as two-factor when using ``sms``.
1370 - (:pr:`274`) Add support for 'freshness' of caller's authentication. This permits endpoints
1371 to be additionally protected by ensuring a recent authentication.
1372 - (:issue:`99`, :issue:`195`) Support pluggable password validators. Provide a default
1373 validator that offers complexity and breached support.
1374 - (:issue:`266`) Provide interface to two-factor send_token so that applications
1375 can provide error mitigation. Defaults to returning errors if can't send the verification code.
1376 - (:pr:`247`) Updated all-inclusive data models (fsqlaV2). Add fields necessary for the new unified sign in feature
1377 and changed 'username' to be unique (but not required).
1378 - (:pr:`245`) Use fs_uniquifier as the default Flask-Login 'alternative token'. Basically
1379 this means that changing the fs_uniquifier will cause outstanding auth tokens, session and remember me
1380 cookies to be invalidated. So if an account gets compromised, an admin can easily stop access. Prior to this
1381 cookies were storing the 'id' which is the user's primary key - difficult to change! (kishi85)
1382
1383 Fixed
1384 +++++
1385 - (:issue:`273`) Don't allow reset password for accounts that are disabled.
1386 - (:issue:`282`) Add configuration that disallows GET for logout. Allowing GET can
1387 cause some denial of service issues. The default still allows GET for backwards
1388 compatibility. (kantorii)
1389 - (:issue:`258`) Reset password wasn't integrated into the two-factor feature and therefore
1390 two-factor auth could be bypassed.
1391 - (:issue:`254`) Allow lists and sets as underlying permissions. (pffs)
1392 - (:issue:`251`) Allow a registration form to have additional fields that aren't part of the user model
1393 that are just passed to the user_registered.send signal, where the application can perform arbitrary
1394 additional actions required during registration. (kuba-lilz)
1395 - (:issue:`249`) Add configuration to disable the 'role-joining' optimization for SQLAlchemy. (pffs)
1396 - (:issue:`238`) Fix more issues with atomically setting the new TOTP secret when setting up two-factor. (kishi85)
1397 - (:pr:`240`) Fix Quart Compatibility. (ristellise)
1398 - (:issue:`232`) CSRF Cookie not being set when using 'Remember Me' cookie to re-sign in. (kishi85)
1399 - (:issue:`229`) Two-factor enabled accounts didn't work with the Remember Me feature. (kishi85)
1400
1401 As part of adding unified sign in, there were many similarities with two-factor.
1402 Some refactoring was done to unify naming, configuration variables etc.
1403 It should all be backwards compatible.
1404
1405 - In TWO_FACTOR_ENABLED_METHODS "mail" was changed to "email". "mail" will still
1406 be honored if already stored in DB. Also "google_authenticator" is now just "authenticator".
1407 - TWO_FACTOR_SECRET, TWO_FACTOR_URI_SERVICE_NAME, TWO_FACTOR_SMS_SERVICE, and TWO_FACTOR_SMS_SERVICE_CONFIG
1408 have all been deprecated in favor of names that are the same for two-factor and unified sign in.
1409
1410 Other changes with possible backwards compatibility issues:
1411
1412 - ``/tf-setup`` never did any phone number validation. Now it does.
1413 - ``two_factor_setup.html`` template - the chosen_method check was changed to ``email``.
1414 If you have your own custom template - be sure make that change.
1415
1416 Version 3.3.3
1417 -------------
1418
1419 Released February 11, 2020
1420
1421 Minor changes required to work with latest released Werkzeug and Flask-Login.
1422
1423 Version 3.3.2
1424 -------------
1425
1426 Released December 7, 2019
1427
1428 - (:issue:`215`) Fixed 2FA totp secret regeneration bug (kishi85)
1429 - (:issue:`172`) Fixed 'next' redirect error in login view
1430 - (:issue:`221`) Fixed regressions in login view when already authenticated user
1431 again does a GET or POST.
1432 - (:issue:`219`) Added example code for unit testing FS protected routes.
1433 - (:issue:`223`) Integrated two-factor auth into registration and confirmation.
1434
1435 Thanks to kuba-lilz and kishi85 for finding and providing detailed issue reports.
1436
1437 In Flask-Security 3.3.0 the login view was changed to allow already authenticated
1438 users to access the view. Prior to 3.3.0, the login view was protected with
1439 @anonymous_user_required - so any access (via GET or POST) would simply redirect
1440 the user to the ``POST_LOGIN_VIEW``. With the 3.3.0 changes, both GET and POST
1441 behaved oddly. GET simply returned the login template, and POST attempted to
1442 log out the current user, and log in the new user. This was problematic since
1443 this couldn't possibly work with CSRF.
1444 The old behavior has been restored, with the subtle change that older Flask-Security
1445 releases did not look at "next" in the form or request for the redirect,
1446 and now, all redirects from the login view will honor "next".
1447
1448 Version 3.3.1
1449 -------------
1450
1451 Released November 16, 2019
1452
1453 - (:pr:`197`) Add `Quart <https://gitlab.com/pgjones/quart/>`_ compatibility (Ristellise)
1454 - (:pr:`194`) Add Python 3.8 support into CI (jdevera)
1455 - (:pr:`196`) Improve docs around Single Page Applications and React (acidjunk)
1456 - (:issue:`201`) fsqla model was added to __init__.py making Sqlalchemy a required package.
1457 That is wrong and has been removed. Applications must now explicitly import from ``flask_security.models``
1458 - (:pr:`204`) Fix/improve examples and quickstart to show one MUST call hash_password() when
1459 creating users programmatically. Also show real SECRET_KEYs and PASSWORD_SALTs and how to generate them.
1460 - (:pr:`209`) Add argon2 as an allowable password hash.
1461 - (:pr:`210`) Improve integration with Flask-Admin. Actually - this PR improves localization support
1462 by adding a method ``_fsdomain`` to jinja2's global environment. Added documentation
1463 around localization.
1464
1465
1466 Version 3.3.0
1467 -------------
1468
1469 Released September 26, 2019
1470
1471 **There are several default behavior changes that might break existing applications.
1472 Most have configuration variables that restore prior behavior**.
1473
1474 **If you use Authentication Tokens (rather than session cookies) you MUST make a (small) change.
1475 Please see below for details.**
1476
1477 - (:pr:`120`) Native support for Permissions as part of Roles. Endpoints can be
1478 protected via permissions that are evaluated based on role(s) that the user has.
1479 - (:issue:`126`, :issue:`93`, :issue:`96`) Revamp entire CSRF handling. This adds support for Single Page Applications
1480 and having CSRF protection for browser(session) authentication but ignored for
1481 token based authentication. Add extensive documentation about all the options.
1482 - (:issue:`156`) Token authentication is slow. Please see below for details on how to enable a new, fast implementation.
1483 - (:issue:`130`) Enable applications to provide their own :meth:`.render_json` method so that they can create
1484 unified API responses.
1485 - (:issue:`121`) Unauthorized callback not quite right. Split into 2 different callbacks - one for
1486 unauthorized and one for unauthenticated. Made default unauthenticated handler use Flask-Login's unauthenticated
1487 method to make everything uniform. Extensive documentation added. `.Security.unauthorized_callback` has been deprecated.
1488 - (:pr:`120`) Add complete User and Role model mixins that support all features. Modify tests and Quickstart documentation
1489 to show how to use these. Please see :ref:`responsetopic` for details.
1490 - Improve documentation for :meth:`.UserDatastore.create_user` to make clear that hashed password
1491 should be passed in.
1492 - Improve documentation for :class:`.UserDatastore` and :func:`.verify_and_update_password`
1493 to make clear that caller must commit changes to DB if using a session based datastore.
1494 - (:issue:`122`) Clarify when to use ``confirm_register_form`` rather than ``register_form``.
1495 - Fix bug in 2FA that didn't commit DB after using `verify_and_update_password`.
1496 - Fix bug(s) in UserDatastore where changes to user ``active`` flag weren't being added to DB.
1497 - (:issue:`127`) JSON response was failing due to LazyStrings in error response.
1498 - (:issue:`117`) Making a user inactive should stop all access immediately.
1499 - (:issue:`134`) Confirmation token can no longer be reused. Added
1500 *SECURITY_AUTO_LOGIN_AFTER_CONFIRM* option for applications that don't want the user
1501 to be automatically logged in after confirmation (defaults to True - existing behavior).
1502 - (:issue:`159`) The ``/register`` endpoint returned the Authentication Token even though
1503 confirmation was required. This was a huge security hole - it has been fixed.
1504 - (:issue:`160`) The 2FA totp_secret would be regenerated upon submission, making QRCode not work. (malware-watch)
1505 - (:issue:`166`) `default_render_json` uses ``flask.make_response`` and forces the Content-Type to JSON for generating the response (koekie)
1506 - (:issue:`166`) *SECURITY_MSG_UNAUTHENTICATED* added to the configuration.
1507 - (:pr:`168`) When using the @auth_required or @auth_token_required decorators, the token
1508 would be verified twice, and the DB would be queried twice for the user. Given how slow
1509 token verification is - this was a significant issue. That has been fixed.
1510 - (:issue:`84`) The :func:`.anonymous_user_required` was not JSON friendly - always
1511 performing a redirect. Now, if the request 'wants' a JSON response - it will receive a 400 with an error
1512 message defined by *SECURITY_MSG_ANONYMOUS_USER_REQUIRED*.
1513 - (:pr:`145`) Improve 2FA templates to that they can be localized. (taavie)
1514 - (:issue:`173`) *SECURITY_UNAUTHORIZED_VIEW* didn't accept a url (just an endpoint). All other view
1515 configurations did. That has been fixed.
1516
1517 Possible compatibility issues
1518 +++++++++++++++++++++++++++++
1519
1520 - (:pr:`164`) In prior releases, the Authentication Token was returned as part of the JSON response to each
1521 successful call to `/login`, `/change`, or `/reset/{token}` API call. This is not a great idea since
1522 for browser-based UIs that used JSON request/response, and used session based authentication - they would
1523 be sent this token - even though it was likely ignored. Since these tokens by default have no expiration time
1524 this exposed a needless security hole. The new default behavior is to ONLY return the Authentication Token from those APIs
1525 if the query param ``include_auth_token`` is added to the request. Prior behavior can be restored by setting
1526 the *SECURITY_BACKWARDS_COMPAT_AUTH_TOKEN* configuration variable.
1527
1528 - (:pr:`120`) :class:`.RoleMixin` now has a method :meth:`.get_permissions` which is called as part
1529 each request to add Permissions to the authenticated user. It checks if the RoleModel
1530 has a property ``permissions`` and assumes it is a comma separated string of permissions.
1531 If your model already has such a property this will likely fail. You need to override :meth:`.get_permissions`
1532 and simply return an emtpy set.
1533
1534 - (:issue:`121`) Changes the default (failure) behavior for views protected with @auth_required, @token_auth_required,
1535 or @http_auth_required. Before, a 401 was returned with some stock html. Now, Flask-Login.unauthorized() is
1536 called (the same as @login_required does) - which by default redirects to a login page/view. If you had provided your own
1537 `.Security.unauthorized_callback` there are no changes - that will still be called first. The old default
1538 behavior can be restored by setting *SECURITY_BACKWARDS_COMPAT_UNAUTHN* to True. Please see :ref:`responsetopic` for details.
1539
1540 - (:issue:`127`) Fix for LazyStrings in json error response. The fix for this has Flask-Security registering
1541 its own JsonEncoder on its blueprint. If you registered your own JsonEncoder for your app - it will no
1542 longer be called when serializing responses to Flask-Security endpoints. You can register your JsonEncoder
1543 on Flask-Security's blueprint by sending it as `json_encoder_cls` as part of initialization. Be aware that your
1544 JsonEncoder needs to handle LazyStrings (see speaklater).
1545
1546 - (:issue:`84`) Prior to this fix - anytime the decorator :func:`.anonymous_user_required` failed, it caused a redirect to
1547 the post_login_view. Now, if the caller wanted a JSON response, it will return a 400.
1548
1549 - (:issue:`156`) Faster Authentication Token introduced the following non-backwards compatible behavior change:
1550
1551 * Since the old Authentication Token algorithm used the (hashed) user's password, those tokens would be invalidated
1552 whenever the user changed their password. This is not likely to be what most users expect. Since the new
1553 Authentication Token algorithm doesn't refer to the user's password, changing the user's password won't invalidate
1554 outstanding Authentication Tokens. The method :meth:`.UserDatastore.set_uniquifier` can be used by an administrator
1555 to change a user's ``fs_uniquifier`` - but nothing the user themselves can do to invalidate their Authentication Tokens.
1556 Setting the *SECURITY_BACKWARDS_COMPAT_AUTH_TOKEN_INVALIDATE* configuration variable will cause the user's ``fs_uniquifier`` to
1557 be changed when they change their password, thus restoring prior behavior.
1558
1559
1560 New fast authentication token implementation
1561 ++++++++++++++++++++++++++++++++++++++++++++
1562 Current auth tokens are slow because they use the user's password (hashed) as a uniquifier (the
1563 user id isn't really enough since it might be reused). This requires checking the (hashed) password against
1564 what is in the token on EVERY request - however hashing is (on purpose) slow. So this can add almost a whole second
1565 to every request.
1566
1567 To solve this, a new attribute in the User model was added - ``fs_uniquifier``. If this is present in your
1568 User model, then it will be used instead of the password for ensuring the token corresponds to the correct user.
1569 This is very fast. If that attribute is NOT present - then the behavior falls back to the existing (slow) method.
1570
1571
1572 DB Migration
1573 ~~~~~~~~~~~~
1574
1575 To use the new UserModel mixins or to add the column ``user.fs_uniquifier`` to speed up token
1576 authentication, a schema AND data migration needs to happen. If you are using Alembic the schema migration is
1577 easy - but you need to add ``fs_uniquifier`` values to all your existing data. You can
1578 add code like this to your migrations::update method::
1579
1580 # be sure to MODIFY this line to make nullable=True:
1581 op.add_column('user', sa.Column('fs_uniquifier', sa.String(length=64), nullable=True))
1582
1583 # update existing rows with unique fs_uniquifier
1584 import uuid
1585 user_table = sa.Table('user', sa.MetaData(), sa.Column('id', sa.Integer, primary_key=True),
1586 sa.Column('fs_uniquifier', sa.String))
1587 conn = op.get_bind()
1588 for row in conn.execute(sa.select([user_table.c.id])):
1589 conn.execute(user_table.update().values(fs_uniquifier=uuid.uuid4().hex).where(user_table.c.id == row['id']))
1590
1591 # finally - set nullable to false
1592 op.alter_column('user', 'fs_uniquifier', nullable=False)
1593
1594 # for MySQL the previous line has to be replaced with...
1595 # op.alter_column('user', 'fs_uniquifier', existing_type=sa.String(length=64), nullable=False)
1596
1597
1598 Version 3.2.0
1599 -------------
1600
1601 Released June 26th 2019
1602
1603 - (:pr:`80`) Support caching of authentication token (eregnier `opr #839 <https://github.com/mattupstate/flask-security/pull/839>`_).
1604 This adds a new configuration variable *SECURITY_USE_VERIFY_PASSWORD_CACHE*
1605 which enables a cache (with configurable TTL) for authentication tokens.
1606 This is a big performance boost for those accessing Flask-Security via token
1607 as opposed to session.
1608 - (:pr:`81`) Support for JSON/Single-Page-Application. This completes support
1609 for non-form based access to Flask-Security. See PR for details. (jwag956)
1610 - (:pr:`79` Add POST logout to enhance JSON usage (jwag956).
1611 - (:pr:`73`) Fix get_user for various DBs (jwag956).
1612 This is a more complete fix than in opr #633.
1613 - (:pr:`78`, :pr:`103`) Add formal openapi API spec (jwag956).
1614 - (:pr:`86`, :pr:`94`, :pr:`98`, :pr:`101`, :pr:`104`) Add Two-factor authentication (opr #842) (baurt, jwag956).
1615 - (:issue:`108`) Fix form field label translations (jwag956)
1616 - (:issue:`115`) Fix form error message translations (upstream #801) (jwag956)
1617 - (:issue:`87`) Convert entire repo to Black (baurt)
1618
1619 Version 3.1.0
1620 -------------
1621
1622 Released never
1623
1624 - (:pr:`53`) Use Security.render_template in mails too (noirbizarre `opr #487 <https://github.com/mattupstate/flask-security/pull/487>`_)
1625 - (:pr:`56`) Optimize DB accesses by using an SQL JOIN when retrieving a user. (nfvs `opr #679 <https://github.com/mattupstate/flask-security/pull/679>`_)
1626 - (:pr:`57`) Add base template to security templates (grihabor `opr #697 <https://github.com/mattupstate/flask-security/pull/697>`_)
1627 - (:pr:`73`) datastore: get user by numeric identity attribute (jirikuncar `opr #633 <https://github.com/mattupstate/flask-security/pull/633>`_)
1628 - (:pr:`58`) bugfix: support application factory pattern (briancappello `opr #703 <https://github.com/mattupstate/flask-security/pull/703>`_)
1629 - (:pr:`60`) Make SECURITY_PASSWORD_SINGLE_HASH a list of scheme ignoring double hash (noirbizarre `opr #714 <https://github.com/mattupstate/flask-security/pull/714>`_)
1630 - (:pr:`61`) Allow custom login_manager to be passed in to Flask-Security (jaza `opr #717 <https://github.com/mattupstate/flask-security/pull/717>`_)
1631 - (:pr:`62`) Docs for OAauth2-based custom login manager (jaza `opr #727 <https://github.com/mattupstate/flask-security/pull/727>`_)
1632 - (:pr:`63`) core: make the User model check the password (mklassen `opr #779 <https://github.com/mattupstate/flask-security/pull/779>`_)
1633 - (:pr:`64`) Customizable send_mail (abulte `opr #730 <https://github.com/mattupstate/flask-security/pull/730>`_)
1634 - (:pr:`68`) core: fix default for UNAUTHORIZED_VIEW (jirijunkar `opr #726 <https://github.com/mattupstate/flask-security/pull/726>`_)
1635
1636 These should all be backwards compatible.
1637
1638 Possible compatibility issues:
1639
1640 - #487 - prior to this, render_template() was overridable for views, but not
1641 emails. If anyone actually relied on this behavior, this has changed.
1642 - #703 - get factory pattern working again. There was a very complex dance between
1643 Security() instantiation and init_app regarding kwargs. This has been rationalized (hopefully).
1644 - #679 - SqlAlchemy SQL improvement. It is possible you will get the following error::
1645
1646 Got exception during processing: <class 'sqlalchemy.exc.InvalidRequestError'> -
1647 'User.roles' does not support object population - eager loading cannot be applied.
1648
1649 This is likely solvable by removing ``lazy='dynamic'`` from your Role definition.
1650
1651
1652 Performance improvements:
1653
1654 - #679 - for sqlalchemy, for each request, there would be 2 DB accesses - now
1655 there is one.
1656
1657 Testing:
1658 For datastores operations, Sqlalchemy, peewee, pony were all tested against sqlite,
1659 postgres, and mysql real databases.
1660
1661
1662 Version 3.0.2
1663 -------------
1664
1665 Released April 30th 2019
1666
1667 - (opr #439) HTTP Auth respects SECURITY_USER_IDENTITY_ATTRIBUTES (pnpnpn)
1668 - (opr #660) csrf_enabled` deprecation fix (abulte)
1669 - (opr #671) Fix referrer loop in _get_unauthorized_view(). (nfvs)
1670 - (opr #675) Fix AttributeError in _request_loader (sbagan)
1671 - (opr #676) Fix timing attack on login form (cript0nauta)
1672 - (opr #683) Close db connection after running tests (reambus)
1673 - (opr #691) docs: add password salt to SQLAlchemy app example (KshitijKarthick)
1674 - (opr #692) utils: fix incorrect email sender type (switowski)
1675 - (opr #696) Fixed broken Click link (williamhatcher)
1676 - (opr #722) Fix password recovery confirmation on deleted user (kesara)
1677 - (opr #747) Update login_user.html (rickwest)
1678 - (opr #748) i18n: configurable the dirname domain (escudero)
1679 - (opr #835) adds relevant user to reset password form for validation purposes (fuhrysteve)
1680
1681 These are bug fixes and a couple very small additions.
1682 No change in behavior and no new functionality.
1683 'opr#' is the original pull request from https://github.com/mattupstate/flask-security
1684
1685 Version 3.0.1
1686 --------------
1687
1688 Released April 28th 2019
1689
1690 - Support 3.7 as part of CI
1691 - Rebrand to this forked repo
1692 - (#15) Build docs and translations as part of CI
1693 - (#17) Move to msgcheck from pytest-translations
1694 - (opr #669) Fix for Read the Docs (jirikuncar)
1695 - (opr #710) Spanish translation (maukoquiroga)
1696 - (opr #712) i18n: improvements of German translations (eseifert)
1697 - (opr #713) i18n: add Portuguese (Brazilian) translation (dinorox)
1698 - (opr #719) docs: fix anchor links and typos (kesara)
1699 - (opr #751) i18n: fix missing space (abulte)
1700 - (opr #762) docs: fixed proxy import (lsmith)
1701 - (opr #767) Update customizing.rst (allanice001)
1702 - (opr #776) i18n: add Portuguese (Portugal) translation (micael-grilo)
1703 - (opr #791) Fix documentation for mattupstate#781 (fmerges)
1704 - (opr #796) Chinese translations (Steinkuo)
1705 - (opr #808) Clarify that a commit is needed after login_user (christophertull)
1706 - (opr #823) Add Turkish translation (Admicos)
1707 - (opr #831) Catalan translation (miceno)
1708
1709 These are all documentation and i18n changes - NO code changes. All except the last 3 were accepted and reviewed by
1710 the original Flask-Security team.
1711 Thanks as always to all the contributors.
1712
1713 Version 3.0.0
1714 -------------
1715
1716 Released May 29th 2017
1717
1718 - Fixed a bug when user clicking confirmation link after confirmation
1719 and expiration causes confirmation email to resend. (see #556)
1720 - Added support for I18N.
1721 - Added options `SECURITY_EMAIL_PLAINTEXT` and `SECURITY_EMAIL_HTML`
1722 for sending respectively plaintext and HTML version of email.
1723 - Fixed validation when missing login information.
1724 - Fixed condition for token extraction from JSON body.
1725 - Better support for universal bdist wheel.
1726 - Added port of CLI using Click configurable using options
1727 `SECURITY_CLI_USERS_NAME` and `SECURITY_CLI_ROLES_NAME`.
1728 - Added new configuration option `SECURITY_DATETIME_FACTORY` which can
1729 be used to force default timezone for newly created datetimes.
1730 (see mattupstate/flask-security#466)
1731 - Better IP tracking if using Flask 0.12.
1732 - Renamed deprecated Flask-WFT base form class.
1733 - Added tests for custom forms configured using app config.
1734 - Added validation and tests for next argument in logout endpoint. (see #499)
1735 - Bumped minimal required versions of several packages.
1736 - Extended test matric on Travis CI for minimal and released package versions.
1737 - Added of .editorconfig and forced tests for code style.
1738 - Fixed a security bug when validating a confirmation token, also checks
1739 if the email that the token was created with matches the user's current email.
1740 - Replaced token loader with request loader.
1741 - Changed trackable behavior of `login_user` when IP can not be detected from a request from 'untrackable' to `None` value.
1742 - Use ProxyFix instead of inspecting X-Forwarded-For header.
1743 - Fix identical problem with app as with datastore.
1744 - Removed always-failing assertion.
1745 - Fixed failure of init_app to set self.datastore.
1746 - Changed to new style flask imports.
1747 - Added proper error code when returning JSON response.
1748 - Changed obsolete Required validator from WTForms to DataRequired. Bumped Flask-WTF to 0.13.
1749 - Fixed missing `SECURITY_SUBDOMAIN` in config docs.
1750 - Added cascade delete in PeeweeDatastore.
1751 - Added notes to docs about `SECURITY_USER_IDENTITY_ATTRIBUTES`.
1752 - Inspect value of `SECURITY_UNAUTHORIZED_VIEW`.
1753 - Send password reset instructions if an attempt has expired.
1754 - Added "Forgot password?" link to LoginForm description.
1755 - Upgraded passlib, and removed bcrypt version restriction.
1756 - Removed a duplicate line ('retype_password': 'Retype Password') in forms.py.
1757 - Various documentation improvement.
1758
1759 Version 1.7.5
1760 -------------
1761
1762 Released December 2nd 2015
1763
1764 - Added `SECURITY_TOKEN_MAX_AGE` configuration setting
1765 - Fixed calls to `SQLAlchemyUserDatastore.get_user(None)` (this now returns `False` instead of raising a `TypeError`
1766 - Fixed URL generation adding extra slashes in some cases (see GitHub #343)
1767 - Fixed handling of trackable IP addresses when the `X-Forwarded-For` header contains multiple values
1768 - Include WWW-Authenticate headers in `@auth_required` authentication checks
1769 - Fixed error when `check_token` function is used with a json list
1770 - Added support for custom `AnonymousUser` classes
1771 - Restricted `forgot_password` endpoint to anonymous users
1772 - Allowed unauthorized callback to be overridden
1773 - Fixed issue where passwords cannot be reset if currently set to `None`
1774 - Ensured that password reset tokens are invalidated after use
1775 - Updated `is_authenticated` and `is_active` functions to support Flask-Login changes
1776 - Various documentation improvements
1777
1778
1779 Version 1.7.4
1780 -------------
1781
1782 Released October 13th 2014
1783
1784 - Fixed a bug related to changing existing passwords from plaintext to hashed
1785 - Fixed a bug in form validation that did not enforce case insensitivity
1786 - Fixed a bug with validating redirects
1787
1788
1789 Version 1.7.3
1790 -------------
1791
1792 Released June 10th 2014
1793
1794 - Fixed a bug where redirection to `SECURITY_POST_LOGIN_VIEW` was not respected
1795 - Fixed string encoding in various places to be friendly to unicode
1796 - Now using `werkzeug.security.safe_str_cmp` to check tokens
1797 - Removed user information from JSON output on `/reset` responses
1798 - Added Python 3.4 support
1799
1800
1801 Version 1.7.2
1802 -------------
1803
1804 Released May 6th 2014
1805
1806 - Updated IP tracking to check for `X-Forwarded-For` header
1807 - Fixed a bug regarding the re-hashing of passwords with a new algorithm
1808 - Fixed a bug regarding the `password_changed` signal.
1809
1810
1811 Version 1.7.1
1812 -------------
1813
1814 Released January 14th 2014
1815
1816 - Fixed a bug where passwords would fail to verify when specifying a password hash algorithm
1817
1818
1819 Version 1.7.0
1820 -------------
1821
1822 Released January 10th 2014
1823
1824 - Python 3.3 support!
1825 - Dependency updates
1826 - Fixed a bug when `SECURITY_LOGIN_WITHOUT_CONFIRMATION = True` did not allow users to log in
1827 - Added `SECURITY_SEND_PASSWORD_RESET_NOTICE_EMAIL` configuration option to optionally send password reset notice emails
1828 - Add documentation for `@security.send_mail_task`
1829 - Move to `request.get_json` as `request.json` is now deprecated in Flask
1830 - Fixed a bug when using AJAX to change a user's password
1831 - Added documentation for select functions in the `flask_security.utils` module
1832 - Fixed a bug in `flask_security.forms.NextFormMixin`
1833 - Added `CHANGE_PASSWORD_TEMPLATE` configuration option to optionally specify a different change password template
1834 - Added the ability to specify addtional fields on the user model to be used for identifying the user via the `USER_IDENTITY_ATTRIBUTES` configuration option
1835 - An error is now shown if a user tries to change their password and the password is the same as before. The message can be customed with the `SECURITY_MSG_PASSWORD_IS_SAME` configuration option
1836 - Fixed a bug in `MongoEngineUserDatastore` where user model would not be updated when using the `add_role_to_user` method
1837 - Added `SECURITY_SEND_PASSWORD_CHANGE_EMAIL` configuration option to optionally disable password change email from being sent
1838 - Fixed a bug in the `find_or_create_role` method of the PeeWee datastore
1839 - Removed pypy tests
1840 - Fixed some tests
1841 - Include CHANGES and LICENSE in MANIFEST.in
1842 - A bit of documentation cleanup
1843 - A bit of code cleanup including removal of unnecessary utcnow call and simplification of get_max_age method
1844
1845
1846 Version 1.6.9
1847 -------------
1848
1849 Released August 20th 2013
1850
1851 - Fix bug in SQLAlchemy datastore's `get_user` function
1852 - Fix bug in PeeWee datastore's `remove_role_from_user` function
1853 - Fixed import error caused by new Flask-WTF release
1854
1855
1856 Version 1.6.8
1857 -------------
1858
1859 Released August 1st 2013
1860
1861 - Fixed bug with case sensitivity of email address during login
1862 - Code cleanup regarding token_callback
1863 - Ignore validation errors in find_user function for MongoEngineUserDatastore
1864
1865
1866 Version 1.6.7
1867 -------------
1868
1869 Released July 11th 2013
1870
1871 - Made password length form error message configurable
1872 - Fixed email confirmation bug that prevented logged in users from confirming their email
1873
1874
1875 Version 1.6.6
1876 -------------
1877
1878 Released June 28th 2013
1879
1880 - Fixed dependency versions
1881
1882
1883 Version 1.6.5
1884 -------------
1885
1886 Released June 20th 2013
1887
1888 - Fixed bug in `flask.ext.security.confirmable.generate_confirmation_link`
1889
1890
1891 Version 1.6.4
1892 -------------
1893
1894 Released June 18th 2013
1895
1896 - Added `SECURITY_DEFAULT_REMEMBER_ME` configuration value to unify behavior between endpoints
1897 - Fixed Flask-Login dependency problem
1898 - Added optional `next` parameter to registration endpoint, similar to that of login
1899
1900
1901 Version 1.6.3
1902 -------------
1903
1904 Released May 8th 2013
1905
1906 - Fixed bug in regards to imports with latest version of MongoEngine
1907
1908
1909 Version 1.6.2
1910 -------------
1911
1912 Released April 4th 2013
1913
1914 - Fixed bug with http basic auth
1915
1916
1917 Version 1.6.1
1918 -------------
1919
1920 Released April 3rd 2013
1921
1922 - Fixed bug with signals
1923
1924
1925 Version 1.6.0
1926 -------------
1927
1928 Released March 13th 2013
1929
1930 - Added Flask-Pewee support
1931 - Password hashing is now more flexible and can be changed to a different type at will
1932 - Flask-Login messages are configurable
1933 - AJAX requests must now send a CSRF token for security reasons
1934 - Form messages are now configurable
1935 - Forms can now be extended with more fields
1936 - Added change password endpoint
1937 - Added the user to the request context when successfully authenticated via http basic and token auth
1938 - The Flask-Security blueprint subdomain is now configurable
1939 - Redirects to other domains are now not allowed during requests that may redirect
1940 - Template paths can be configured
1941 - The welcome/register email can now optionally be sent to the user
1942 - Passwords can now contain non-latin characters
1943 - Fixed a bug when confirming an account but the account has been deleted
1944
1945
1946 Version 1.5.4
1947 -------------
1948
1949 Released January 6th 2013
1950
1951 - Fix bug in forms with `csrf_enabled` parameter not accounting attempts to login using JSON data
1952
1953
1954 Version 1.5.3
1955 -------------
1956
1957 Released December 23rd 2012
1958
1959 - Change dependency requirement
1960
1961 Version 1.5.2
1962 -------------
1963
1964 Released December 11th 2012
1965
1966 - Fix a small bug in `flask_security.utils.login_user` method
1967
1968 Version 1.5.1
1969 -------------
1970
1971 Released November 26th 2012
1972
1973 - Fixed bug with `next` form variable
1974 - Added better documentation regarding Flask-Mail configuration
1975 - Added ability to configure email subjects
1976
1977 Version 1.5.0
1978 -------------
1979
1980 Released October 11th 2012
1981
1982 - Major release. Upgrading from previous versions will require a bit of work to
1983 accommodate API changes. See documentation for a list of new features and for
1984 help on how to upgrade.
1985
1986 Version 1.2.3
1987 -------------
1988
1989 Released June 12th 2012
1990
1991 - Fixed a bug in the RoleMixin eq/ne functions
1992
1993 Version 1.2.2
1994 -------------
1995
1996 Released April 27th 2012
1997
1998 - Fixed bug where `roles_required` and `roles_accepted` did not pass the next
1999 argument to the login view
2000
2001 Version 1.2.1
2002 -------------
2003
2004 Released March 28th 2012
2005
2006 - Added optional user model mixin parameter for datastores
2007 - Added CreateRoleCommand to available Flask-Script commands
2008
2009 Version 1.2.0
2010 -------------
2011
2012 Released March 12th 2012
2013
2014 - Added configuration option `SECURITY_FLASH_MESSAGES` which can be set to a
2015 boolean value to specify if Flask-Security should flash messages or not.
2016
2017 Version 1.1.0
2018 -------------
2019
2020 Initial release