Skip to content

Commit b1c0124

Browse files
mamankhan99ghassanmas
authored andcommitted
build: backport of #605
Update packages to remove security vulnerabilities (#605) * fix: updated vulnerable packages * fix: fixed failed tests after package update * fix: linting issues failing ci tests * fix: package lock update * fix: snapshot updated to UTC * fix: missing dependency 'long'
1 parent 36a945c commit b1c0124

File tree

11 files changed

+2575
-8941
lines changed

11 files changed

+2575
-8941
lines changed

package-lock.json

Lines changed: 2537 additions & 8901 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
1616
"snapshot": "fedx-scripts jest --updateSnapshot",
1717
"start": "fedx-scripts webpack-dev-server --progress",
18-
"test": "fedx-scripts jest --coverage --passWithNoTests"
18+
"test": "TZ=UTC fedx-scripts jest --coverage --passWithNoTests"
1919
},
2020
"bugs": {
2121
"url": "https://github.com/edx/frontend-app-account/issues"
@@ -40,8 +40,8 @@
4040
"@fortawesome/free-solid-svg-icons": "5.15.4",
4141
"@fortawesome/react-fontawesome": "0.1.16",
4242
"@tensorflow-models/blazeface": "0.0.7",
43-
"@tensorflow/tfjs-converter": "3.11.0",
44-
"@tensorflow/tfjs-core": "3.11.0",
43+
"@tensorflow/tfjs-converter": "3.18.0",
44+
"@tensorflow/tfjs-core": "3.18.0",
4545
"bowser": "2.11.0",
4646
"classnames": "2.3.1",
4747
"core-js": "3.19.3",
@@ -59,6 +59,7 @@
5959
"lodash.omit": "4.5.0",
6060
"lodash.pick": "4.4.0",
6161
"lodash.pickby": "4.6.0",
62+
"long": "^5.2.0",
6263
"memoize-one": "5.2.1",
6364
"prop-types": "15.7.2",
6465
"qs": "6.10.3",

src/account-settings/certificate-preference/CertificatePreference.jsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ function CertificatePreference({
2929
saveState,
3030
useVerifiedNameForCerts,
3131
}) {
32-
if (!originalVerifiedName) {
33-
// If the user doesn't have an approved verified name, do not display this component
34-
return null;
35-
}
36-
3732
const dispatch = useDispatch();
3833
const [checked, setChecked] = useState(false);
3934
const [modalIsOpen, setModalIsOpen] = useState(false);
@@ -75,21 +70,27 @@ function CertificatePreference({
7570
}
7671

7772
useEffect(() => {
78-
if (fieldName === 'verified_name') {
79-
setChecked(useVerifiedNameForCerts);
80-
} else {
81-
setChecked(!useVerifiedNameForCerts);
73+
if (originalVerifiedName) {
74+
if (fieldName === 'verified_name') {
75+
setChecked(useVerifiedNameForCerts);
76+
} else {
77+
setChecked(!useVerifiedNameForCerts);
78+
}
8279
}
83-
}, [useVerifiedNameForCerts]);
80+
}, [originalVerifiedName, fieldName, useVerifiedNameForCerts]);
8481

8582
useEffect(() => {
86-
if (modalIsOpen && saveState === 'complete') {
87-
setModalIsOpen(false);
88-
dispatch(closeForm(fieldName));
83+
if (originalVerifiedName) {
84+
if (modalIsOpen && saveState === 'complete') {
85+
setModalIsOpen(false);
86+
dispatch(closeForm(fieldName));
87+
}
8988
}
90-
}, [modalIsOpen, saveState]);
89+
}, [dispatch, originalVerifiedName, fieldName, modalIsOpen, saveState]);
90+
91+
// If the user doesn't have an approved verified name, do not display this component
9192

92-
return (
93+
return originalVerifiedName ? (
9394
<>
9495
<Form.Checkbox className="mt-1 mb-4" checked={checked} onChange={handleCheckboxChange}>
9596
{intl.formatMessage(messages['account.settings.field.name.checkbox.certificate.select'])}
@@ -150,7 +151,7 @@ function CertificatePreference({
150151
</Form>
151152
</ModalDialog>
152153
</>
153-
);
154+
) : null;
154155
}
155156

156157
CertificatePreference.propTypes = {

src/account-settings/delete-account/__snapshots__/ConfirmationModal.test.jsx.snap

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,14 @@ Array [
386386
"width": "1px",
387387
}
388388
}
389-
tabIndex={0}
389+
tabIndex={-1}
390390
/>
391391
<div
392-
data-focus-lock-disabled={false}
392+
data-focus-lock-disabled="disabled"
393393
onBlur={[Function]}
394394
onFocus={[Function]}
395-
onMouseDown={[Function]}
396395
onScrollCapture={[Function]}
397396
onTouchMoveCapture={[Function]}
398-
onTouchStart={[Function]}
399397
onWheelCapture={[Function]}
400398
>
401399
<div
@@ -513,7 +511,7 @@ Array [
513511
"width": "1px",
514512
}
515513
}
516-
tabIndex={0}
514+
tabIndex={-1}
517515
/>
518516
</div>
519517
</div>,

src/account-settings/delete-account/__snapshots__/SuccessModal.test.jsx.snap

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,16 +417,14 @@ Array [
417417
"width": "1px",
418418
}
419419
}
420-
tabIndex={0}
420+
tabIndex={-1}
421421
/>
422422
<div
423-
data-focus-lock-disabled={false}
423+
data-focus-lock-disabled="disabled"
424424
onBlur={[Function]}
425425
onFocus={[Function]}
426-
onMouseDown={[Function]}
427426
onScrollCapture={[Function]}
428427
onTouchMoveCapture={[Function]}
429-
onTouchStart={[Function]}
430428
onWheelCapture={[Function]}
431429
>
432430
<div
@@ -480,7 +478,7 @@ Array [
480478
"width": "1px",
481479
}
482480
}
483-
tabIndex={0}
481+
tabIndex={-1}
484482
/>
485483
</div>
486484
</div>,

