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-15614] Allow Users to opt out of new device verification #5176

Merged
merged 7 commits into from
Jan 8, 2025

Conversation

ike-kottlowski
Copy link
Contributor

@ike-kottlowski ike-kottlowski commented Dec 21, 2024

🎟️ Tracking

PM-15614

📔 Objective

Some users would like to be able to turn off the new device verification feature. This PR is to enable that decision.

However, turning this off will reduce overall security of your account if you do not already have 2FA enabled.

📸 Screenshots

User is able to login when dbo.User.VerifyDevices is set to false (0)

PRRh7o4c8a.mp4

Transcript

User tries to login and is met with New Device Verification prompt. dbo.User.VerifyDevices is changed to false (0); user attempts to login again and are allowed to authenticate this time. dbo.User.VerifyDevices is set back to true (1); User tries to authenticate again and is successful again because the device has been saved as a knowndevice.

⏰ 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

…r has opted out of device verification.

Added endpoint to AccountsController.cs to allow editing of new User.VerifyDevices property.
…t. Removed Anon attribute from the POST account/verify-devices endpoint.
…fyDevices.

Added update to verify email to the new device verification flow.
Copy link
Contributor

github-actions bot commented Dec 21, 2024

Logo
Checkmarx One – Scan Summary & Details5e4784e3-ced6-4e85-9673-3ce396967f2e

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 967 Attack Vector
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 975 Attack Vector
LOW Log_Forging /src/Api/Auth/Controllers/AccountsController.cs: 967 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 967
MEDIUM CSRF /src/Api/NotificationCenter/Controllers/NotificationsController.cs: 67
MEDIUM CSRF /src/Api/NotificationCenter/Controllers/NotificationsController.cs: 61
LOW Log_Forging /src/Api/Auth/Controllers/AccountsController.cs: 967

@ike-kottlowski ike-kottlowski requested a review from a team as a code owner December 26, 2024 20:29
Copy link

codecov bot commented Dec 26, 2024

Codecov Report

Attention: Patch coverage is 73.68421% with 5 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@eb9a061). Learn more about missing BASE report.
Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
...dentityServer/RequestValidators/DeviceValidator.cs 37.50% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5176   +/-   ##
=======================================
  Coverage        ?   43.34%           
=======================================
  Files           ?     1459           
  Lines           ?    66510           
  Branches        ?     6082           
=======================================
  Hits            ?    28831           
  Misses          ?    36387           
  Partials        ?     1292           

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

Copy link
Contributor

@Patrick-Pimentel-Bitwarden Patrick-Pimentel-Bitwarden left a comment

Choose a reason for hiding this comment

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

Looks good! And thank you for the good tests! Approving but wouldn't mind feedback on the question about a global const. Nothing blocking.


if (!await _userService.VerifySecretAsync(user, request.Secret))
{
await Task.Delay(2000);
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we delay for this specific duration? Could we turn this into a global const that we can reference? I imagine we do this in other places too.

Copy link
Contributor Author

@ike-kottlowski ike-kottlowski Jan 8, 2025

Choose a reason for hiding this comment

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

We do it a lot in other places but I'm only perpetuating the tradition. Historically I believe this has been used to reduce the efficacy of bot brute forcing. But I'm not sure what our current bot mitigation posture is.
cc: @Hinton

@@ -128,6 +130,8 @@ public async Task SignUp_SM_Passes(PlanType planType, OrganizationSignup signup,
signup.PaymentMethodType = PaymentMethodType.Card;
signup.PremiumAccessAddon = false;
signup.IsFromSecretsManagerTrial = false;
signup.IsFromProvider = false;

Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick - extra line.

Copy link
Contributor

@rkac-bw rkac-bw left a comment

Choose a reason for hiding this comment

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

lgtm

@ike-kottlowski ike-kottlowski merged commit a84ef07 into main Jan 8, 2025
56 checks passed
@ike-kottlowski ike-kottlowski deleted the auth/pm-15614/allow-new-device-opt-out branch January 8, 2025 15:31
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.

4 participants