-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[PM-24618] Integrate CLI sends with server branch #18106
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
6983929
68323dd
913a6ad
e8794cf
e2659d6
705bc2b
5ea4414
0fd81fa
07eb16d
51f920d
f31aca2
4d486aa
94b4b11
06bc0d5
0f611a7
70a222b
42691b7
ff81b34
c8c7f8b
02a3b6b
d27a9b4
6014a7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service"; | |
| import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; | ||
| import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service"; | ||
| import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; | ||
| import { AuthType } from "@bitwarden/common/tools/send/models/domain/send"; | ||
| import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; | ||
| import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; | ||
| import { NodeUtils } from "@bitwarden/node/node-utils"; | ||
|
|
@@ -87,6 +88,15 @@ export class SendCreateCommand { | |
|
|
||
| req.key = null; | ||
| req.maxAccessCount = maxAccessCount; | ||
| req.emails = emails; | ||
|
|
||
| if (emails != null && emails.length > 0) { | ||
|
||
| req.authType = AuthType.Email; | ||
| } else if (password != null && password.trim().length > 0) { | ||
mcamirault marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| req.authType = AuthType.Password; | ||
| } else { | ||
| req.authType = AuthType.None; | ||
| } | ||
itsadrago marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const hasPremium$ = this.accountService.activeAccount$.pipe( | ||
| switchMap(({ id }) => this.accountProfileService.hasPremiumFromAnySource$(id)), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| // @ts-strict-ignore | ||
| import { Utils } from "@bitwarden/common/platform/misc/utils"; | ||
| import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; | ||
| import { AuthType } from "@bitwarden/common/tools/send/models/domain/send"; | ||
| import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; | ||
|
|
||
| import { BaseResponse } from "../../../models/response/base.response"; | ||
|
|
@@ -92,6 +93,7 @@ export class SendResponse implements BaseResponse { | |
| emails?: Array<string>; | ||
| disabled: boolean; | ||
| hideEmail: boolean; | ||
| authType: AuthType; | ||
|
|
||
| constructor(o?: SendView, webVaultUrl?: string) { | ||
| if (o == null) { | ||
|
|
@@ -116,8 +118,10 @@ export class SendResponse implements BaseResponse { | |
| this.deletionDate = o.deletionDate; | ||
| this.expirationDate = o.expirationDate; | ||
| this.passwordSet = o.password != null; | ||
| this.emails = o.emails ?? []; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. โ CRITICAL: Missing Details and fixThe constructor (lines 98-132) creates a Current state:
Fix needed in view.emails = send.emails ?? [];
view.disabled = send.disabled;
view.hideEmail = send.hideEmail;
view.authType = send.authType; // Add this line
return view;Impact: The |
||
| this.disabled = o.disabled; | ||
| this.hideEmail = o.hideEmail; | ||
| this.authType = o.authType; | ||
|
|
||
| if (o.type === SendType.Text && o.text != null) { | ||
| this.text = new SendTextResponse(o.text); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
authTypecalculated but never assigned to encrypted send before API callDetails and fix
Lines 93-99 calculate
req.authTypebased on whether emails or password is provided, but this value is never transferred toencSendbefore the API save at line 154.Looking at line 152:
encSend.emails = emails && emails.join(",");- the emails are assigned, butauthTypeis not.Fix needed around line 152:
Impact: The server receives sends without the
authTypefield, potentially breaking email-based OTP authentication or causing it to default incorrectly.