Skip to content

[$250] Security - Full copilot does not have access to change level, but can remove themself #78105

Closed

Description

@jponikarchuk

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: 9.2.82-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #76792
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: MacBook Air 15.6.1 Chrome
App Component: User Settings

Action Performed:

  1. Sign in to ND as User A and User B in different tabs or devices
  2. User A, add User B as a Limited Copilot
  3. User B, navigate to Profile and switch the account to User A's
  4. User B, open Security page, click 3 dot menu next to copilot
  5. Click "Change access level" and "Remove copilot" - "Not so fast" modal appears
  6. User A, change copilot access for User B to Full
  7. User B - note that the account was automatically switched to the original (copilot mode was exited)
  8. User B, enter a copilot mode again and repeat steps 4-5

Expected Result:

Step 7 - User does not exit copilot mode automatically when the access level was changed
Step 8 - Full copilot is able to change their access level or the "Not so fast" modal is the same as for Limited Copilot
Step 8 - Full copilot is not able to remove their own copilot

Actual Result:

Step 7 - User exits copilot mode automatically when the access level was changed (Web)
Step 8 - Full copilot is not able to change their access level. "Not so fast. As a copilot, you don't have access to this page. Sorry!" RHP is displayed (Web and iOS)
Step 8 - Full copilot can remove their own copilot (Web and iOS)

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022002016522358316810
  • Upwork Job ID: 2002016522358316810
  • Last Price Increase: 2025-12-19
  • Automatic offers:
    • ChavdaSachin | Contributor | 109902171
Issue OwnerCurrent Issue Owner: @laurenreidexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 19, 2025
  2. melvin-bot commented on Dec 19, 2025

    @melvin-bot

    Triggered auto assignment to @sakluger (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.

  3. changed the title [-]Full copilot does not have access to change level, but can remove themself[/-] [+] Security - Full copilot does not have access to change level, but can remove themself[/+] on Dec 19, 2025
  4. daledah commented on Dec 19, 2025

    @daledah
    Contributor

    Proposal

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

    Step 7 - User exits copilot mode automatically when the access level was changed (Web)
    Step 8 - Full copilot is not able to change their access level. "Not so fast. As a copilot, you don't have access to this page. Sorry!" RHP is displayed (Web and iOS)
    Step 8 - Full copilot can remove their own copilot (Web and iOS)

    What is the root cause of that problem?

    We don't check the delegates can remove themselves here

    {
    text: translate('delegate.removeCopilot'),
    icon: Expensicons.Trashcan,
    onPress: () => {
    if (isDelegateAccessRestricted) {
    modalClose(() => showDelegateNoAccessModal());
    return;
    }
    if (isAccountLocked) {
    modalClose(() => showLockedAccountModal());
    return;
    }
    modalClose(() => {
    setShouldShowDelegatePopoverMenu(false);
    setShouldShowRemoveDelegateModal(true);
    setSelectedEmail(undefined);
    });
    },
    },
    ];

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

    We should add the logic to prevent delegates from removing themselves

                    const {isDelegateAccessRestricted, showDelegateNoAccessModal, isActingAsDelegate} = useContext(DelegateNoAccessContext);
                    ...
                    if (isActingAsDelegate) { // or we can add `&& selectedDelegate?.email === currentUserPersonalDetails?.login`
                        modalClose(() => showDelegateNoAccessModal());
                        return;
                    }
    

    {
    text: translate('delegate.removeCopilot'),
    icon: Expensicons.Trashcan,
    onPress: () => {
    if (isDelegateAccessRestricted) {
    modalClose(() => showDelegateNoAccessModal());
    return;
    }
    if (isAccountLocked) {
    modalClose(() => showLockedAccountModal());
    return;
    }
    modalClose(() => {
    setShouldShowDelegatePopoverMenu(false);
    setShouldShowRemoveDelegateModal(true);
    setSelectedEmail(undefined);
    });
    },
    },
    ];

    Note: we should do the same with other place that use the same logic

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. ChavdaSachin commented on Dec 19, 2025

    @ChavdaSachin
    Contributor

    Proposal

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

    Full access delegates can remove their self from delegates.

    What is the root cause of that problem?

    This PR a while back made changes to allow certain actions to full access delegates over limited access delegates.
    Which includes changes

    Allow clicking Change access level

    if (isDelegateAccessRestricted) {

    Allow clicking Remove copilot

    if (isDelegateAccessRestricted) {

    And allow clicking Add copilot

    {!isDelegateAccessRestricted && (

    But PR did miss to fully refine the logic - ie. Change access level could be clicked by full access delegates but UpdateDelegateRolePage is not accessible by even full access delegate resulting in unfinished flow .
    Also similarly Add copilot could be clicked but AddDelegatePage is not accessible by delegates.
    And fully allowed Remove copilot flow.

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

    First we need to clear the expectations here.
    Either allow full access delegates to access and complete all three Change access level, Remove copilot and Add copilot flow.

    • if expectations = restrict all three flows
      replace isDelegateAccessRestricted with isActingAsDelegate at following three place

    if (isDelegateAccessRestricted) {

    if (isDelegateAccessRestricted) {

    {!isDelegateAccessRestricted && (

    Any small missing case could be handled in PR phase.
    Note: I haven't checked if BE fully supports for the second expectations, in that case we could need BE changes as well.

    What alternative solutions did you explore? (Optional)

    If we decide to allow access the add delegate flow to full access delegates, in that case we could optionally limit them to adding only limited access delegates.

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  6. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BZ Test Jan 26Lauren R running tests on removing BZ from certain parts in issue flows
    on Dec 19, 2025
  7. changed the title [-] Security - Full copilot does not have access to change level, but can remove themself[/-] [+][$250] Security - Full copilot does not have access to change level, but can remove themself[/+] on Dec 19, 2025
  8. melvin-bot commented on Dec 19, 2025

    @melvin-bot
  9. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 19, 2025
  10. melvin-bot commented on Dec 19, 2025

    @melvin-bot

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

  11. 76 remaining items

  12. suneox commented on Mar 16, 2026

    @suneox
    Contributor

    BugZero Checklist:

    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Based on the current PR scope, we couldn’t identify an offending PR since the logic has been mismatched with OldDot for a long time.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: [$250] Security - Full copilot does not have access to change level, but can remove themself #78105 (comment)

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Precondition:

    Have an account with copiloted access.

    Test 1

    1. As a copilot go to settings > security.
    2. Verify clicking Two-factor Authentication option pops up the Not So Fast... modal.
    3. Verify Merge accounts, Report suspicious activity and Close account flows are accessible and do not show the Not So Fast... modal when clicked.
    4. Verify clicking Add copilot option pops up the Not So Fast... modal.
    5. Click three dot options for one of the listed copilots.
    6. Verify clicking Change Access Level option pops up the Not So Fast... modal.

    Test 2

    1. As a copilot go to settings > security.
    2. Click three dot options for one of the listed copilots other than current login.
    3. Verify clicking Remove Copilot option pops up the Not So Fast... modal.
    4. Click the three dot option for current login from the copilots list.
    5. Verify clicking Remove Copilot option pops up the Remove copilot modal.
    6. Verify clicking Remove Copilot button from the modal successfully removes currently logged in user from delegated access

    Do we agree 👍 or 👎

    Zapier Logs Run ID: 00040eee-0947-a429-58b2-8ecc66d13294
  13. suneox commented on Mar 16, 2026

    @suneox
    Contributor

    @laurenreidexpensify The current PR was deployed to production two weeks ago, so this issue is ready for payment.

  14. melvin-bot commented on Mar 18, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @suneox, @mollfpr, @laurenreidexpensify, @ChavdaSachin 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!

  15. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    on Mar 19, 2026
  16. melvin-bot commented on Mar 19, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  17. added and removed on Mar 19, 2026
  18. mallenexpensify commented on Mar 19, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor: @ChavdaSachin paid $250 via Upwork
    Contributor+: @suneox due $250 via NewDot

    ^ Test case created

    Thx!

  19. trjExpensify commented on Mar 20, 2026

    @trjExpensify
    Contributor

    approved $250 for @suneox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBZ Test Jan 26Lauren R running tests on removing BZ from certain parts in issue flowsBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions