-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Bug: Can use "Edit FAQ Page" even with an expired session #1842
Comments
@entrotech From your comments in the meeting I understand that a polling strategy is the likely solution, and that's fine, but just to consider alternatives, can I ask:
|
Caveat: Our whole authentication and authorization system is home-grown, and we could do a complete overhaul to incorporate modern best practices, etc. The city, in fact, wants to replace it with an enterprise-wide 3rd party authentication product (they partially implemented a solution from Okta, but are now looking at switching to a different product from Okta). But it remains to be seen when they might be ready to implement it. So my current position is that we can't count on the City to implement anything soon and should just keep going with our home-grown security, expecting it to be used in production. The way it works now is that when the user logs in, it uses the /api/accounts/login Web API endpoint. If the login is successful, the results of the call are:
Various react components use the userContext to access the userAccount object to grant or revoke permission to a client-side route. If the account object is not null, then it considers the user to be "logged in", and will not be aware if the JWT token has expired. As a consequence the app will allow access to pages and components as if the user were logged in. The user can manipulate the app as if the user were logged in, but when they attempt to commit any changes to the back end, the Web API will reject any requests requiring user validation as mentioned above. This problem causes a number of bugs like this one, and #1841. The main problem is that the userAccount object on the client should reset to null at the time the JWT token expires, so the client will behave the way it should when there is no logged in user. One thought that comes to mind is that we could augment the userAccount object returned by the login api call with an expiration datetime, and modify the TdmAuthProvider to set the userAccount object to null at that time. However, I'm willing to entertain other ideas you might have. We could also get rid of the feature that stores the userAccount object to local storage, but that might be a good feature to have when users start opening links to snapshots shared with them (that's a different story), so I'm hesitant to remove that at this time. |
@entrotech Thank you for the summary of the current functionality. The solution that you propose:
sounds good. The only drawback would be that since we are not confirming user status with the server, it would be possible for a user to be logged in to the application in two browser tabs, and if they Logout in one browser tab, they will remain logged in in the other browser tab. |
Describe the bug
I can access the "FAQ" page and partially use the "Edit FAQ Page" function even with an expired session which should not be possible. The changes made to the FAQ page are incorrectly displayed as saved but navigating to FAQ page again does not show the changes
Because the bug incorrectly shows the FAQ changes as saved, the user might not realize that the edits to the page did not take effect and any new data entered is lost.
Currently affects the tdmdev login - Admin ([email protected]) account, unsure if more users are affected.
Steps to reproduce the issue
Login to the dev site.
Go to "FAQ" page.
Wait for the session to expire or "Expire" the session using dev tools.
Instructions for using Chrome Dev tools to expire the session
https://tdm-dev.azurewebsites.net/
" if not already selected.jwt
".jwt
" item.2024-09-12T07:44:24.722Z
, change it to2024-09-11T07:44:24.722Z
.jwt
" item will disappear from the list.Navigate to "About" page then go back to the "FAQ" page.
What's the expected result?
After the last step, clicking on the "FAQ" page nav button should cause the user to be logged out and be redirected to the login page with an expired session notification displayed.
What's the actual result?
The user can still edit the FAQ page and try to save their changes. The changes are also displayed on the FAQ page but disappear as soon as the page is reload.
Additional details / screenshot
An image of the FAQ page, notice that the user is still shown as logged in and the "Edit FAQ Page" button is displayed
An image of adding a new FAQ
The FAQ page after the edits were saved by clicking the "Save Edits" button
The FAQ page after the page was reload
Device configuration
The text was updated successfully, but these errors were encountered: