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 183 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.30996% with 291 lines in your changes missing coverage. Please review.

Project coverage is 35.47%. Comparing base (f827b97) to head (84323f3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...gular/two-factor-auth/two-factor-auth.component.ts 39.15% 98 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 22.22% 13 Missing and 1 partial ⚠️
apps/web/src/connectors/webauthn-fallback.ts 0.00% 12 Missing ⚠️
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 ⚠️
...ar/two-factor-auth/two-factor-options.component.ts 28.57% 5 Missing ⚠️
... and 26 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12087      +/-   ##
==========================================
+ Coverage   35.31%   35.47%   +0.16%     
==========================================
  Files        3128     3148      +20     
  Lines       92601    92591      -10     
  Branches    16826    16814      -12     
==========================================
+ Hits        32702    32850     +148     
+ Misses      57439    57267     -172     
- Partials     2460     2474      +14     

☔ 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 & Details4e4d9c88-bff9-4de2-b064-9eee59aaf643

New Issues (4)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
HIGH CVE-2025-0995 Npm-electron-34.0.0 Vulnerable Package
HIGH CVE-2025-0996 Npm-electron-34.0.0 Vulnerable Package
HIGH CVE-2025-0997 Npm-electron-34.0.0 Vulnerable Package
HIGH CVE-2025-0998 Npm-electron-34.0.0 Vulnerable Package

…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()
@JaredSnider-Bitwarden JaredSnider-Bitwarden changed the title Auth/PM-8113 - 2FA Components UI Refresh Auth/PM-8113 - 2FA Components Consolidation and UI Refresh Feb 9, 2025
@JaredSnider-Bitwarden JaredSnider-Bitwarden marked this pull request as ready for review February 9, 2025 20:34
@JaredSnider-Bitwarden JaredSnider-Bitwarden requested review from a team as code owners February 9, 2025 20:34
…ructure for auth component client logic services.
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

</ng-container>

<!-- Buttons -->
<div class="tw-flex tw-flex-col tw-space-y-3 tw-mb-3">
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
<div class="tw-flex tw-flex-col tw-space-y-3 tw-mb-3">
<div class="tw-flex tw-flex-col tw-space-y-3">

AnonLayout already has padding built-in.

loading = true;

orgSsoIdentifier: string | undefined = undefined;
inSsoFlow = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is inSsoFlow used anywhere? It's assigned in ngOnInit() but I don't think it's ever used.

// than usual to avoid cutting off the dialog.
const isLinux = await this.isLinux();
if (selected2faProviderType === TwoFactorProviderType.WebAuthn && isLinux) {
document.body.classList.add("linux-webauthn");
Copy link
Contributor

Choose a reason for hiding this comment

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

.linux-webauthn is an SCSS class. Do we want this in a Tailwind file?

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.

ItemModule,
IconModule,
],
providers: [],
})
export class TwoFactorOptionsComponent implements OnInit {
@Output() onProviderSelected = new EventEmitter<TwoFactorProviderType>();
@Output() onRecoverSelected = new EventEmitter();

providers: any[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for the 4 uses of any in this file?

}
};

async selectOtherTwofactorMethod() {
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
async selectOtherTwofactorMethod() {
async selectOtherTwoFactorMethod() {

bitButton
bitFormButton
*ngIf="twoFactorProviders?.size > 1"
(click)="selectOtherTwofactorMethod()"
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
(click)="selectOtherTwofactorMethod()"
(click)="selectOtherTwoFactorMethod()"

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