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

fix: update file-type to resolve vulnerability #205

Merged
merged 1 commit into from
Jul 28, 2022

Conversation

dpopp07
Copy link
Member

@dpopp07 dpopp07 commented Jul 25, 2022

Resolves #204

The CVE states that v16.5.4 is clean, so I upgraded to that and modified the code accordingly. It led to some function changes from sync to async but all functions that should really only be used internally. That said, I think these functions are technically exported as part of the public API, so we should evaluate if this should considered a breaking change or a necessary fix of broken (vulnerable) code.

I wanted to upgrade to v17 but that caused a number of TypeScript errors from the file-type internal code. I may open an issue there to see if I can find out why it's happening.

@dpopp07 dpopp07 requested a review from padamstx July 25, 2022 21:38
package.json Show resolved Hide resolved
Copy link
Member

@padamstx padamstx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@padamstx
Copy link
Member

I restarted the bulids for this PR because the original builds were canceled by travis due to the build credits issue.

The `file-type` package has a vulnerability that persists until v16.5.4. This
commit updates the package to v16.5.4 to avoid the vulnerability. However, the
package update required changes in how we use the package in our code which
resulted in incompatible updates to a couple of functions that are part of our
public API. Though it is unlikely these functions are being widely used, this
change will need to go into a new major version.

BREAKING CHANGE: two synchronous public functions are now asynchronous

The function `getContentType` formerly returned a string but now returns a
Promise that resolves to a string. The function `buildRequestFileObject`
formerly returned a `FileObject` but now returns a Promise that resolves to
a `FileObject`.

Fixes #204

Signed-off-by: Dustin Popp <dpopp07@gmail.com>
@dpopp07 dpopp07 force-pushed the dp/file-type-vulnerability branch from 8b768cc to d7b60c1 Compare July 28, 2022 15:33
@dpopp07 dpopp07 merged commit 843e66d into main Jul 28, 2022
@dpopp07 dpopp07 deleted the dp/file-type-vulnerability branch July 28, 2022 15:48
ibm-devx-sdk pushed a commit that referenced this pull request Jul 28, 2022
# [3.0.0](v2.17.15...v3.0.0) (2022-07-28)

### Bug Fixes

* update file-type to resolve vulnerability ([#205](#205)) ([843e66d](843e66d)), closes [#204](#204)

### BREAKING CHANGES

* two synchronous public functions are now asynchronous

The function `getContentType` formerly returned a string but now returns a
Promise that resolves to a string. The function `buildRequestFileObject`
formerly returned a `FileObject` but now returns a Promise that resolves to
a `FileObject`.
@ibm-devx-sdk
Copy link

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CVE-2022-36313 found in file-type
3 participants