-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$500] Request Money -Scan - Scan report allows protected PDF upload #26713
Comments
Triggered auto assignment to @michaelhaxhiu ( |
Bug0 Triage Checklist (Main S/O)
|
I think we need to hammer out the |
Job added to Upwork: https://www.upwork.com/jobs/~019e1ea506f5c204cc |
Let's get some C+ eyes on this! |
Triggered auto assignment to @dylanexpensify ( |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel ( |
Also @kbecciv why does this have |
ProposalPlease re-state the problem that we are trying to solve in this issue.Scan report allows protected PDF upload What is the root cause of that problem?Pdf File is not validated for encryption while validation of file What changes do you think we should make in order to solve the problem?Validate file for encryption.
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Request Money -Scan - Scan report allows protected PDF upload What is the root cause of that problem?We're not checking the PDF is weather encrypted or not, we're just processing the PDF without verifying. What changes do you think we should make in order to solve the problem?We could use We can validate if the selected is pdf or not, then we load the pdf using
We need to update this function
By using the following we can also catch the exception of invalid PDF. (maybe selected file is not pdf but extension is // code
const isPdf = pdfjs.isPdfFile(file.name);
const filePath = URL.createObjectURL(file);
if (isPdf) {
pdfjs
.getDocument(filePath)
.promise.then(() => {
// PDF loaded correctly
IOU.setMoneyRequestReceipt(filePath, file.name);
IOU.navigateToNextPage(iou, iouType, reportID, report);
})
.catch((error) => {
// PDF is asking for password
if (error.code === CONST.PDF_PASSWORD_FORM.REACT_PDF_PASSWORD_RESPONSES.NEED_PASSWORD) {
Receipt.setUploadReceiptError(true, translate('attachmentPicker.wrongFileType'), translate('attachmentPicker.notAllowedExtension'));
return;
}
Receipt.setUploadReceiptError(true, translate('attachmentPicker.attachmentError'), translate('attachmentPicker.errorWhileSelectingAttachment'));
});
return;
}
IOU.setMoneyRequestReceipt(filePath, file.name);
IOU.navigateToNextPage(iou, iouType, reportID, report);
//code What alternative solutions did you explore? (Optional)NA ResultKapture.2023-09-08.at.22.02.21.mp4 |
@michaelhaxhiu Unassigned due to low bandwidth can you get a new C+ here by re-applying the external label again, thanks! |
@michaelhaxhiu I am interested in reviewing this. Currently, I see that any file types (not only image, pdf but also txt, dmg, etc) are acceptable in scan upload as long as its size is within 240bytes-24MB. Even folder is able to drag & drop. |
@situchan I reported this a while ago - https://app.slack.com/client/T03SC9DTT/C049HHMV9SM/thread/C049HHMV9SM-1692815288.242469 |
I see that restriction is removed in #21285. But it's general, i.e. in composer. |
Agreed, thats why I propose the option to validate in my propsal linked to thread |
There is Also one more issue if we dont validate the file type in composer or scan receipt. User add a app to to composer. nothing happens and next time the add attachment option won't even work. Screen.Recording.2023-09-08.at.10.52.05.PM.mov |
Current assignee @michaelhaxhiu is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @narefyev91 ( |
Re-assigned label to get a new C+ assigned, per Santhosh's comment above. |
Folder drag and drop was raised in #26892 but closed as wontfix due to the platform (Windows). If we intend to get that sorted, then it makes sense to reopen the issue. |
@michaelhaxhiu we should confirm the expected behavior first. Which option?
|
After brewing, this is seeming more like a feature request than a bug report. We already show an error when you try to upload this file type, so I am leaning toward this behaving as expected. You could argue we need a more specific error message - but that's where this venture into feature request territory in my mind. I'm going to close this for now as I think it's more of a |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
Expected Result:
Error message "Password protected and cannot be read" displayed immediately after a password protected PDF is selected.
Actual Result:
Scan report allows password protected PDF upload and causes unexpected error after the process
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.63.0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
protected.pdf.upload.scan.error.1.mp4
Recording.4236.mp4
Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693417461660059
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: