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

PM- 2059 Update Two factor webauthn dialog #9009

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

KiruthigaManivannan
Copy link
Collaborator

Type of change

- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [x] Other

Objective

Update Two factor webauthn dialog component to use the component library

Code changes

  • two-factor-webauthn.component.html: Converted modal to dialog compoenents
  • two-factor-webauthn.component.ts: Added dialog open method. Data passed to dialog is typed.
  • two-factor-setup.component.ts: Added Web authn dialog logic and passing the result of two factor verify dialog in the switch statement of mange method call.

Screenshots

Two-step.login._Webauth_.Bitwarden.Web.vault.-.Google.Chrome.2024-05-02.13-42-28.mp4

@KiruthigaManivannan KiruthigaManivannan requested a review from a team as a code owner May 2, 2024 08:13
@github-actions github-actions bot added the needs-qa Marks a PR as requiring QA approval label May 2, 2024
@KiruthigaManivannan
Copy link
Collaborator Author

@rr-bw When I click the read key button , it is not opening the windows authentication using PIN like in QA vault. That may be due to that im running using local host. Because I get the following err ..
image

This error is due to the rp value in publicKeyCredentials passed to navigator. So I think this will work in qa vault

Copy link

codecov bot commented May 2, 2024

Codecov Report

Attention: Patch coverage is 13.04348% with 20 lines in your changes missing coverage. Please review.

Project coverage is 28.16%. Comparing base (419c107) to head (44f1e65).

Files Patch % Lines
...app/auth/settings/two-factor-webauthn.component.ts 14.28% 17 Missing and 1 partial ⚠️
...rc/app/auth/settings/two-factor-setup.component.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9009   +/-   ##
=======================================
  Coverage   28.15%   28.16%           
=======================================
  Files        2432     2432           
  Lines       71563    71575   +12     
  Branches    13372    13373    +1     
=======================================
+ Hits        20146    20156   +10     
- Misses      49830    49831    +1     
- Partials     1587     1588    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented May 2, 2024

Logo
Checkmarx One – Scan Summary & Detailse81efbab-5923-4ec0-9995-5b81842e692d

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Client_Privacy_Violation /apps/browser/src/background/main.background.ts: [1073](https://github.com/bitwarden/clients/blob/PM-2059-update-two-factor-webauthn-dialog//apps/browser/src/background/main.background.ts# L1073) Attack Vector

Copy link
Contributor

@rr-bw rr-bw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I click "Save" I get the following error, are you able to track this down? Everything works fine on main. Let me know if you need help debugging.

Screenshot 2024-05-17 at 11 42 33 AM

@KiruthigaManivannan
Copy link
Collaborator Author

When I click "Save" I get the following error, are you able to track this down? Everything works fine on main. Let me know if you need help debugging.

Screenshot 2024-05-17 at 11 42 33 AM

@rr-bw Actually the issue is when we give name in the name input field , it should read key. Since we already have issue in reading key in local host , webAuthnResponse is null. And actual workflow is if webAuthnResponse is null Save button should be disabled. It should not be enabled and user is unable to click. But here even if the webAuthnResponse is null save is getting enabled. Yes please help me in debugging.

@KiruthigaManivannan
Copy link
Collaborator Author

When I click "Save" I get the following error, are you able to track this down? Everything works fine on main. Let me know if you need help debugging.
Screenshot 2024-05-17 at 11 42 33 AM

@rr-bw Actually the issue is when we give name in the name input field , it should read key. Since we already have issue in reading key in local host , webAuthnResponse is null. And actual workflow is if webAuthnResponse is null Save button should be disabled. It should not be enabled and user is unable to click. But here even if the webAuthnResponse is null save is getting enabled. Yes please help me in debugging.

@rr-bw Please advise on the above

Copy link
Contributor

@rr-bw rr-bw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't let me comment on the specific line, but line 39 of the html file needs updated to tw-text-muted.

@@ -31,6 +33,7 @@ interface Key {
templateUrl: "two-factor-webauthn.component.html",
})
export class TwoFactorWebAuthnComponent extends TwoFactorBaseComponent {
@Output() onChangeStatus = new EventEmitter<boolean>();
type = TwoFactorProviderType.WebAuthn;
name: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do will still need name? Where do we access this property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rr-bw Yes this is used in setup component , to immediately send enabled status to set up component , the enabled tick mark should appear before we close the dialog . so we are using this event emitter.

<li>{{ "twoFactorU2fTouchButton" | i18n }}</li>
<li>{{ "twoFactorU2fSaveForm" | i18n }}</li>
</ol>
<div class="tw-flex tw-flex-row">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tw-flex-row is unnecessary because it is the default.

@rr-bw
Copy link
Contributor

rr-bw commented May 23, 2024

When I click "Save" I get the following error, are you able to track this down? Everything works fine on main. Let me know if you need help debugging.
Screenshot 2024-05-17 at 11 42 33 AM

@rr-bw Actually the issue is when we give name in the name input field , it should read key. Since we already have issue in reading key in local host , webAuthnResponse is null. And actual workflow is if webAuthnResponse is null Save button should be disabled. It should not be enabled and user is unable to click. But here even if the webAuthnResponse is null save is getting enabled. Yes please help me in debugging.

@jlf0dev or @JaredSnider-Bitwarden Would either of you have capacity to help in debugging this? I can't seem to track down the issue. The "save" button is somehow getting enabled when you simply start typing in the name field. It's supposed to remain disabled as long as webAuthnResponse is null. It's almost like form status changes are overriding our [disabled]="!webAuthnResponse" on the "save" button. One odd thing I noticed is that if I remove bitFormButton from the "save" button, it will in fact remain disabled until you Read Key. (But we still then have the problem where clicking "save" gives an error).

@rr-bw
Copy link
Contributor

rr-bw commented Jun 5, 2024

@KiruthigaManivannan Reading the key should now work, and the "save" button will also remain disabled until the appropriate time. Could you now fix the remaining issues when clicking "deactivate all keys". The dialog should close, a toast should appear, and the green check mark next to "FIDO2 WebAuthn" should get removed. Here is a video of the correct deactivate flow on main:

deactivate.mov

@KiruthigaManivannan
Copy link
Collaborator Author

@KiruthigaManivannan Reading the key should now work, and the "save" button will also remain disabled until the appropriate time. Could you now fix the remaining issues when clicking "deactivate all keys". The dialog should close, a toast should appear, and the green check mark next to "FIDO2 WebAuthn" should get removed. Here is a video of the correct deactivate flow on main:

deactivate.mov

@willmartian As you said , save button is working as expected now. But clicking on read key button does not do anything.

image

This occurs not only in this branch , but also in main while running in localhost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-qa Marks a PR as requiring QA approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants