Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plug to handle invalidated Pow session tokens #36

Merged

Conversation

danschultzer
Copy link
Contributor

Exploring a potential resolution to pow-auth/pow#356 here.

The above issue exposed a variety of issues that I've squashed in Pow. The last one I can identify is not a technical issue in Pow, rather it's UX. The problem occurs if I let the session expire, and then open a bunch of tabs at the same time. The first request will successfully use the persistent session token, while all subsequent requests will fail since they use the old cookie value. Thus I've one tab where I'm authenticated, and the rest are not.

This PR adds a plug that stores a session id or persistent session token when they are rolled. If a request is unauthenticated and a session id or persistent session token exists in the request, the token will be looked up in the invalidated session cache. The tokens are only stored for 60 seconds (should probably be much less).

Though there is no test suite, I added the test for the plug for good measure. I'll comment on pow-auth/pow#356 to go more in depth regarding this approach, and conclusions.

I've tested this locally, and can no longer trigger the issue.

Before I commit to this, I want to explore if some upstream changes could make this easier, and I need to ensure that new sessions can't be created to prevent vulnerability.

@danschultzer
Copy link
Contributor Author

I'm waiting with this one till there are no longer any bug reports with sessions being entirely lost (they may be lost temporarily but upon reload should work again). Otherwise this will obscure underlying issues.

@danschultzer danschultzer marked this pull request as ready for review April 11, 2020 18:24
@liamwhite liamwhite merged commit e5f0e47 into derpibooru:master Apr 11, 2020
@danschultzer danschultzer deleted the reuse-invalidated-pow-tokens branch April 11, 2020 18:55
@danschultzer danschultzer mentioned this pull request Apr 11, 2020
Bonsly24 pushed a commit to Bonsly24/philomena that referenced this pull request Apr 12, 2023
Allow Philomena to read config from environment variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants