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-5093][PM-7325] Added trial initiation email verification endpoint #4221

Merged
merged 8 commits into from
Jul 29, 2024

Conversation

cturnbull-bitwarden
Copy link
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-5093
https://bitwarden.atlassian.net/browse/PM-7325

📔 Objective

This pull request adds a billing controller src\Identity\Billing\Controller\AccountsController.cs with the single endpoint PostTrialInitiationSendVerificationEmailAsync. This endpoint is behind Auth's feature flag email-verification as it relies on their work.

This PR duplicates some of the work done in #4173 but places it in billing-owned code related to initiating a new trial.

📸 Screenshots

⏰ 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

@cturnbull-bitwarden cturnbull-bitwarden requested a review from a team as a code owner June 24, 2024 14:46

if (!globalSettings.EnableEmailVerification)
{
await PerformConstantTimeOperationsAsync();
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Not a blocker, just curious what the Task.Delay is for?

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 question, I just pushed a change adding an explanatory comment. The idea is to mitigate timing attacks where an attacker can detect if a user exists based on how long the request takes to complete

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 4.25532% with 90 lines in your changes missing coverage. Please review.

Project coverage is 41.59%. Comparing base (1e01820) to head (92b09b8).
Report is 1 commits behind head on main.

Files Patch % Lines
.../SendTrialInitiationEmailForRegistrationCommand.cs 0.00% 34 Missing ⚠️
.../Identity/Billing/Controller/AccountsController.cs 0.00% 24 Missing ⚠️
.../Services/Implementations/HandlebarsMailService.cs 0.00% 16 Missing ⚠️
.../Billing/Models/Mail/TrialInititaionVerifyEmail.cs 0.00% 11 Missing ⚠️
...re/Services/NoopImplementations/NoopMailService.cs 0.00% 3 Missing ⚠️
...Accounts/TrialSendVerificationEmailRequestModel.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4221      +/-   ##
==========================================
- Coverage   41.65%   41.59%   -0.07%     
==========================================
  Files        1271     1276       +5     
  Lines       60197    60294      +97     
  Branches     5528     5534       +6     
==========================================
+ Hits        25078    25082       +4     
- Misses      33949    34042      +93     
  Partials     1170     1170              

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

Copy link
Contributor

github-actions bot commented Jun 24, 2024

Logo
Checkmarx One – Scan Summary & Detailsda171b59-3764-4730-bc7f-7f786858c23f

New Issues

Severity Issue Source File / Package Checkmarx Insight
LOW Unsafe_Use_Of_Target_blank /src/Core/MailTemplates/Handlebars/Billing/TrialInitiationVerifyEmail.html.hbs: 17 Attack Vector

@cturnbull-bitwarden cturnbull-bitwarden merged commit 656e0c2 into main Jul 29, 2024
49 checks passed
@cturnbull-bitwarden cturnbull-bitwarden deleted the billing/PM-5093/send-trial-initiation-email branch July 29, 2024 18:18
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.

2 participants