-
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13147 +/- ##
==========================================
+ Coverage 35.03% 35.08% +0.05%
==========================================
Files 3034 3036 +2
Lines 92636 92776 +140
Branches 16858 16905 +47
==========================================
+ Hits 32452 32549 +97
- Misses 57724 57753 +29
- Partials 2460 2474 +14 ☔ 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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODI5MTksIm5iZiI6MTczOTI4MjYxOSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwMjU1LTc0MmUyZTVjLWViODEtNGYxYS1hNDdkLTg5NjExZjJjYjA5Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxNDAzMzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02M2ZjYWY3ODIyNGE1YTY2NWE2NzM0YzJkNWFjNzZjMjZiMmZjZmNkZGM2YTY0MmUyMDdmNWQ1ZDJlMTBkYTFjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ccvPY2lrxELL0NcKtbBA73g_8YSKGz0N-kzv01KjpYE)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODI5MTksIm5iZiI6MTczOTI4MjYxOSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwMzU1LWZjMTUxZjFhLTgzMGUtNDk2ZC04MGIwLWE3YTY5NTBlZmVhOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxNDAzMzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iNDZhMTI5NDhkNDBlMDY1ODgzZmIyNTQyZTJlNzRiZmVhNDBkMGE4ZDU2OTBlNTM2YjAyMzA1NzkwYmU2NTE0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.5LqCxsra7GuNQ5seE6pijci7jNIJswbx7gWmKx_5J7M)
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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyODI5MTksIm5iZiI6MTczOTI4MjYxOSwicGF0aCI6Ii8xMDIxODEyMTAvNDEwMjUwNDM1LWY2MGI5MDViLWQ1NTktNGEzNS1hNWY0LTczZWIwZmMyMzZkOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQxNDAzMzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNzAyMDk1ZGFhMTE2MzIwNjJiNTcxZDAzYjQ1MjFmYjI2MzE4N2RmOWQ5MjZkYTNkMjM1OWVkOGNjNGMwNjE4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.N3ALwnsX0QSGby9eXzjeJJmFsIjQIX-VvOUvgAsmJ54)
@@ -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"?
// 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()
.
* 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()
🎟️ 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