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

Auth/PM-8113 - 2FA Components Consolidation and UI Refresh #12087

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

Conversation

JaredSnider-Bitwarden
Copy link
Contributor

@JaredSnider-Bitwarden JaredSnider-Bitwarden commented Nov 21, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-8113
Associated Server PR: bitwarden/server#5120

📔 Objective

To consolidate all the cross client 2FA components into single implementation components delegating all client specific logic into services while updating the UIs to match the new design.

This PR is unfortunately quite large, but a ton of the file changes are renames or moves.

📸 Screenshots

To avoid slowing down the PR loading massively, each of the below videos are linked using a thumbnail which downloads the videos instead of directly rendering them inline.

Web

Web - Standard MP Login Scenarios

Email Authenticator Duo WebAuthn Yubikey Select Other Method + Recovery Code Demo
Email Video Authenticator Video Duo Video WebAuthn Video Yubikey Video Recovery Code Demo

Web - SSO Scenarios

Note: remember me does not currently work with SSO, but that is being addressed separately.

SSO + MP Decryption + Standard 2FA Flow works SSO + MP Decryption + Require 2FA Policy - JIT works SSO + TDE + Require 2FA Policy - JIT works SSO + TDE + Standard 2FA Flow works
SSO + MP Decryption + Standard 2FA Flow works SSO + MP Decryption + Require 2FA Policy - JIT works SSO + TDE + Require 2FA Policy - JIT works SSO + TDE + Standard 2FA Flow works

Desktop

Desktop - Standard MP Login Scenarios

Email Authenticator Duo WebAuthn Yubikey Select Other Method + Recovery Code Demo
Email Video Authenticator Video Duo Video WebAuthn Video Yubikey Video Recovery Code Demo

Extension

Extension - Chrome - Standard MP Login Scenarios

Note: WebAuthn is now done inline in Chrome instead of in a new tab like we have to do for other Browsers until we rebuild the WebAuthn flows with better support.

Email Authenticator Duo WebAuthn Yubikey Select Other Method + Recovery Code Demo
Email Video Authenticator Video Duo Video WebAuthn Video Yubikey Video Recovery Code Demo

Extension - Firefox - Standard MP Login Scenarios

Email Authenticator Duo WebAuthn Yubikey Select Other Method + Recovery Code Demo
Email Video Authenticator Video Duo Video WebAuthn Video Yubikey Video Recovery Code Demo

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 46.81979% with 301 lines in your changes missing coverage. Please review.

Project coverage is 35.42%. Comparing base (f798760) to head (1c8c9f4).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...gular/two-factor-auth/two-factor-auth.component.ts 39.23% 96 Missing and 31 partials ⚠️
...uth-webauthn/two-factor-auth-webauthn.component.ts 6.89% 26 Missing and 1 partial ⚠️
apps/web/src/connectors/webauthn.ts 0.00% 26 Missing ⚠️
...ctor-auth-email/two-factor-auth-email.component.ts 12.00% 22 Missing ⚠️
...o-factor-auth-duo/two-factor-auth-duo.component.ts 37.50% 16 Missing and 4 partials ⚠️
apps/web/src/connectors/webauthn-fallback.ts 0.00% 12 Missing ⚠️
...ar/two-factor-auth/two-factor-options.component.ts 45.00% 10 Missing and 1 partial ⚠️
apps/browser/src/popup/services/services.module.ts 0.00% 5 Missing ⚠️
...-auth/default-two-factor-auth-component.service.ts 0.00% 5 Missing ⚠️
libs/auth/src/angular/two-factor-auth/index.ts 0.00% 5 Missing ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12087      +/-   ##
==========================================
+ Coverage   35.28%   35.42%   +0.13%     
==========================================
  Files        3127     3151      +24     
  Lines       92612    92715     +103     
  Branches    16809    16829      +20     
==========================================
+ Hits        32677    32842     +165     
+ Misses      57495    57411      -84     
- Partials     2440     2462      +22     

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

Copy link
Contributor

github-actions bot commented Nov 22, 2024

Logo
Checkmarx One – Scan Summary & Detailsb8586bf5-983f-40b3-8218-97fea1285230

Great job, no security vulnerabilities found in this Pull Request

…en top level page component and child components
…tor-auth and move all logic into single component - WIP
…ulLoginNavigate (3) after successful login we always loginEmailService.clearValues()
coroiu
coroiu previously approved these changes Feb 11, 2025
@JaredSnider-Bitwarden
Copy link
Contributor Author

JaredSnider-Bitwarden commented Feb 13, 2025

@rr-bw , I've added TDE offboarding support to the flows.

Here's my tests:
Web:
Web

Extension:
Extension

Desktop:
Desktop

coroiu
coroiu previously approved these changes Feb 13, 2025
Copy link
Contributor

@coroiu coroiu left a comment

Choose a reason for hiding this comment

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

No platform changes, approving

coroiu
coroiu previously approved these changes Feb 13, 2025
ItemModule,
IconModule,
],
providers: [],
})
export class TwoFactorOptionsComponent implements OnInit {
@Output() onProviderSelected = new EventEmitter<TwoFactorProviderType>();
@Output() onRecoverSelected = new EventEmitter();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the onProviderSelected and onRecoverSelected outputs are actually being used in the new flow. Also, I'd think you can remove the concept of "recover" entirely from this component (and the TwoFactorOptionsDialogResult enum) since the recovery code button is now being shown as an option directly on the 2FA screen. If I'm correct, address also the reference to TwoFactorOptionsDialogResult in selectOtherTwoFactorMethod() on TwoFactorAuthComponent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

},
"selectAnotherMethod": {
"message": "Select another method",
"desccription": "Select another two-step login method"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"desccription": "Select another two-step login method"
"description": "Select another two-step login method"

Copy link
Contributor Author

@JaredSnider-Bitwarden JaredSnider-Bitwarden Feb 19, 2025

Choose a reason for hiding this comment

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

Oops! Thank you for catching that!
4376f0e

"sendVerificationCodeEmailAgain": {
"message": "Send verification code email again"
},
"useAnotherTwoStepMethod": {
"message": "Use another two-step login method"
},
"selectAnotherMethod": {
"message": "Select another method",
"desccription": "Select another two-step login method"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"desccription": "Select another two-step login method"
"description": "Select another two-step login method"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"sendVerificationCodeEmailAgain": {
"message": "Send verification code email again"
},
"useAnotherTwoStepMethod": {
"message": "Use another two-step login method"
},
"selectAnotherMethod": {
"message": "Select another method",
"desccription": "Select another two-step login method"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"desccription": "Select another two-step login method"
"description": "Select another two-step login method"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

<path class="tw-fill-art-primary"" fill-rule="evenodd"
d="M13.281 25.298h-3.68V23.81h3.68v1.488ZM19.907 25.298h-3.68V23.81h3.68v1.488Z"
clip-rule="evenodd" />
<path stroke="#2CDDE9" stroke-width=".784"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

<path class="tw-fill-art-accent"
d="M67.118 46.886a1.062 1.062 0 0 0-.138-.531 1.037 1.037 0 0 0-.381-.386 1.006 1.006 0 0 0-1.037.018 1.059 1.059 0 0 0-.324 1.46c.099.156.237.283.4.366v1.716a.48.48 0 0 0 .126.347.461.461 0 0 0 .333.147.446.446 0 0 0 .333-.147.482.482 0 0 0 .125-.347V47.81c.168-.086.31-.219.409-.382.099-.163.152-.35.154-.543Zm5.37-6.916h-.565a.337.337 0 0 1-.312-.215.358.358 0 0 1-.026-.133v-.255a5.896 5.896 0 0 0-1.374-3.901 5.645 5.645 0 0 0-3.567-1.972 5.4 5.4 0 0 0-2.268.263c-.73.248-1.4.65-1.97 1.181a5.634 5.634 0 0 0-1.332 1.896 5.75 5.75 0 0 0-.468 2.286v.413c0 .008-.03.434-.392.44h-.509a1.686 1.686 0 0 0-1.203.514c-.32.328-.498.772-.497 1.234v10.37c0 .463.178.907.497 1.234.318.328.75.515 1.203.518h12.783c.452-.003.884-.189 1.202-.517.319-.328.497-.772.497-1.234V41.721a1.776 1.776 0 0 0-.495-1.235 1.71 1.71 0 0 0-.552-.38 1.665 1.665 0 0 0-.653-.136h.001Zm-10.637-.85a4.442 4.442 0 0 1 .41-1.877 4.346 4.346 0 0 1 1.16-1.515 4.218 4.218 0 0 1 1.685-.855 4.17 4.17 0 0 1 1.881-.029 4.335 4.335 0 0 1 2.436 1.596c.61.8.934 1.79.918 2.806v.376a.358.358 0 0 1-.1.246.336.336 0 0 1-.24.102h-7.63a.468.468 0 0 1-.352-.115.51.51 0 0 1-.169-.336v-.399h.001Zm11.091 12.97a.477.477 0 0 1-.133.332.45.45 0 0 1-.322.139H59.705a.445.445 0 0 1-.323-.139.46.46 0 0 1-.132-.331V41.72a.474.474 0 0 1 .132-.331.456.456 0 0 1 .321-.138h12.784c.121 0 .237.05.322.138a.473.473 0 0 1 .133.33v10.37Z" />
</g>
<path class="tw-fill-art-primary"" fill-rule="evenodd"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<path class="tw-fill-art-primary"" fill-rule="evenodd"
<path class="tw-fill-art-primary" fill-rule="evenodd"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clip-rule="evenodd" />
<path class="tw-fill-art-accent"
d="M100.357 80.991a.382.382 0 0 0-.382-.382H73.651a.382.382 0 0 0 0 .765h26.324c.211 0 .382-.171.382-.383ZM65.693 77.56c-2.04-3.686-5.74-6.133-9.95-6.133-.895 0-1.766.11-2.602.319a.382.382 0 0 1-.184-.743 11.478 11.478 0 0 1 2.785-.341c4.52 0 8.46 2.627 10.618 6.528a14.09 14.09 0 0 1 1.563 4.503.382.382 0 1 1-.752.126 13.324 13.324 0 0 0-1.478-4.258Z" />
<path class="tw-fill-art-primary" fill-rule="evenodd" stroke="#020F66" stroke-width=".355"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...twofactorRefactorSwap(
TwoFactorComponent,
...unauthUiRefreshSwap(
TwoFactorComponentV1,
AnonLayoutWrapperComponent,
{
path: "2fa",
},
{
path: "2fa",
component: AnonLayoutWrapperComponent,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you check if we can avoid re-declaring AnonLayoutWrapperComponent here? (line 87 and 93)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, we can remove the inner component property but not the outer one: 1c8c9f4

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this empty file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I've removed it here: ac0b80f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants