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
Expense policy - Protected pdf file is allowed and password modal appears repeatedly #89345
Version Number: 9.3.65-0 Reproducible in staging?: Yes Reproducible in production?: N/A - new feature, doesn't exist in prod If this was caught during regression testing, add the test name, ID and link from BrowserStack:#87684 Email or phone of affected tester (no customers):applausetester+sjdiosndjsois2jd@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Workspace Settings
Action Performed:
Precondition:
Log in with Expensifail account.
Go to staging.new.expensify.com
Go to workspace settings > Overview.
Scroll down to Expense policy.
Click Choose file.
Upload protected pdf file (attached below).
Enter password [Test12345].
Go to Members tab.
Go back to Overview tab.
Click Cancel on password modal.
Expected Result:
Protected pdf file should not be allowed.
Actual Result:
Protected pdf file is allowed.
Password modal appears after changing tab and back to Overview. It appears repeatedly after tapping Cancel.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Classification: Frontend bug Causing PR: #87684 - "Add workspace rules PDF document upload, view, and management UI" by @ishpaul777 (High confidence) Related Issues: None
Recommendation: REVERT
PR #87684 introduced the entire "Expense policy PDF document" feature in WorkspaceOverviewPage.tsx. The bug reproduces only on staging (it's a new feature not in production), and the fix requires changes to this App PR. Reverting it cleanly removes the broken functionality.
Assigned: @ishpaul777 (PR author), @abzokhattab (approving reviewer), @lakchote (approving reviewer) Labels: DeployBlockerCash kept (frontend/App PR is the cause). DeployBlocker removed — no backend changes are required to fix this issue; the root cause is entirely in the App PR.
Protected PDFs are accepted (not blocked) — updatePolicyRulesDocument in src/libs/actions/Policy/Policy.ts only validates that the uploaded file is a PDF (by type/extension) but performs no check for password protection. There is no pre-upload validation that rejects encrypted/password-protected PDFs.
After navigating away and back, a password modal appears repeatedly even after Cancel — the PDFThumbnail component in WorkspaceOverviewPage.tsx (line 865) is rendered with no onPassword callback, but the component supports an onPassword prop to handle password-protected PDFs. Without handling this callback, there is no mechanism to reject the upload or clear the stored rulesDocumentURL when the PDF requires a password, causing the password prompt to be triggered again every time the thumbnail renders.
updatePolicyRulesDocument accepts any valid PDF without checking for password protection. Once a password-protected PDF is stored as policy.rulesDocumentURL, the PDFThumbnail component rendered on the Overview page encounters the password requirement but has no onPassword handler registered — causing it to re-trigger the password prompt every time the component mounts (e.g., after switching tabs). Clicking Cancel does not clear the stored URL, so the modal reappears in a loop.
There are two bugs here, both stemming from the workspace rules document upload flow (introduced in #87684) having no validation for password-protected PDFs:
Bug 1 — Password-protected PDFs are accepted:handleRulesDocumentPicked passes the picked file directly to updatePolicyRulesDocument, which only checks that the file is a PDF (by MIME type / extension) but never checks for password protection. The file is uploaded as-is.
The rest of the app already solves this: useFilesValidation renders an invisible PDFThumbnail with an onPassword callback that rejects password-protected PDFs with CONST.FILE_VALIDATION_ERRORS.PROTECTED_FILE when isValidatingReceipts is true. The rules document upload path does not use this hook at all.
Bug 2 — Password modal reappears after Cancel: Because the password-protected PDF is stored as rulesDocumentURL, viewing it in WorkspaceDocumentModalContent renders a PDFView that detects the password and shows PDFPasswordForm. When the user navigates to another workspace tab and returns, the PDF viewer remounts and re-triggers password detection, causing the modal to reappear even after dismissing it.
What changes do you think we should make in order to solve the problem?
Validate the picked file for password protection before calling updatePolicyRulesDocument, using the same invisible-PDFThumbnail pattern already used by useFilesValidation:
In WorkspaceOverviewPage.tsx, modify handleRulesDocumentPicked to first render an invisible PDFThumbnail for the picked file. If the onPassword callback fires, reject the file and show the existing PROTECTED_FILE error. Only proceed with updatePolicyRulesDocument if onLoadSuccess fires (confirming the PDF is not password-protected).
This fixes both bugs: password-protected PDFs are blocked at upload time (Bug 1), so they never get stored as rulesDocumentURL and the password modal never appears (Bug 2).
What alternative solutions did you explore? (Optional)
An alternative would be to integrate the full useFilesValidation hook into the rules document upload flow. However, that hook is designed for multi-file receipt validation with error modals, which is heavier than needed here. The simpler approach of adding a targeted PDFThumbnail check in handleRulesDocumentPicked is more proportional to the single-file, single-purpose upload flow.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.
Activity
melvin-bot commentedon May 1, 2026
You have been assigned to this deploy blocker because you recently merged this PR: #87684
melvin-bot commentedon May 1, 2026
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon May 1, 2026
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
OSBotify commentedon May 1, 2026
Investigation Summary
Classification: Frontend bug
Causing PR: #87684 - "Add workspace rules PDF document upload, view, and management UI" by @ishpaul777 (High confidence)
Related Issues: None
Recommendation: REVERT
PR #87684 introduced the entire "Expense policy PDF document" feature in
WorkspaceOverviewPage.tsx. The bug reproduces only on staging (it's a new feature not in production), and the fix requires changes to this App PR. Reverting it cleanly removes the broken functionality.Assigned: @ishpaul777 (PR author), @abzokhattab (approving reviewer), @lakchote (approving reviewer)
Labels:
DeployBlockerCashkept (frontend/App PR is the cause).DeployBlockerremoved — no backend changes are required to fix this issue; the root cause is entirely in the App PR.Detailed Analysis
Evidence
9.3.65-0, which matches the version number in the bug report.updatePolicyRulesDocumentinsrc/libs/actions/Policy/Policy.tsonly validates that the uploaded file is a PDF (by type/extension) but performs no check for password protection. There is no pre-upload validation that rejects encrypted/password-protected PDFs.PDFThumbnailcomponent inWorkspaceOverviewPage.tsx(line 865) is rendered with noonPasswordcallback, but the component supports anonPasswordprop to handle password-protected PDFs. Without handling this callback, there is no mechanism to reject the upload or clear the storedrulesDocumentURLwhen the PDF requires a password, causing the password prompt to be triggered again every time the thumbnail renders.Verification
src/pages/workspace/WorkspaceOverviewPage.tsx,src/libs/actions/Policy/Policy.tssrc/pages/workspace/WorkspaceOverviewPage.tsx(+154/-17 lines)src/libs/actions/Policy/Policy.ts(+102/-1 lines)Root Cause
updatePolicyRulesDocumentaccepts any valid PDF without checking for password protection. Once a password-protected PDF is stored aspolicy.rulesDocumentURL, thePDFThumbnailcomponent rendered on the Overview page encounters the password requirement but has noonPasswordhandler registered — causing it to re-trigger the password prompt every time the component mounts (e.g., after switching tabs). Clicking Cancel does not clear the stored URL, so the modal reappears in a loop.MelvinBot commentedon May 1, 2026
Proposal
What is the root cause of that problem?
There are two bugs here, both stemming from the workspace rules document upload flow (introduced in #87684) having no validation for password-protected PDFs:
Bug 1 — Password-protected PDFs are accepted:
handleRulesDocumentPickedpasses the picked file directly toupdatePolicyRulesDocument, which only checks that the file is a PDF (by MIME type / extension) but never checks for password protection. The file is uploaded as-is.The rest of the app already solves this:
useFilesValidationrenders an invisiblePDFThumbnailwith anonPasswordcallback that rejects password-protected PDFs withCONST.FILE_VALIDATION_ERRORS.PROTECTED_FILEwhenisValidatingReceiptsis true. The rules document upload path does not use this hook at all.Bug 2 — Password modal reappears after Cancel: Because the password-protected PDF is stored as
rulesDocumentURL, viewing it in WorkspaceDocumentModalContent renders aPDFViewthat detects the password and showsPDFPasswordForm. When the user navigates to another workspace tab and returns, the PDF viewer remounts and re-triggers password detection, causing the modal to reappear even after dismissing it.What changes do you think we should make in order to solve the problem?
Validate the picked file for password protection before calling
updatePolicyRulesDocument, using the same invisible-PDFThumbnailpattern already used byuseFilesValidation:In
WorkspaceOverviewPage.tsx, modifyhandleRulesDocumentPickedto first render an invisiblePDFThumbnailfor the picked file. If theonPasswordcallback fires, reject the file and show the existingPROTECTED_FILEerror. Only proceed withupdatePolicyRulesDocumentifonLoadSuccessfires (confirming the PDF is not password-protected).This fixes both bugs: password-protected PDFs are blocked at upload time (Bug 1), so they never get stored as
rulesDocumentURLand the password modal never appears (Bug 2).What alternative solutions did you explore? (Optional)
An alternative would be to integrate the full
useFilesValidationhook into the rules document upload flow. However, that hook is designed for multi-file receipt validation with error modals, which is heavier than needed here. The simpler approach of adding a targetedPDFThumbnailcheck inhandleRulesDocumentPickedis more proportional to the single-file, single-purpose upload flow.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR,@MelvinBot <your feedback>to refine this analysis, or explain why you are rejecting Melvin's proposal.IuliiaHerets commentedon May 1, 2026
Chrome / v9.3.65-1
Choose file option removed from Overview
REC-20260501130029.mp4
abzokhattab commentedon May 1, 2026
Are protected pdf files part of the story @ishpaul777 i dont see it mentioned