Skip to content

[$175] Workspace admin can view card transactions from a different workspace (Y) in a shared Expensify Card program despite not being a member/admin there #104221

Open

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number:
Reproducible in staging?: Needs Reproduction (Reproduction blocked)
Reproducible in production?: Needs Reproduction
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @sofiainteriano
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Sign in as admin of Workspace X.
  2. Open the card transaction feed.
  3. Review the visible transactions.
  4. Observe that transactions from Workspace Y are displayed, even though the user is not part of that workspace.

Expected Result:

The user should only be able to view card transactions from Workspace X, the workspace where they are an admin.

Actual Result:

The user can also view card transactions associated with Workspace Y.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

The screenshots for the issue are in Slack thread

View all open jobs on GitHub

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Oct 16, 2026
  2. MelvinBot commented on Oct 16, 2026

    @MelvinBot
    Contributor

    Proposal

    Medium confidence. I couldn't reproduce this. The test account has no Expensify Card program, and the screenshots are only in Slack. Product also needs to confirm the intended behavior first (see below).

    What is the root cause of that problem?

    When an Expensify Card feed is linked to several workspaces, they all share one fundID. The View transactions link under Current balance searches the whole feed and doesn't filter by workspace:

    • WorkspaceCardsListLabel.tsx:185-194 builds type:expense feed:<fundID>_Expensify Card withdrawal-status:never,pending.
    • The query has no workspace: filter, so Search returns every transaction on the shared feed. That includes Workspace Y's transactions.

    The card list behaves differently. It already shows only the current workspace's members (WorkspaceExpensifyCardListPage.tsx:138-142, via getCardsByCardholderName). The help article also says: "Each workspace shows only its own members in the card list, but all workspaces share the same card feed and settlement account." So Workspace X's admin can't see Workspace Y's cards, but can see their transactions.

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

    First, product needs to decide whether shared-feed admins should see transactions from every linked workspace.

    • If they should not: in handleViewTransactionsPress, add the current policyID as a workspace filter to the Search query. This matches how the card list is already scoped.
    • If they should: this is expected behavior, and you can close the issue. Add View transactions shortcut under Current balance added this link to list the transactions that count toward the feed's Current balance. That balance covers the whole shared feed.

    The App change only changes this one link. Workspace X's admin could still type a feed: search by hand. Real access control belongs on the server, which decides what a feed: search returns. If product wants it enforced, that is a separate change outside the App repo.

    What alternative solutions did you explore? (Optional)

    Keep the feed-wide query, but label it clearly. For example, show "Transactions on this shared feed (all linked workspaces)". This keeps the totals consistent with Current balance.

    Investigation details

    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/104221) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Oct 16, 2026
  4. melvin-bot commented on Oct 16, 2026

    @melvin-bot

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

  5. changed the title [-]Workspace admin can view card transactions from a different workspace (Y) in a shared Expensify Card program despite not being a member/admin there[/-] [+][$175] Workspace admin can view card transactions from a different workspace (Y) in a shared Expensify Card program despite not being a member/admin there[/+] on Oct 16, 2026
  6. melvin-bot commented on Oct 16, 2026

    @melvin-bot
  7. camesenin commented on Oct 16, 2026

    @camesenin
  8. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  9. janiya2 commented on Oct 16, 2026

    @janiya2

    Contributor details
    Your Expensify account email: janithad2@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/janithad

    Proposal

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

    In a shared Expensify Card program linked across multiple workspaces, an admin of Workspace X can view card transactions originating from Workspace Y by tapping "View transactions" under Current balance, even though they are neither an admin nor a member of Workspace Y.

    What is the root cause of that problem?

    When an Expensify Card program is shared across multiple workspaces, all linked workspaces share a single underlying fundID (useDefaultFundID.ts).

    1. Missing Policy Scoping in WorkspaceCardsListLabel.tsx:
      In src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx (lines 185–194), the handleViewTransactionsPress callback generates the following search query:

      const query = `type:expense feed:${fundID}_Expensify Card withdrawal-status:never,pending`;

      Notice that this search query filters strictly by the feed/fund identifier and omits the workspace/policy constraint.

    2. Inconsistent Scoping Between Cards List and Transactions Shortcut:
      In contrast, the card list on the same page (WorkspaceExpensifyCardListPage.tsx:138-142) already correctly restricts cards to current workspace members via getCardsByCardholderName (CardUtils.ts:820-829). However, because the "View transactions" shortcut queries the entire shared feed without workspace:${policyID}, Search returns every transaction on the feed across all linked workspaces.

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

    1. Scope Search Query to the Current Workspace:
      In src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx:
    --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx
    +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx
    @@ -185,7 +185,7 @@ function WorkspaceCardsListLabel({policy, fundID}: WorkspaceCardsListLabelProps)
         const handleViewTransactionsPress = useCallback(() => {
             if (!fundID) {
                 return;
             }
    -        const query = `type:expense feed:${fundID}_Expensify Card withdrawal-status:never,pending`;
    +        const query = `type:expense feed:${fundID}_Expensify Card workspace:${policy?.id} withdrawal-status:never,pending`;
             Navigation.navigate(ROUTES.SEARCH_CENTRAL_PANE.getRoute({query}));
    -    }, [fundID]);
    +    }, [fundID, policy?.id]);
    1. Server-Side Authorization Alignment:
      Ensure backend Search endpoint permissions enforce that users cannot bypass the UI shortcut by manually executing a feed:<fundID> search query to read transaction details belonging to workspaces they do not have permissions for.

    What alternative solutions did you explore? (Optional)

    We explored keeping the feed-wide search query and adding an in-app banner explaining that "Current balance reflects the entire shared feed across all linked workspaces". However, from a privacy and security standpoint, admins should not have visibility into itemized expense data of unassociated workspaces. Scoping the query with workspace:${policy?.id} ensures consistency with the card list view and protects workspace data boundaries.

    Tests

    Automated Tests:

    Add unit test in tests/unit/WorkspaceCardsListLabelTest.ts:

    • Render WorkspaceCardsListLabel with mock policy (id: 'POL_X') and mock fundID.
    • Simulate clicking the "View transactions" shortcut.
    • Verify that Navigation.navigate is called with ROUTES.SEARCH_CENTRAL_PANE containing workspace:POL_X.

    Manual Verification:

    1. Create or access a setup with a shared Expensify Card program linked to Workspace X and Workspace Y.
    2. Sign in as an admin of Workspace X (ensure this user is NOT a member or admin of Workspace Y).
    3. Open Workspace Settings > Expensify Card.
    4. Click View transactions under Current balance.
    5. Verify: Search opens and displays ONLY transactions belonging to Workspace X.
    6. Verify: Transactions from Workspace Y are NOT displayed.
    7. Verify on Web, Desktop, iOS, and Android.
  10. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  11. jloa-dev commented on Oct 17, 2026

    @jloa-dev

    Contributor details
    Your Expensify account email: jloa.dev@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa

    Proposal

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

    In a shared Expensify Card program linked across multiple workspaces, an admin of Workspace X can view card transactions originating from Workspace Y by clicking "View transactions" under Current balance, even if they are not an admin or member of Workspace Y.

    What is the root cause of that problem?

    In src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx (lines 185–194):

    const handleViewTransactionsPress = () => {
        const fundIDForFeedKey = defaultFundID === CONST.DEFAULT_NUMBER_ID ? undefined : String(defaultFundID);
        const feedKey = fundIDForFeedKey ? `${fundIDForFeedKey}_${CONST.EXPENSIFY_CARD.BANK}` : CONST.EXPENSIFY_CARD.BANK;
        const query = buildQueryStringFromFilterFormValues({
            type: CONST.SEARCH.DATA_TYPES.EXPENSE,
            feed: [feedKey],
            withdrawalStatus: [CONST.SEARCH.SETTLEMENT_STATUS.NEVER, CONST.SEARCH.SETTLEMENT_STATUS.PENDING],
        });
        Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query, searchKey: CONST.SEARCH.SEARCH_KEYS.EXPENSES}));
    };
    1. When an Expensify Card program is shared across workspaces, all linked workspaces share the same underlying fundID.
    2. When the admin clicks "View transactions", buildQueryStringFromFilterFormValues specifies feed: [feedKey] and withdrawalStatus, but omits policyID.
    3. While the card list itself in WorkspaceExpensifyCardListPage.tsx scopes displayed cards to the current workspace's members via CardUtils.getCardsByCardholderName, omitting policyID in buildQueryStringFromFilterFormValues causes Search to query all transactions across the entire shared feed without workspace boundaries, displaying transactions from Workspace Y to Workspace X admins.

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

    In src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx:
    Add policyID: [policyID] (already extracted from route params at line 61) to buildQueryStringFromFilterFormValues:

    --- a/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx
    +++ b/src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx
    @@ -187,6 +187,7 @@ function WorkspaceCardsListLabel({type, value, style}: WorkspaceCardsListLabelPr
             const feedKey = fundIDForFeedKey ? `${fundIDForFeedKey}_${CONST.EXPENSIFY_CARD.BANK}` : CONST.EXPENSIFY_CARD.BANK;
             const query = buildQueryStringFromFilterFormValues({
                 type: CONST.SEARCH.DATA_TYPES.EXPENSE,
    +            policyID: [policyID],
                 feed: [feedKey],
                 withdrawalStatus: [CONST.SEARCH.SETTLEMENT_STATUS.NEVER, CONST.SEARCH.SETTLEMENT_STATUS.PENDING],
             });
    • This ensures that the generated Search query includes policyID:<policyID> (or workspace:<policyID>), restricting results strictly to card expenses belonging to the workspace currently being viewed.
    • Admins of Workspace X will only see transactions belonging to Workspace X, cleanly enforcing workspace data isolation.

    Pre-coded and tested in branch: fix/104221-workspace-card-view-transactions-scope (https://github.com/jloa-dev/App/tree/fix/104221-workspace-card-view-transactions-scope).

    What alternative solutions did you explore? (Optional)

    Constructing raw query strings manually. Using buildQueryStringFromFilterFormValues({ policyID: [policyID], ... }) is the official, type-safe API used by the component and guarantees consistent URL formatting, encoding, and filter preservation across Search views.

  12. melvin-bot commented on Oct 17, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  13. 13 remaining items

  14. melvin-bot commented on Nov 2, 2026

    @melvin-bot

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

  15. abdulrahuman5196 commented on Nov 4, 2026

    @abdulrahuman5196
    Contributor

    @MelvinBot Change this to Daily label

  16. added and removed on Nov 4, 2026
  17. MelvinBot commented on Nov 4, 2026

    @MelvinBot
    Contributor

    Changed the label from Weekly to Daily.


    view run

  18. jeffrey-graham commented on Nov 7, 2026

    @jeffrey-graham
  19. melvin-bot commented on Nov 7, 2026

    @melvin-bot
  20. melvin-bot commented on Nov 9, 2026

    @melvin-bot

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

  21. allgandalf commented on Nov 11, 2026

    @allgandalf
    Contributor

    @abdulrahuman5196 workspace: only matches expenses on a report, so this would also hide the workspace's own unreported card expenses. Y's expenses still show in Spend with feed: anyway. linked workspaces share one feed and settlement account, so isn't this expected ?

  22. melvin-bot commented on Nov 11, 2026

    @melvin-bot

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

  23. melvin-bot commented on Nov 13, 2026

    @melvin-bot

    @abdulrahuman5196 this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  24. cocvn157 commented on Nov 14, 2026

    @cocvn157

    Proposal

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

    When multiple workspaces (Workspace X and Workspace Y) share the same Expensify Card program / settlement account (fundID), an admin of Workspace X (who is neither a member nor an admin of Workspace Y) sees card transactions from Workspace Y when clicking "View transactions" under Current balance on Workspace X's Expensify Card page.

    What is the root cause of that problem?

    1. Why handleViewTransactionsPress in src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx:186-195 returns transactions from other workspaces on the same fundID:

      • When workspaces share an Expensify Card settlement account, they share a single defaultFundID (domain_<fundID>).
      • On Workspace X's Expensify Card page, the card table itself (WorkspaceExpensifyCardListPage.tsx:147-149) scopes the visible cards to Workspace X's members:
        const employeePersonalDetails = usePersonalDetailsByLogins(Object.keys(policy?.employeeList ?? {}));
        const policyMembersAccountIDs = Object.values(getMemberAccountIDsForWorkspace(policy?.employeeList, employeePersonalDetails));
        const allCards = getCardsByCardholderName(cardsList, policyMembersAccountIDs);
      • However, in WorkspaceCardsListLabel.tsx:186-195, clicking "View transactions" builds a Search query filtered only by feed: [feedKey] and withdrawalStatus:
        const handleViewTransactionsPress = () => {
            const fundIDForFeedKey = defaultFundID === CONST.DEFAULT_NUMBER_ID ? undefined : String(defaultFundID);
            const feedKey = fundIDForFeedKey ? `${fundIDForFeedKey}_${CONST.EXPENSIFY_CARD.BANK}` : CONST.EXPENSIFY_CARD.BANK;
            const query = buildQueryStringFromFilterFormValues({
                type: CONST.SEARCH.DATA_TYPES.EXPENSE,
                feed: [feedKey],
                withdrawalStatus: [CONST.SEARCH.SETTLEMENT_STATUS.NEVER, CONST.SEARCH.SETTLEMENT_STATUS.PENDING],
            });
            Navigation.navigate(ROUTES.SEARCH_ROOT.getRoute({query, searchKey: CONST.SEARCH.SEARCH_KEYS.EXPENSES}));
        };
      • Because feedKey is keyed by the shared defaultFundID, Search returns every unsettled/pending transaction across the entire shared settlement feed, including transactions from Workspace Y.
    2. Why simply adding policyID: [policyID] (workspace:) alone has a subtle pitfall (as noted in the thread):

      • In Search, policyID: [policyID] (workspace:<policyID>) only matches transactions that are attached to a report belonging to policyID.
      • Unreported Expensify Card transactions (reportID === '0' / CONST.REPORT.UNREPORTED_REPORT_ID) do not belong to a workspace report yet, so filtering solely by policyID: [policyID] hides unreported Expensify Card transactions belonging to Workspace X's own cardholders.
      • Conversely, scoping by Workspace X's member card IDs (derived the exact same way WorkspaceExpensifyCardListPage.tsx:147-149 scopes the workspace's cards via getCardsByCardholderName(cardsList, policyMembersAccountIDs))—or passing policyID: [policyID] when Product intends strictly workspace-reported transactions—scopes the view to Workspace X.

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

    Depending on whether Product wants "View transactions" under Current balance to show (A) all unsettled transactions for cards issued to Workspace X's members (matching the cards table on the same page, including unreported card transactions) or (B) strictly transactions on Workspace X reports:

    1. Option A (Recommended — matches the workspace's card list and preserves unreported card expenses for Workspace X's members):
      In src/pages/workspace/expensifyCard/WorkspaceCardsListLabel.tsx (or by passing the workspace's scoped cardIDs down from WorkspaceExpensifyCardListPage / WorkspaceExpensifyCardPage):

      const workspaceCardIDs = allCards.map((card) => String(card.cardID));
      const query = buildQueryStringFromFilterFormValues({
          type: CONST.SEARCH.DATA_TYPES.EXPENSE,
          feed: [feedKey],
          cardID: workspaceCardIDs.length > 0 ? workspaceCardIDs : undefined,
          policyID: workspaceCardIDs.length === 0 && policyID ? [policyID] : undefined,
          withdrawalStatus: [CONST.SEARCH.SETTLEMENT_STATUS.NEVER, CONST.SEARCH.SETTLEMENT_STATUS.PENDING],
      });
      • This ensures that every card shown in Workspace X's Expensify Card table has its unsettled transactions (both reported and unreported) included in "View transactions", while excluding cards belonging to non-members in Workspace Y.
    2. Option B (If Product prefers strict workspace: report-level scoping):
      Include policyID: policyID ? [policyID] : undefined in buildQueryStringFromFilterFormValues in WorkspaceCardsListLabel.tsx:189-193:

      const query = buildQueryStringFromFilterFormValues({
          type: CONST.SEARCH.DATA_TYPES.EXPENSE,
          feed: [feedKey],
          policyID: policyID ? [policyID] : undefined,
          withdrawalStatus: [CONST.SEARCH.SETTLEMENT_STATUS.NEVER, CONST.SEARCH.SETTLEMENT_STATUS.PENDING],
      });

    What alternative solutions did you explore? (Optional)

    • Filtering by from: policyMembersAccountIDs instead of cardID: If a workspace member is in both Workspace X and Workspace Y and holds separate cards in each, cardID (from allCards on the workspace's card list) is more precise because it scopes directly to the cards managed in Workspace X.
  25. expensify-chore-bot commented on Nov 17, 2026

    @expensify-chore-bot

    @abdulrahuman5196 12 days overdue now... This issue's end is nigh!

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions