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-15637] Notify Custom Users with “Manage Account Recovery” permission for Device Approval Requests #5359

Conversation

r-tome
Copy link
Contributor

@r-tome r-tome commented Feb 3, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-15637

📔 Objective

While testing #5270 it was noticed that notifications were missing for Custom Users with “Manage Account Recovery” permission

⏰ 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 Feb 3, 2025

Codecov Report

Attention: Patch coverage is 40.00000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 44.22%. Comparing base (617bb50) to head (166e08e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...Console/Repositories/OrganizationUserRepository.cs 0.00% 18 Missing ⚠️
...Console/Repositories/OrganizationUserRepository.cs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5359      +/-   ##
==========================================
- Coverage   44.22%   44.22%   -0.01%     
==========================================
  Files        1492     1492              
  Lines       68869    68911      +42     
  Branches     6203     6203              
==========================================
+ Hits        30460    30475      +15     
- Misses      37089    37116      +27     
  Partials     1320     1320              

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

@r-tome r-tome marked this pull request as ready for review February 3, 2025 17:05
@r-tome r-tome requested review from a team as code owners February 3, 2025 17:05
Copy link
Contributor

github-actions bot commented Feb 3, 2025

Logo
Checkmarx One – Scan Summary & Details00230afd-72c2-4fd8-8ca6-27b4053f9257

New Issues (4)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Missing_HSTS_Header /src/Events/Startup.cs: 12
detailsThe web-application does not define an HSTS header, leaving it vulnerable to attack.
Attack Vector
MEDIUM Privacy_Violation /src/Api/Vault/Models/Request/CipherRequestModel.cs: 173
detailsMethod ToCipherLoginData at line 173 of /src/Api/Vault/Models/Request/CipherRequestModel.cs sends user information outside the application. This ma...
Attack Vector
MEDIUM Privacy_Violation /src/Api/Vault/Models/Request/CipherRequestModel.cs: 202
detailsMethod ToCipherIdentityData at line 202 of /src/Api/Vault/Models/Request/CipherRequestModel.cs sends user information outside the application. This...
Attack Vector
LOW Log_Forging /src/Api/Vault/Controllers/CiphersController.cs: 959
detailsMethod PostPurge at line 959 of /src/Api/Vault/Controllers/CiphersController.cs gets user input from element model. This element’s value flows thro...
Attack Vector
Fixed Issues (7)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 124
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 110
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 997
MEDIUM CSRF /src/Api/Billing/Controllers/OrganizationSponsorshipsController.cs: 76
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 737
MEDIUM CSRF /src/Api/Billing/Controllers/OrganizationSponsorshipsController.cs: 162
LOW Heap_Inspection /src/Core/Services/Implementations/RabbitMqEventListenerService.cs: 29

@@ -297,10 +297,34 @@ private async Task NotifyAdminsOfDeviceApprovalRequestAsync(OrganizationUser org
return;
}

var admins = await _organizationUserRepository.GetManyByMinimumRoleAsync(
var adminEmails = await GetAdminAndAccountRecoveryEmailsAsync(organizationUser.OrganizationId);
Copy link
Contributor

Choose a reason for hiding this comment

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

None-blocking question: I guess it's safe to say that adminEmails will never be empty because an organization will have at least one owner?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly! We always check if an organization has at least one confirmed owner when updating/removing a user.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Looks good, also curious about the answer to JimmyVo16's question.

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

…mail-notification-for-device-approval-requests
Copy link

sonarqubecloud bot commented Feb 5, 2025

@r-tome r-tome merged commit 03c390d into main Feb 5, 2025
57 checks passed
@r-tome r-tome deleted the ac/pm-15637/custom-manage-account-recovery-email-notification-for-device-approval-requests branch February 5, 2025 14:47
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