This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Upgrade Formik to v2.x to reduce vulnerability #236
Merged
ftianli-amzn
merged 18 commits into
opendistro-for-elasticsearch:master
from
tlfeng:formik2
Jan 26, 2021
Merged
Upgrade Formik to v2.x to reduce vulnerability #236
ftianli-amzn
merged 18 commits into
opendistro-for-elasticsearch:master
from
tlfeng:formik2
Jan 26, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ftianli-amzn
requested review from
qreshi,
dbbaughe,
ylwu-amzn,
yizheliu-amazon,
annie3431,
lezzago and
skkosuri-amzn
January 21, 2021 19:45
ftianli-amzn
added
dependencies
Pull requests that update a dependency file
maintenance
improves code quality, but not the product
labels
Jan 22, 2021
… to Formik v2 upgrade
…s not wrapped in act(...)
…s not wrapped in act(...)
yizheliu-amazon
approved these changes
Jan 22, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
dbbaughe
approved these changes
Jan 24, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
dependencies
Pull requests that update a dependency file
maintenance
improves code quality, but not the product
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
There is a vulnerability
CVE-2020-7793
shows that the packageua-parser-js
before0.7.23
are vulnerable to Regular Expression Denial of Service (ReDoS) in multiple regexes.In Alerting Kibana plugin, the dependency relationship of
ua-parser-js
is:formik -> create-react-context -> fbjs -> ua-parser-js
Upgrading
Formik
is the way to reduce the vulnerability.Description of changes:
1.1.1
to^2.2.5
(which is the same asAnomaly Detection Kibana
plugin commit, thus the two plugins can be built together in same directory)throw
to resolved promise of errors withreturn
in validation functions for Monitor and Destination, according to Formik v2 migration guide, or there will be an error like below.ManageEmailGroups.js
andManageSender.js
, initializeinitialValues
variable that used for Formik with a empty object, becauseinitialValues
is required in Formik v2 and unit test fails with the variable initialization.MonitorIndex.test.js
andAnomalyDetector.test.js
, change the assertion step according to the advice here, because Enzyme'swrapper.instance()
returnsnull
so that the Formik values instate
can't be obtained.MonitorIndex.test.js
andAnomalyDetector.test.js
, modify the logic of the test to wait for asynchronous Formik's handlers, because Enzyme's change event is synchronous. I used the same way as tests related to Email Destination: commitcalls onSearchChange when changing input value
inMonitorIndex.test.js
, cancel waiting for asynchronous actions as the assertion result is not affected with or without it.async
mark of a test inWhereExpression.test.js
to eliminate the following console error:Note:
There will be plenty of
console.warn
in both unit tests and browser according to Formik v2 migration guide.I will address it in another PR as lots of files are involved.
Test results:
Unit test:
End-to-End test:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.