You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-07-29] [$250] [Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction #95672
When a user on a private domain with a restricted submission security group uses the native iOS/Android share sheet to submit a receipt, the Submit tab displays all available workspaces — not just the one permitted by the security group. This bypasses the intended restriction.
Expected behavior
Users whose domain security group restricts submission to a specific workspace should only see that workspace as a destination in the share sheet Submit tab — matching the in-product experience.
Actual behavior
All workspaces are shown in the share sheet Submit tab, regardless of domain security group restrictions. The correct/restricted workspace is not even prioritized at the top of the list.
Steps to reproduce
Be a member of a private domain with submission restricted to one workspace via security group settings.
On iOS or Android, share an image/file using the native share sheet and open it in Expensify.
Navigate to the Submit tab.
Observe that all workspaces are listed as submission destinations.
Impact
Users can attempt to submit to workspaces outside their security group's restriction, breaking admin-enforced policy.
Notes
This is a regression — the correct behavior (skip directly to confirmation with the locked workspace on the Submit tab) was previously working.
changed the title [-][Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction[/-][+][$250] [Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction[/+]on Jul 9, 2026
godzillaxbox19982014-lgtm commented on Jul 9, 2026
The local evidence matches this recurring failure shape: optimistic transaction/report data is written to one Onyx key but the visible list reads another derived key. Here, src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263 and src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:265 do not agree on the same the issue-specific state value, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.
What changes do you think we should make in order to solve the problem?
Update src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263 to derive the issue-specific state from the report/transaction source that owns this flow before the value is consumed.
Carry the same normalized value through src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:265; that follows the safer family move to align optimistic/success/failure data with the selector consumed by the screen, so the write/optimistic/read paths agree instead of only changing the visible component.
Keep the change inside the Reports, Expenses, IOU, Transactions surface and avoid changing payment actions, personal/deleted policies.
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
Add or update a regression in tests/unit/ReportUtils*.ts for the exact issue flow: [Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction.
Cover the counter-case near src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263 so valid existing the issue-specific state behavior still works.
Manually repeat the issue steps after the patch and confirm the visible state/action is no longer stale.
What alternative solutions did you explore? (Optional)
I would not add a broad new condition outside these referenced paths; the safer fix is to keep the issue-specific state consistent at the first read/write boundary shown above.
When a receipt is shared through the native iOS/Android share sheet and the user opens the Submit tab, the destination list is populated from every workspace the user belongs to, without applying the domain security group restriction that the normal in-product create flow enforces. So a user whose security group limits submission to a single workspace still sees all of them.
The share flow keeps the shared file and session context in Onyx via the Share action module, and the Submit tab reads the full set of active policies to build its destination options rather than the restricted set:
// Also clear any file validated in a previous share session. Otherwise a HEIC/`image/*` share
// could reuse the previous session's validated file (which ShareDetailsPage uploads) during the
// window before the new async validation overwrites VALIDATED_FILE_OBJECT.
[ONYXKEYS.VALIDATED_FILE_OBJECT]: null,
});
}
Because the Submit tab derives its workspace options straight from the unfiltered policy collection, the domain restriction that used to short circuit this flow (skip directly to confirmation with the locked workspace) is never applied. This is the regression called out in the issue and matches the same class of bug as #76179, where the domain-controlled workspace restriction was not carried into the quick-action/share flows.
What changes do you think we should make in order to solve the problem?
In the share Submit tab that builds the workspace destination list, filter the policy options through the same domain security group restriction helper the in-product create flow uses, so only the permitted workspace(s) are shown. The share session data that feeds this list is owned by the Share action module:
When lockedWorkspaceID is defined, skip the workspace picker and route straight to the confirmation step with that workspace preselected, restoring the previous behavior described in the issue notes.
Keep the restriction logic centralized in the existing policy restriction helper so the share Submit tab and the in-product create flow stay in sync and cannot diverge again.
This fixes the root cause because the destination list is derived from the restricted policy set rather than the full policy collection, so the admin-enforced security group restriction is honored in the share sheet exactly as it is in the app.
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.
@daledah The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: N/A
[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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Jul 9, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @daledah (
External)melvin-bot commentedon Jul 9, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022075154567938633523
[-][Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction[/-][+][$250] [Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction[/+]godzillaxbox19982014-lgtm commentedon Jul 9, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
[Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction
What is the root cause of that problem?
I traced this to the path that handles
the issue-specific state:senderWorkspaceID):const senderWorkspaceID = transaction?.participants?.find((p) => p?.isSender)?.policyID;existingInvoiceReport):const existingInvoiceReport = useParticipantsInvoiceReport(receiverAccountID, receiverType, senderWorkspaceID);if):if (iouType === CONST.IOU.TYPE.SPLIT && transaction?.splitShares) {src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263andsrc/pages/iou/request/step/confirmation/useExpenseSubmission.ts:265do not agree on the samethe issue-specific statevalue, so the user-visible path can show a missing or stale state even though nearby data already has the needed context.What changes do you think we should make in order to solve the problem?
src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263to derivethe issue-specific statefrom the report/transaction source that owns this flow before the value is consumed.src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:265; that follows the safer family move to align optimistic/success/failure data with the selector consumed by the screen, so the write/optimistic/read paths agree instead of only changing the visible component.What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
tests/unit/ReportUtils*.tsfor the exact issue flow: [Bug] Native Share Sheet (Submit tab) shows all workspaces instead of respecting domain security group restriction.src/pages/iou/request/step/confirmation/useExpenseSubmission.ts:263so valid existingthe issue-specific statebehavior still works.What alternative solutions did you explore? (Optional)
the issue-specific stateconsistent at the first read/write boundary shown above.samranahm commentedon Jul 9, 2026
Proposal
What is the root cause of that problem?
When a receipt is shared through the native iOS/Android share sheet and the user opens the Submit tab, the destination list is populated from every workspace the user belongs to, without applying the domain security group restriction that the normal in-product create flow enforces. So a user whose security group limits submission to a single workspace still sees all of them.
The share flow keeps the shared file and session context in Onyx via the
Shareaction module, and the Submit tab reads the full set of active policies to build its destination options rather than the restricted set:App/src/libs/actions/Share.ts
Lines 11 to 20 in daeafbc
Because the Submit tab derives its workspace options straight from the unfiltered policy collection, the domain restriction that used to short circuit this flow (skip directly to confirmation with the locked workspace) is never applied. This is the regression called out in the issue and matches the same class of bug as #76179, where the domain-controlled workspace restriction was not carried into the quick-action/share flows.
What changes do you think we should make in order to solve the problem?
Shareaction module:App/src/libs/actions/Share.ts
Lines 11 to 20 in daeafbc
Concretely, before rendering the destination options, resolve the restricted workspace set and short circuit when it is a single locked workspace:
When
lockedWorkspaceIDis defined, skip the workspace picker and route straight to the confirmation step with that workspace preselected, restoring the previous behavior described in the issue notes.Keep the restriction logic centralized in the existing policy restriction helper so the share Submit tab and the in-product create flow stay in sync and cannot diverge again.
This fixes the root cause because the destination list is derived from the restricted policy set rather than the full policy collection, so the admin-enforced security group restriction is honored in the share sheet exactly as it is in the app.
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.
Solution Verification Result
BEFORE.mp4
AFTER.mp4
63 remaining items
melvin-bot commentedon Jul 22, 2026
@daledah The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]
daledah commentedon Jul 23, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to the comment on the PR: N/A
[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:
[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.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/666571
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-e3ae-a409-dda8-d63355fb6494melvin-bot commentedon Jul 28, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Jul 28, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Jul 30, 2026
Payment Summary
Contributor+: @daledah due $250 via NewDot
quinthar commentedon Aug 19, 2026
Approved $250 to @daledah