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

[$250] Expense - User invited to the expense report can hold the expenses #48306

Closed
6 tasks done
IuliiaHerets opened this issue Aug 29, 2024 · 54 comments
Closed
6 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Help Wanted Apply this label when an issue is open to proposals by contributors Hot Pick Ready for an engineer to pick up and run with Internal Requires API changes or must be handled by Expensify staff Monthly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 29, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.0.26-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp https://expensify.testrail.io/index.php?/tests/view/4901045
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. [User A] Submit two expenses to User B
  3. [User A] Click on the expense preview in the main chat to go to expense report
  4. [User A] Send a user mention containing User C
  5. [User A] Click Invite from the whisper message
  6. [User A] Send a message in the transaction thread
  7. [User C] Open the invited expense report
  8. [User C] Click on any expense.
  9. [User C] Click on the header > Hold.
  10. [User C] Hold the expense.

Expected Result:

Invited user (User C) should not be able to hold the expenses.

Actual Result:

Invited user can hold the expenses.

Workaround:

Unknown

Platforms:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6586341_1724925332136.20240829_174948.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021831812891788709823
  • Upwork Job ID: 1831812891788709823
  • Last Price Increase: 2024-09-19
Issue OwnerCurrent Issue Owner: @abdulrahuman5196
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 29, 2024
Copy link

melvin-bot bot commented Aug 29, 2024

Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@IuliiaHerets
Copy link
Author

@abekkala FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@Krishna2323
Copy link
Contributor

Proposal


Please re-state the problem that we are trying to solve in this issue.

Expense - User invited to the expense report can hold the expenses

What is the root cause of that problem?

The canHoldUnholdReportAction function does not return the values correctly, for canHoldOrUnholdRequest constant we haven't included (isAdmin || isActionOwner || isApprover) check.

App/src/libs/ReportUtils.ts

Lines 3071 to 3085 in a37a613

const isApprover = isMoneyRequestReport(moneyRequestReport) && moneyRequestReport?.managerID !== null && currentUserPersonalDetails?.accountID === moneyRequestReport?.managerID;
const isAdmin = isPolicyAdmin(moneyRequestReport.policyID ?? '-1', allPolicies);
const isOnHold = TransactionUtils.isOnHold(transaction);
const isScanning = TransactionUtils.hasReceipt(transaction) && TransactionUtils.isReceiptBeingScanned(transaction);
const isClosed = isClosedReport(moneyRequestReport);
const canModifyStatus = !isTrackExpenseMoneyReport && (isAdmin || isActionOwner || isApprover);
const canModifyUnholdStatus = !isTrackExpenseMoneyReport && (isAdmin || (isActionOwner && isHoldActionCreator) || isApprover);
const isDeletedParentAction = isEmptyObject(parentReportAction) || ReportActionsUtils.isDeletedAction(parentReportAction);
const canHoldOrUnholdRequest = !isRequestSettled && !isApproved && !isDeletedParentAction && !isClosed;
const canHoldRequest = canHoldOrUnholdRequest && !isOnHold && (isRequestIOU || canModifyStatus) && !isScanning && !!transaction?.reimbursable;
const canUnholdRequest =
!!(canHoldOrUnholdRequest && isOnHold && !TransactionUtils.isDuplicate(transaction.transactionID, true) && (isRequestIOU ? isHoldActionCreator : canModifyUnholdStatus)) &&
!!transaction?.reimbursable;

What changes do you think we should make in order to solve the problem?


We have few options to resolve this:

  1. Update the canHoldOrUnholdRequest constant to !isRequestSettled && !isApproved && !isDeletedParentAction && !isClosed && (isAdmin || isActionOwner || isApprover);
  2. Update the (isRequestIOU || canModifyStatus) part in canHoldRequest to (isRequestIOU && canModifyStatus) or just remove isRequestIOU, as it seems redundant.
    const canHoldRequest = canHoldOrUnholdRequest && !isOnHold && (isRequestIOU || canModifyStatus) && !isScanning && !!transaction?.reimbursable;
  3. We can early return when !isAdmin && !isApprover && !isActionOwner is true.
    if (!isAdmin && !isApprover && !isActionOwner) {
        return {canHoldRequest: false, canUnholdRequest: false};
    }

NOTE: Minor refactor may be required if we go with any of the solution above.

What alternative solutions did you explore? (Optional)

Result

@melvin-bot melvin-bot bot added the Overdue label Sep 2, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

@abekkala Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Sep 4, 2024

@abekkala Huh... This is 4 days overdue. Who can take care of this?

@abekkala abekkala added the External Added to denote the issue can be worked on by a contributor label Sep 5, 2024
@melvin-bot melvin-bot bot changed the title Expense - User invited to the expense report can hold the expenses [$250] Expense - User invited to the expense report can hold the expenses Sep 5, 2024
Copy link

melvin-bot bot commented Sep 5, 2024

Job added to Upwork: https://www.upwork.com/jobs/~021831812891788709823

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 5, 2024
Copy link

melvin-bot bot commented Sep 5, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External)

@raza-ak
Copy link
Contributor

raza-ak commented Sep 6, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue

Expense - User invited to the expense report can hold the expenses

What is the root cause of that problem?

The problem arises because the system currently does not properly verify if the logged-in user is the same as the creator of the expense. This results in users who did not create the expense being able to access or hold it, violating access control rules.

What changes do you think we should make in order to solve the problem?

To fix this issue, we need to update the function responsible for opening the "hold" modal. The change will ensure that access is granted only if the email of the logged-in user matches the email of the user who created the expense.The following changes in the component should resolve the issue:

Update Access Logic: Modify the function that handles opening the hold modal to verify that the logged-in user's email matches the expense creator's email (reportAction.email).

Conditional Access: Implement conditional logic to ensure that only users with matching emails are allowed to proceed.

Following changes will fix the issue:

IMG-20240906-WA0002

365193203-876ce5fa-0b1b-4b19-b67a-54cfeeb9fef0.1.mp4

Copy link

melvin-bot bot commented Sep 9, 2024

@abekkala, @abdulrahuman5196 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot melvin-bot bot added the Overdue label Sep 9, 2024
@abekkala
Copy link
Contributor

abekkala commented Sep 9, 2024

@abdulrahuman5196 can you please review the proposal?

Copy link

melvin-bot bot commented Sep 11, 2024

@abekkala, @abdulrahuman5196 Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot removed the Overdue label Sep 11, 2024
@abekkala
Copy link
Contributor

@abdulrahuman5196, do you have any comments on the proposal you've reviewed?

Copy link

melvin-bot bot commented Sep 12, 2024

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

Copy link

melvin-bot bot commented Sep 17, 2024

@abekkala, @abdulrahuman5196 Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot added the Overdue label Sep 17, 2024
@abdulrahuman5196
Copy link
Contributor

Sorry for the delay. Checking now.

@melvin-bot melvin-bot bot removed the Overdue label Sep 17, 2024
@abdulrahuman5196
Copy link
Contributor

@abekkala The backend API to hold/unhold is also passing. @Krishna2323 solution could fix the problem in frontend but still for backend we need internal fix. Could you loop in internal engineer for this issue?

@Krishna2323
Copy link
Contributor

@abdulrahuman5196 @abekkala, can't we just add the C+ reviewed label so that the internal engineer is auto assigned?

@abekkala
Copy link
Contributor

@Krishna2323 no, hot picks require an internal engineer volunteer to pick up (typically someone who would be familiar with the feature) vs. an engineer being auto assigned.

@melvin-bot melvin-bot bot added the Overdue label Oct 24, 2024
Copy link

melvin-bot bot commented Oct 24, 2024

@abekkala, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Oct 28, 2024

@abekkala, @abdulrahuman5196 Still overdue 6 days?! Let's take care of this!

Copy link

melvin-bot bot commented Oct 30, 2024

@abekkala, @abdulrahuman5196 Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

Copy link

melvin-bot bot commented Nov 1, 2024

@abekkala, @abdulrahuman5196 10 days overdue. Is anyone even seeing these? Hello?

@abekkala
Copy link
Contributor

abekkala commented Nov 6, 2024

still waiting on internal pick up

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Nov 11, 2024
Copy link

melvin-bot bot commented Nov 11, 2024

This issue has not been updated in over 14 days. @abekkala, @abdulrahuman5196 eroding to Weekly issue.

@melvin-bot melvin-bot bot removed the Overdue label Nov 11, 2024
@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Nov 11, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

@melvin-bot melvin-bot bot added the Overdue label Nov 29, 2024
@abekkala
Copy link
Contributor

abekkala commented Dec 4, 2024

I'll wait until the 3rd week of attempted retest before closing

@melvin-bot melvin-bot bot added Monthly KSv2 and removed Weekly KSv2 labels Dec 5, 2024
Copy link

melvin-bot bot commented Dec 5, 2024

This issue has not been updated in over 15 days. @abekkala, @abdulrahuman5196 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot removed the Overdue label Dec 5, 2024
@mvtglobally
Copy link

Issue not reproducible during KI retests. (Third week)

@github-project-automation github-project-automation bot moved this from Bugs and Follow Up Issues to Done in [#whatsnext] #expense Dec 11, 2024
@abdulrahuman5196
Copy link
Contributor

If a contributor has been hired for a job and we decide to close the job before it is successfully completed
50% payment to contributor and C+ if the contributor was 🎀👀🎀 by a C+ or hired/assigned.

@abekkala I think this issue should be partially compensated since were already having an approved proposal but waiting on internal engineer assignment - #48306 (comment).

Copy link

melvin-bot bot commented Dec 17, 2024

Triggered auto assignment to @mjasikowski, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@abdulrahuman5196
Copy link
Contributor

Sorry @mjasikowski, I think the melvin bot wrongly assigned you since the c+ approved emoji was present

@abdulrahuman5196
Copy link
Contributor

If a contributor has been hired for a job and we decide to close the job before it is successfully completed
50% payment to contributor and C+ if the contributor was by a C+ or hired/assigned.

@abekkala I think this issue should be partially compensated since were already having an approved proposal but waiting on internal engineer assignment - #48306 (comment).

@abekkala Gentle ping on this

@Krishna2323
Copy link
Contributor

@abekkala, friendly bump to check this comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Help Wanted Apply this label when an issue is open to proposals by contributors Hot Pick Ready for an engineer to pick up and run with Internal Requires API changes or must be handled by Expensify staff Monthly KSv2
Projects
Status: Done
Development

No branches or pull requests

8 participants