Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

react-redux-subspace npm audit denial-of-service vulnerability in recompose/node-fetch #508

Closed
Byron-Wall opened this issue Nov 19, 2020 · 1 comment · Fixed by #510
Closed

Comments

@Byron-Wall
Copy link
Contributor

Byron-Wall commented Nov 19, 2020

NPM security audit has flagged react-redux-subspace as having a denial-of-service vulnerability in its' recompose dependency:

$ npm audit
=== npm audit security report ===
Low Denial of Service
Package node-fetch
Patched in >=2.6.1 <3.0.0-beta.1|| >= 3.0.0-beta.9
Dependency of react-redux-subspace
Path react-redux-subspace > recompose > fbjs > isomorphic-fetch > node-fetch
More info https://npmjs.com/advisories/1556

It appears that 'react-redux-subspace' is using recompose's 'wrapDisplayName' function as its only dependency. Since it does not look like recompose is currently being maintained, it looks as though 'wrapDisplayName' could be refactored into a hook/helper function, which would remove the need for recompose to be used as a dependency.

ie (quickly off the top of my head):

const createDisplaynameForWrappedComponent = (wrapperName, WrappedComponent) => {
   if( typeof WrappedComponent === "string" ) {
       return `${wrapperName}(${WrappedComponent})`;
    } else if ( WrappedComponent.displayName ) {
       return `${wrapperName}(${WrappedComponent.displayName})`;
    } else if ( WrappedComponent.name ) {
       return `${wrapperName}(${WrappedComponent.name})`;
    } else if (WrappedComponent){
       return `${wrapperName}(Component)`;
    } else {
      return undefined
    }
}
@mpeyper
Copy link
Contributor

mpeyper commented Nov 20, 2020

Happy to see a PR to remove the dependency.

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

Successfully merging a pull request may close this issue.

2 participants