• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jwag956 / flask-security / 352 / 6
97%
master: 97%

Build:
DEFAULT BRANCH: master
Ran 15 Aug 2019 09:59PM UTC
Files 22
Run time 17s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 Aug 2019 09:51PM UTC coverage: 97.095% (-0.1%) from 97.204%
REQUIREMENTS=release

push

travis-ci

web-flow
fix/enhancement - Fix slow auth tokens. (#164)

Current auth tokens are slow because they use the user's password (hashed) as a uniquifier (the
user id isn't really enough since it might be reused). This requires checking the (hashed) password against
what is in the token on EVERY request - however hashing is (on purpose) slow. So this can add almost a whole second
to every request!

This PR introduces a new UserModel field - fs_uniquifier - that if present in the UserModel will be populated and used rather than the password. This results in 50x reduction in time when authenticating via token.

Furthermore, the actual token verification has been moved from request_loader into the UserMixin - so
that it could be overridden (creating the auth_token already was in the UserMixin).

Note that this does require a DB migration to add the field. The fsqla model has been updated, and docs
describing at least one way to migrate the DB have been added.

2 new backwards compatibility configurations have been added that can revert some new default behavior.

First - in the past- the auth token was included always in JSON responses to login, reset and change -
even if the caller was a browser. This is
really not great since auth tokens may have very long expire times (or none) and it shouldn't even be sent if not needed.
Now, by default, the auth token is NEVER returned - the caller may request is during login, reset, or change by adding the
'include_auth_token' query param.

Second, since auth tokens used to be checked against the hashed password - changing a user's password meant that any
outstanding auth tokens would be invalidated. That seems like strange behavior - so by default, tokens that are verified
with the new fs_uniquifier won't be invalidated just because the user's password changes. The
BACKWARDS_COMPAT_AUTH_TOKEN_INVALID config variable will cause the fs_uniquifier to be changed whenever the user's password changes, thus rest... (continued)

2139 of 2203 relevant lines covered (97.09%)

0.97 hits per line

Source Files on job 352.6 (REQUIREMENTS=release)
  • Tree
  • List 0
  • Changed 8
  • Source Changed 7
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 322
  • Travis Job 352.6
  • ae027a52 on github
  • Prev Job for REQUIREMENTS=release on master (#348.5)
  • Next Job for REQUIREMENTS=release on master (#356.8)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc