SG-39788 Fix data persistence issue after re-authentication#211
SG-39788 Fix data persistence issue after re-authentication#211carlos-villavicencio-adsk merged 21 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a security issue where the Flow Production Tracking Desktop UI would display the previous user's information (name, email, projects) after re-authentication with a different account following session expiry.
Changes:
- Added user change detection and UI refresh logic to update displayed information when a different user re-authenticates
- Implemented proactive validation to check for user mismatches when project data is refreshed or when navigating back to the projects view
- Updated code formatting by simplifying tuple unpacking syntax and multi-line string formatting throughout the codebase
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| python/tk_desktop/desktop_engine_site_implementation.py | Added user change detection in refresh_user_credentials() and new method to check and update current user |
| python/tk_desktop/desktop_window.py | Added user change callback, user info refresh methods, and validation checks; stored user menu actions as instance attributes |
| python/tk_desktop/project_model.py | Simplified tuple unpacking syntax |
| python/tk_desktop/rpc.py | Simplified tuple unpacking syntax |
| python/tk_desktop/update_project_config.py | Simplified tuple unpacking syntax |
| python/tk_desktop/thumb_widget.py | Simplified multi-line string formatting |
| python/tk_desktop/notifications/configuration_update_notification.py | Simplified tuple unpacking syntax |
| python/tk_desktop/command_panel/section_header.py | Simplified multi-line string formatting |
| python/tk_desktop/setup_project.py | Removed extra blank line |
| python/tk_desktop/console.py | Removed extra blank line |
| python/tk_desktop/banner_widget.py | Removed extra blank line |
| bootstrap.py | Simplified tuple unpacking syntax |
| add_desktop_to_project.py | Simplified tuple unpacking syntax |
| .pre-commit-config.yaml | Updated pre-commit hook versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #211 +/- ##
==========================================
+ Coverage 18.75% 20.04% +1.28%
==========================================
Files 69 69
Lines 4713 4785 +72
==========================================
+ Hits 884 959 +75
+ Misses 3829 3826 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| except Exception: | ||
| logger.exception("Error checking for user change after credential refresh.") |
There was a problem hiding this comment.
I'm not crazy about surouding entire functions by global try/catch. Can we improve that?
|
|
||
| # Notify the desktop window to refresh user info and projects | ||
| if hasattr(self, "desktop_window") and self.desktop_window is not None: | ||
| self.desktop_window.on_user_changed() |
There was a problem hiding this comment.
Ok so that's the fix. I mean calling this method in the right context fixes the issue.
But we are in the "site view" here. What about the project view? Do we have to fix it there too?
There was a problem hiding this comment.

Problem
When a user re-authenticates with a different account after session expiry, the Flow Production Tracking Desktop UI was still showing the previous user's name, email, and projects - a security concern.
Security Impact
How the Fix Works