src/account-settings/demographics/Checkboxes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Checkboxes = (props) => {
1414
const [selected, setSelected] = useState(values);
1515
useEffect(() => {
1616
onChange(id, selected);
17-
}, [selected]);
17+
}, [id, onChange, selected]);
1818

1919
const handleToggle = (value, option) => {
2020
// If the user checked 'declined', uncheck all other options

src/account-settings/name-change/NameChange.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useCallback, useEffect, useState } from 'react';
22
import { connect, useDispatch } from 'react-redux';
33
import { useHistory } from 'react-router-dom';
44
import PropTypes from 'prop-types';
@@ -34,20 +34,20 @@ function NameChangeModal({
3434
const [verifiedNameInput, setVerifiedNameInput] = useState(formValues.verified_name || '');
3535
const [confirmedWarning, setConfirmedWarning] = useState(false);
3636

37-
function resetLocalState() {
37+
const resetLocalState = useCallback(() => {
3838
setConfirmedWarning(false);
3939
dispatch(requestNameChangeReset());
40-
}
40+
}, [dispatch]);
4141

4242
function handleChange(e) {
4343
setVerifiedNameInput(e.target.value);
4444
}
4545

46-
function handleClose() {
46+
const handleClose = useCallback(() => {
4747
resetLocalState();
4848
dispatch(closeForm(targetFormId));
4949
dispatch(saveSettingsReset());
50-
}
50+
}, [dispatch, resetLocalState, targetFormId]);
5151

5252
function handleSubmit(e) {
5353
e.preventDefault();
@@ -71,7 +71,7 @@ function NameChangeModal({
7171
handleClose();
7272
push(`/id-verification?next=${encodeURIComponent('account/settings')}`);
7373
}
74-
}, [saveState]);
74+
}, [handleClose, push, saveState]);
7575

7676
function renderErrors() {
7777
if (Object.keys(errors).length > 0) {

src/id-verification/ImageFileUpload.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function ImageFileUpload({ onFileChange, intl }) {
3131
});
3232
fileReader.readAsDataURL(fileObject);
3333
}
34-
}, []);
34+
}, [errorTypes.fileTooLarge, errorTypes.invalidFileType, onFileChange]);
3535

3636
return (
3737
<>

src/id-verification/panels/BasePanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function BasePanel({
1616
if (focusOnMount && headingRef.current) {
1717
headingRef.current.focus();
1818
}
19-
}, [headingRef.current]);
19+
}, [focusOnMount]);
2020

2121
const redirectSlug = useVerificationRedirectSlug(name);
2222
if (redirectSlug) {

src/id-verification/panels/GetNameIdPanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function GetNameIdPanel(props) {
2828
if (location.state?.fromSummary && nameInputRef.current) {
2929
nameInputRef.current.focus();
3030
}
31-
}, []);
31+
}, [idPhotoName, location.state, nameOnAccountValue, setIdPhotoName]);
3232

3333
function handleSubmit(e) {
3434
e.preventDefault();

src/id-verification/panels/SummaryPanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function SummaryPanel(props) {
3232
const [isSubmitting, setIsSubmitting] = useState(false);
3333
const [submissionError, setSubmissionError] = useState(null);
3434

35-
useEffect(() => setReachedSummary(true), []);
35+
useEffect(() => setReachedSummary(true), [setReachedSummary]);
3636

3737
function renderManagedProfileMessage() {
3838
if (!profileDataManager) {

0 commit comments

Comments
 (0)