Skip to content

[$250] Fix security vulnerabilities in Expensify App #48327

@hurali97

Description

@hurali97

Problem

Currently in Expensify App we have around 34 vulnerabilities in our dependencies of Critical, High and Moderate priorities. Even though, our App works fine but there's always a chance of some exploit in the future. Since Expensify is a FinTech App, the security vulnerabilities should be avoided and mitigated as much as possible.

Some examples of the vulnerabilities found via npm audit are:

Screenshot 2024-08-30 at 4 59 14 PM

Solution

The links for the vulnerabilities also suggests the version that we can bump for that dependency in order to fix the vulnerability. Since most of the vulnerabilities are originating from transitive dependencies, we can use overrides property in package.json to use that pinned version for the specific dependency. For example, consider ws transitive dependency which can be bumped to 8.17.1 in order to fix the vulnerability. Below is how we can achieve this:

"devDependencies": {
  ....
},
"overrides": {
   "ws": "8.17.1"
}

Once we add the patched versions of the security vulnerabilities in overrides property, we need to do a QA to make sure there are no regressions introduced by the patched versions.


Apart from this, upgrading to newer versions can sometimes be useful as they come with bug fixes and performance improvements. For example, react-pdf comes with lots of improvements like optimized CPU and memory usage, see here. There's one edge case that I am not aware of and would like to discuss:

  • We now don't have pdfjs-dist/legacy/build instead we have pdfjs-dist/build as react-pdf has dropped support for older browsers. In react-fast-pdf, which is maintained by Expensify here and in Expensfiy App, we have references to pdfjs-dist/legacy/build, which we can just change to pdfjs-dist/build. After this change, on my testing, I was able to send and view the PDF correctly, so everything looks correct but a QA in this area might come handy.

Edit: react-pdf update is already being tracked here. We have to make sure to verify updates to react-fast-pdf

Edit: I missed it the first time but we do have pdfjs-dist/legacy/build but we have .mjs instead of .js, so we still have to update react-fast-pdf to include the .mjs extension.

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021843732810666984794
  • Upwork Job ID: 1843732810666984794
  • Last Price Increase: 2024-10-08
Issue OwnerCurrent Issue Owner: @

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions