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

Updates to resolve vulnerability warnings #24

Merged
merged 7 commits into from
Jan 7, 2020

Conversation

johnworth
Copy link
Contributor

@johnworth johnworth commented Dec 12, 2019

When ui-lib was pulled into neat-example, npm started reporting over 2k vulnerabilities. This pull request is an attempt to get that number as close to 0 as possible.

This required an update to react-scripts. Its dependencies are a source of ~70 vulnerabilities, plus I can't get unit tests to run on newer versions of macOS without an upgrade.

John Wregglesworth added 2 commits December 12, 2019 08:02
I'm running the newest version of macOS, which has issues with
older versions of fsevents, which is pulled in because of
react-scripts. As a result, I cannot run unit tests against this
update. I'll tackle react-scripts next, since it's dependencies
are the source of 69 vulnerabilities.
The unit tests are passing and storybook is working, but there are
a couple of lingering error messages that need to be looked into.
John Wregglesworth added 4 commits December 12, 2019 08:48
Storybook was spewing warnings about using default exports in the
same file as storiesOf(), so I modified the stories to remove the
default keyword. The exports are still available, but they're no
longer the default. The unit tests were modified to use the new
non-default exports from the stories. In a couple of cases,
inconsistencies in the names of the imported/exported items were
fixed.
oneOf() checks values, oneOfType() checks types which is what
was actually desired.
@johnworth johnworth changed the title WIP: Updates to resolve vulnerability warnings Updates to resolve vulnerability warnings Dec 12, 2019
@johnworth
Copy link
Contributor Author

I'm seeing the following deprecation warning, but it seems to require an update of something provided my material-ui so I left it alone for now:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details. * Move data fetching code or side effects to componentDidUpdate. * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder. Please update the following components: AutosizeInput, Creatable, Select

@@ -6,7 +6,7 @@ import React, { Component } from "react";
import CopyTextArea from "../src/components/copy/CopyTextArea";
import { storiesOf } from "@storybook/react";

export default class CopyTextAreaTest extends Component {
export class CopyTextAreaTest extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide the error/warning you're getting that prompted this change? I'm not seeing anything on my machine when I run Storybook.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm seeing this in the Actions pane in Storybook:

Screen Shot 2019-12-12 at 11 12 44 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I'm seeing on the master branch, I should add.

@@ -22,7 +23,8 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-intl": "^2.9.0",
"react-select": "^2.0.0"
"react-select": "^2.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is where you're getting the componentWillReceiveProps warning. Looks like they recently pushed out v3.0.7 which has the fix for this. Since they bumped a major version though, we may have to update our Autocomplete component for any breaking changes.

JedWatson/react-select#3720

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good to know. I had a suspicion that's where it was coming from based on the error message, but since it was just a warning I didn't want to risk breaking a ton of stuff.

Copy link

Choose a reason for hiding this comment

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

@@ -22,7 +23,8 @@
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-intl": "^2.9.0",
"react-select": "^2.0.0"
"react-select": "^2.0.0",
"typescript": "^3.7.3"
Copy link
Contributor

Choose a reason for hiding this comment

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

This peer dependency will currently not work with the DE. We could go with a branching strategy like you suggested, but then I'm not sure how that will work since we push and build ui-lib as a version to npm 🤔 I'm not sure if we want to just version lock the DE to whatever version it's at now and let Sonora get all the updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think we can limit the DE to the current major version (allowing for bug fixes as minor version updates), but let the Sonora get the latest updates. Honestly, I think that's going to be required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For clarification, I mean something like limit the DE to ^1.0.0 (just as an example) which is built and pushed to npm from the DE branch, while master continues to have the lastest code starting with version 2.0.0. I pulled those version numbers out of the air just as examples.

@@ -79,7 +79,7 @@ CopyTextArea.propTypes = {
debugIdPrefix: PropTypes.string,
multiline: PropTypes.bool,
text: PropTypes.string.isRequired,
btnText: PropTypes.oneOf([PropTypes.string, PropTypes.object]),
btnText: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
Copy link
Contributor

Choose a reason for hiding this comment

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

oops, that was my tpyo, thanks for fixing!

Copy link

@sri2k1us sri2k1us left a comment

Choose a reason for hiding this comment

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

Looks good to me. Should we bump this change to version 1.x ?

@johnworth
Copy link
Contributor Author

I'll bump up the version here and create a branch/tag to maintain a build for the old DE.

Copy link
Contributor

@slr71 slr71 left a comment

Choose a reason for hiding this comment

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

I'm not an expert in any of this, but it looks good to me.

@johnworth johnworth requested a review from ash3rz January 7, 2020 16:30
@johnworth
Copy link
Contributor Author

After discussing things with Sarah and Sriram a bit, I'm going to go ahead and merge this.

@johnworth johnworth merged commit 8c953b8 into cyverse-archive:master Jan 7, 2020
Copy link
Contributor

@ash3rz ash3rz left a comment

Choose a reason for hiding this comment

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

LGTM

@johnworth
Copy link
Contributor Author

Thanks for the reviews!

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 this pull request may close these issues.

4 participants