Skip to content
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

[$1000] uploading EPS extension file throws an error #24497

Closed
1 of 6 tasks
kavimuru opened this issue Aug 13, 2023 · 59 comments
Closed
1 of 6 tasks

[$1000] uploading EPS extension file throws an error #24497

kavimuru opened this issue Aug 13, 2023 · 59 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff

Comments

@kavimuru
Copy link

kavimuru commented Aug 13, 2023

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:

  1. Open any chat
  2. Click on ➕ icon
  3. Click on Add attachment
  4. Select .EPS extension file and send it

Expected Result:

The app should send the file or throw "This filetype is not allowed" pop-up.

Actual Result:

Gives an error saying "Invalid image supplied"

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.53-1
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

2023-07-31.00-06-33.mp4

Snip - (74) New Expensify - Google Chrome (2)

Expensify/Expensify Issue URL:
Issue reported by: @jo-ui
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690751127702569

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01441ec377d38bb1cc
  • Upwork Job ID: 1693709065932484608
  • Last Price Increase: 2023-08-21
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 13, 2023

Triggered auto assignment to @strepanier03 (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Aug 13, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@ishpaul777
Copy link
Contributor

ishpaul777 commented Aug 13, 2023

Proposal

Problem

uploading EPS extension file throws an error

Root cause

We are not validating dropped file extension while we validate isValidFile.

https://github.com/Expensify/App/blob/main/src/components/AttachmentModal.js#L186

Changes

Ideally all files with any type possible should not be supported. (IMO, should never support executable files like ".exe", ".msi"). Slack and google chat also blocks certain type of file uploads ref here and here

Validating before uploading to backend is generally a good idea. We should add a condition to validate file extension.

rough implementation -

 const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
    if (_.contains(CONST.API_ATTACHMENT_VALIDATIONS.UNALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
        setIsAttachmentInvalid(true);
            setAttachmentInvalidReasonTitle('attachmentPicker.fileTypeNotAllowed'Title);
            setAttachmentInvalidReason('attachmentPicker.fileTypeNotAllowedBody');
            return false;
    }

Alternatives

What we can do is only allow files with a set of extension and revert above condition.

 const {fileExtension} = FileUtils.splitExtensionFromFileName(lodashGet(file, 'name', ''));
    if (!_.contains(CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_EXTENSIONS, fileExtension.toLowerCase())) {
        setIsAttachmentInvalid(true);
            setAttachmentInvalidReasonTitle('attachmentPicker.fileTypeNotAllowed'Title);
            setAttachmentInvalidReason('attachmentPicker.fileTypeNotAllowedBody');
            return false;
    }

@DylanDylann
Copy link
Contributor

I think It is BE bug. The error is threw from BE side

@jo-ui
Copy link

jo-ui commented Aug 16, 2023

@strepanier03 any updates on this issue?

@melvin-bot melvin-bot bot added the Overdue label Aug 16, 2023
@jo-ui
Copy link

jo-ui commented Aug 19, 2023

@strepanier03 It has been a week since this issue was posted, but there has been no response

@strepanier03
Copy link
Contributor

I was on sabbatical and am just getting back from it now. I'm working on this today and will have an update soon.

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@strepanier03 strepanier03 added the External Added to denote the issue can be worked on by a contributor label Aug 21, 2023
@melvin-bot melvin-bot bot changed the title uploading EPS extension file throws an error [$1000] uploading EPS extension file throws an error Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01441ec377d38bb1cc

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Current assignee @strepanier03 is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

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

@strepanier03
Copy link
Contributor

I was able to recreate this behavior using a random .eps file on my computer as well as the one shared in the Slack bug report thread.

image

@strepanier03
Copy link
Contributor

@burczu - If you think this is an internal issue please let me know and I can switch to an Internal label.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 21, 2023

I can upload the files without any issue on staging.

@burczu
Copy link
Contributor

burczu commented Aug 22, 2023

@strepanier03 The Invalid image supplied message that is added after the Unexpeceted error... message comes from the BE side, so I think it means that BE has some issue processing files with this extension. That's why I believe we should we should make it internal and at least check what's happening with these files on the BE side.

@ishpaul777
Copy link
Contributor

@burczu I agree that error comes from BE.
But IMO allowing uploads for all file type to backend could potentially expose the application to security vulnerabilities. What do you think?

@burczu
Copy link
Contributor

burczu commented Aug 22, 2023

@ishpaul777 from what I see the app allows to upload any type of file - if it's not an image or pdf then you can just download the file (there is no preview in the report) and I guess it is done this way by design

@ishpaul777
Copy link
Contributor

Platforms like Slack, Gmail and Google Chat have implemented restrictions on certain types of file uploads (references: Slack policy, Gmail and Google Chat policy). Considering this, it might be prudent for us to implement similar restrictions on the types of files users can upload. I recommend that we discuss and consider implementing a file type validation mechanism that only allows safe and necessary file types for upload.
Allowing all file types, including potentially harmful ones like executable files (e.g., ".exe") exposes vulnerabilities for users as well as backend, However, if this is intentionally part of the design, I recommend that we document the rationale behind it, along with the assessed risks.

@strepanier03
Copy link
Contributor

@burczu - reading the response from @ishpaul777 here, do you want to raise this for discussion at all or should I switch the labels now?

@burczu
Copy link
Contributor

burczu commented Aug 23, 2023

@strepanier03 - I think for this issue we should just switch the labels

@ishpaul777 - I can hear you and it's reasonable what you wrote, but I think it sounds more like a feature request so I believe you could raise a separate issue to discuss it - what do you think?

@ishpaul777
Copy link
Contributor

ishpaul777 commented Aug 23, 2023

Yes we can switch label for this one. Can you chime in slack thread https://expensify.slack.com/archives/C01GTK53T8Q/p1692691281183839 sharing your thoughts?

@strepanier03 strepanier03 added the Internal Requires API changes or must be handled by Expensify staff label Aug 24, 2023
@strepanier03
Copy link
Contributor

Still waiting for internal ownership, I'll bump again internally this week.

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@dangrous
Copy link
Contributor

Hey @strepanier03 I had a second to look into this - I'm not seeing the error, on staging or production. Are you still able to reproduce? A sample .eps file I used uploads and downloads fine.

Not sure what's changed since the issue was opened but we might be all set now.

@jo-ui
Copy link

jo-ui commented Sep 19, 2023

@dangrous Try it with other .eps files.
EPS files.zip

@strepanier03
Copy link
Contributor

@dangrous - I'll give it another shot.

@strepanier03
Copy link
Contributor

@dangrous - Just tested again with the three .eps files that @jo-ui shared here. All three repro'd the reported behavior.

image

@dangrous
Copy link
Contributor

Ah yep, tried some others. Making a PR to fix

@dangrous dangrous self-assigned this Sep 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@dangrous
Copy link
Contributor

Not overdue, fix is merged but not yet deployed

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@dangrous
Copy link
Contributor

This should be fixed! @strepanier03 do you mind testing when you have a moment? I might be able to get to it later this week

@strepanier03
Copy link
Contributor

Yup, I can test. Doing it now and will update shortly.

@strepanier03
Copy link
Contributor

I'm able to upload the files successfully and download them, but I don't have a program on my mac to open them. When I try it opens in ATOM, which isn't a vector file program.

The behavior looks updated and correct if I had a program to open an EPS file though.

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Second week)

@dangrous
Copy link
Contributor

Okay I think I'm gonna close this out!

@jo-ui
Copy link

jo-ui commented Sep 28, 2023

@strepanier03 It is working perfectly on both staging and production. Can you send me an offer for the reporting bonus

@dangrous
Copy link
Contributor

My bad! Reopening to handle payment.

@dangrous dangrous reopened this Sep 28, 2023
@strepanier03
Copy link
Contributor

Thanks @dangrous - I'll work on the reporting payment and close out when it's wrapped.

@strepanier03
Copy link
Contributor

@jo-ui - I can't figure out who you are in Upwork. Can you apply for the job here or link your Upwork profile and I'll hire you?

@jo-ui
Copy link

jo-ui commented Sep 28, 2023

@strepanier03 I've applied for the job on upwork

@melvin-bot melvin-bot bot added the Overdue label Oct 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 2, 2023

@dangrous, @burczu, @strepanier03 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@strepanier03
Copy link
Contributor

strepanier03 commented Oct 2, 2023

Thanks @jo-ui - I have hired you and will keep an eye out for your acceptance so I can pay this and get this closed out today.

@melvin-bot melvin-bot bot removed the Overdue label Oct 2, 2023
@jo-ui
Copy link

jo-ui commented Oct 2, 2023

Thank you @strepanier03 I've accepted the offer on upwork

@strepanier03
Copy link
Contributor

strepanier03 commented Oct 2, 2023

I've paid out the contract, ended it, and left feedback.

Thank you @jo-ui for being part of this community 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

9 participants