-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PM-15063] Show banner in web app when user has at least one pending authrequest #13147
base: main
Are you sure you want to change the base?
Conversation
Great job, no security vulnerabilities found in this Pull Request |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #13147 +/- ##
===========================================
- Coverage 35.33% 15.76% -19.58%
===========================================
Files 3130 27 -3103
Lines 92592 1884 -90708
Branches 16809 0 -16809
===========================================
- Hits 32720 297 -32423
+ Misses 57431 1587 -55844
+ Partials 2441 0 -2441 ☔ View full report in Codecov by Sentry. |
dataSource = new TableDataSource<DeviceTableData>(); | ||
currentDevice: DeviceView | undefined; | ||
loading = true; | ||
asyncActionLoading = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vault files look gewd. Just curious why the protected was removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing I was working with some finicky testing situation here - it's not necessary to remove though so I've added it back: 271376d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same device will show up 2x when there is a pending auth request and after it is approved. The duplicate only goes away when you refresh the screen. Here are three screenshots showing each state.
Pending auth request (device shown 2x)
![before-approval](https://private-user-images.githubusercontent.com/102181210/410250255-742e2e5c-eb81-4f1a-a47d-89611f2cb092.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MzU1NjUsIm5iZiI6MTczOTYzNTI2NSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwMjU1LTc0MmUyZTVjLWViODEtNGYxYS1hNDdkLTg5NjExZjJjYjA5Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxNjAxMDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00NTgzYTViN2ZiMWIwNjE0YjkxMmNiMDllZTM1NTY5NGFjNDhlZThmNWYxYWVhZTRjNzUzN2QyZTA4NDRmYTMyJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.oZpujuOusHaVXK58kKnmNAwhmfi1KsnDAT1Ct1MpuNM)
After auth request has been approved (device shown 2x)
![after-approval](https://private-user-images.githubusercontent.com/102181210/410250355-fc151f1a-830e-496d-80b0-a7a6950efea9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MzU1NjUsIm5iZiI6MTczOTYzNTI2NSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwMzU1LWZjMTUxZjFhLTgzMGUtNDk2ZC04MGIwLWE3YTY5NTBlZmVhOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxNjAxMDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNWMwMjQ4YmNkNDlkZjRjM2ZiNDgzOWM1YjAyN2FkOGQxMGJkYzFiMWE2NmZmNTM3NGMxY2NhYzY3YzIwMDc2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.hE_69t5a24W_LxIUJaKfT8URj5BQ3pgVOddDi_dAavc)
After refreshing the device management screen (device shown 1x)
![after-refresh](https://private-user-images.githubusercontent.com/102181210/410250435-f60b905b-d559-4a35-a5f4-73eb0fc236d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MzU1NjUsIm5iZiI6MTczOTYzNTI2NSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwNDM1LWY2MGI5MDViLWQ1NTktNGEzNS1hNWY0LTczZWIwZmMyMzZkOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQxNjAxMDVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02MzEzZjYyYTkzMWNiMmFjMzdiZTlmZmRmOTI1NDRhYzFkNTk5YmE5NGU3MjkxYWM3NTIzMjZjMjczYjhmODczJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.KcN5q_FXhLVPa30d76NnsO4HYJYELe5EuU-F_reVsPA)
@@ -44,7 +49,7 @@ interface DeviceTableData { | |||
imports: [CommonModule, SharedModule, TableModule, PopoverModule], | |||
}) | |||
export class DeviceManagementComponent { | |||
protected readonly tableId = "device-management-table"; | |||
protected readonly retableId = "device-management-table"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "retable"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed it altogether here: a2f9fa9
// Load devices | ||
this.loadDevices().catch((error) => this.validationService.showError(error)); | ||
|
||
// Listen for auth request messages | ||
this.messageListener.allMessages$.pipe(takeUntilDestroyed()).subscribe((message) => { | ||
if (message.command !== "openLoginApproval") { | ||
return; | ||
} | ||
// Handle inserting a new device when an auth request is received | ||
this.handleAuthRequest(message as { command: string; notificationId: string }).catch( | ||
(error) => this.validationService.showError(error), | ||
); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we aren't awaiting loadDevices()
, I think this creates a race condition. If handleAuthRequest()
were to finish first, then I believe loadDevices()
could potentially overwrite the table data and remove the newDevice
that was added in handleAuthRequest()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Handle inserting a new device when an auth request is received | ||
* @param message - The auth request message | ||
*/ | ||
private async handleAuthRequest(message: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this to upsertDeviceWithPendingAuthRequest
or something similar. Otherwise the name seems like it's actually handling/managing the auth request, which we do in managePendingAuthRequest()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 58644f3
I think I've fixed the issue with 8729d89, but this will require a backend change. I think we'll need to add UPDATE: This should be fixed with the latest changes and the backend changes in bitwarden/server#5403 |
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-15063?atlOrigin=eyJpIjoiOGY5MzdhNDMyZDllNDc0ZWFkMzk2NjI1NjRhMTU5MGIiLCJwIjoiaiJ9
📔 Objective
Adds a new banner to the vault that will display when a device auth request is made. The banner contains a link to the device management screen (
/#/settings/security/device-management
). This PR also modifies the device management screen to listen for theopenLoginApproval
message and upsert the new request data into the table.📸 Screenshots
GMT20250129-223543_Clip_Alec.Rippberger.s.Clip.01_29_2025.mp4
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes