Skip to content

Commit 7110e8a

Browse files
authored
fix: [#4490] Usage of a vulnerable package - Upgrade recognizers-text-number (#4524)
* Upgrade recognizers-text-number to latest version * Update unit tests to work with new entities
1 parent 06d7883 commit 7110e8a

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

libraries/botbuilder-dialogs-adaptive/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@microsoft/recognizers-text": "~1.1.4",
3232
"@microsoft/recognizers-text-choice": "~1.1.4",
3333
"@microsoft/recognizers-text-date-time": "~1.1.4",
34-
"@microsoft/recognizers-text-number": "~1.1.4",
34+
"@microsoft/recognizers-text-number": "~1.3.1",
3535
"@microsoft/recognizers-text-number-with-unit": "~1.1.4",
3636
"@microsoft/recognizers-text-sequence": "~1.1.4",
3737
"@microsoft/recognizers-text-suite": "1.1.4",

libraries/botbuilder-dialogs-adaptive/tests/entityRecognizer.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('EntityRecognizer Tests', function () {
9696
it('test datetime', async function () {
9797
const dc = getDialogContext('testDatetime', 'Next thursday at 4pm.');
9898
const results = await recognizers.recognizeEntities(dc, dc.context.activity.text, dc.context.activity.locale);
99-
assert.strictEqual(results.length, 3); // should be 4 but ordinal entity is missing.
99+
assert.strictEqual(results.length, 4);
100100
assert.strictEqual(results.filter((e) => e.type === 'datetimeV2.datetime').length, 1);
101101
// assert.strictEqual(results.filter((e) => e.type === 'ordinal').length, 1);
102102
assert.strictEqual(results.filter((e) => e.type === 'dimension').length, 1);
@@ -119,7 +119,7 @@ describe('EntityRecognizer Tests', function () {
119119
it('test guid', async function () {
120120
const dc = getDialogContext('testGuid', 'my account number is 00000000-0000-0000-0000-000000000000...');
121121
const results = await recognizers.recognizeEntities(dc, dc.context.activity.text, dc.context.activity.locale);
122-
assert.strictEqual(results.length, 3); // should be 7, but some entitie are missing.
122+
assert.strictEqual(results.length, 7);
123123
assert.strictEqual(results.filter((e) => e.type === 'guid').length, 1);
124124
});
125125

@@ -168,7 +168,7 @@ describe('EntityRecognizer Tests', function () {
168168
it('test phonenumber', async function () {
169169
const dc = getDialogContext('testPhonenumber', 'Call 425-882-8080');
170170
const results = await recognizers.recognizeEntities(dc, dc.context.activity.text, dc.context.activity.locale);
171-
assert.strictEqual(results.length, 3); // should be 5, but some entities are missing.
171+
assert.strictEqual(results.length, 5);
172172
assert.strictEqual(results.filter((e) => e.type === 'phonenumber').length, 1);
173173
});
174174

libraries/botbuilder-dialogs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"dependencies": {
3030
"@microsoft/recognizers-text-choice": "1.1.4",
3131
"@microsoft/recognizers-text-date-time": "1.1.4",
32-
"@microsoft/recognizers-text-number": "1.1.4",
32+
"@microsoft/recognizers-text-number": "1.3.1",
3333
"@microsoft/recognizers-text-suite": "1.1.4",
3434
"botbuilder-core": "4.1.6",
3535
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"underscore": "1.13.1",
4949
"json-schema": "0.4.0",
5050
"jsonwebtoken": "9.0.0",
51+
"@microsoft/recognizers-text-number": "~1.3.1",
5152
"@xmldom/xmldom": "0.8.6",
5253
"**/botbuilder-ai/@azure/cognitiveservices-luis-runtime/@azure/ms-rest-js": "^2.7.0",
5354
"**/botbuilder-azure/@azure/core-auth/@azure/core-tracing": "1.0.0-preview.9",

yarn.lock

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,16 +1504,14 @@
15041504
lodash.last "^3.0.0"
15051505
lodash.max "^4.0.1"
15061506

1507-
"@microsoft/recognizers-text-number@1.1.4", "@microsoft/recognizers-text-number@~1.1.4":
1508-
version "1.1.4"
1509-
resolved "https://registry.yarnpkg.com/@microsoft/recognizers-text-number/-/recognizers-text-number-1.1.4.tgz#1fbe0473322e6292bb93f9af86c6ca5ce05212d9"
1510-
integrity sha512-6EmlR+HR+eJBIX7sQby1vs6LJB64wxLowHaGpIU9OCXFvZ5Nb0QT8qh10rC40v3Mtrz4DpScXfSXr9tWkIO5MQ==
1507+
"@microsoft/recognizers-text-number@1.3.1", "@microsoft/recognizers-text-number@~1.1.4", "@microsoft/recognizers-text-number@~1.3.1":
1508+
version "1.3.1"
1509+
resolved "https://registry.yarnpkg.com/@microsoft/recognizers-text-number/-/recognizers-text-number-1.3.1.tgz#b2bffbb0b5c44eec77121f0c510c5bb40f77c668"
1510+
integrity sha512-JBxhSdihdQLQilCtqISEBw5kM+CNGTXzy5j5hNoZECNUEvBUPkAGNEJAeQPMP5abrYks29aSklnSvSyLObXaNQ==
15111511
dependencies:
1512-
"@microsoft/recognizers-text" "~1.1.4"
1512+
"@microsoft/recognizers-text" "~1.3.1"
15131513
bignumber.js "^7.2.1"
1514-
lodash.escaperegexp "^4.1.2"
1515-
lodash.sortby "^4.7.0"
1516-
lodash.trimend "^4.5.1"
1514+
lodash "^4.17.21"
15171515

15181516
"@microsoft/recognizers-text-sequence@~1.1.4":
15191517
version "1.1.4"
@@ -1540,6 +1538,11 @@
15401538
resolved "https://registry.yarnpkg.com/@microsoft/recognizers-text/-/recognizers-text-1.1.4.tgz#264530f748b2cad3fac54d53538f88ad2bf99b7e"
15411539
integrity sha512-hlSVXcaX5i8JcjuUJpVxmy2Z/GxvFXarF0KVySCFop57wNEnrLWMHe4I4DjP866G19VyIKRw+vPA32pkGhZgTg==
15421540

1541+
"@microsoft/recognizers-text@~1.3.1":
1542+
version "1.3.1"
1543+
resolved "https://registry.yarnpkg.com/@microsoft/recognizers-text/-/recognizers-text-1.3.1.tgz#eda98a9148101ecdb04ed1424082d472b04aabd9"
1544+
integrity sha512-HikLoRUgSzM4OKP3JVBzUUp3Q7L4wgI17p/3rERF01HVmopcujY3i6wgx8PenCwbenyTNxjr1AwSDSVuFlYedQ==
1545+
15431546
"@microsoft/tsdoc-config@~0.15.2":
15441547
version "0.15.2"
15451548
resolved "https://registry.yarnpkg.com/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz#eb353c93f3b62ab74bdc9ab6f4a82bcf80140f14"
@@ -8730,11 +8733,6 @@ lodash.set@^4.3.2:
87308733
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
87318734
integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM=
87328735

8733-
lodash.sortby@^4.7.0:
8734-
version "4.7.0"
8735-
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
8736-
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
8737-
87388736
lodash.template@^3.0.0:
87398737
version "3.6.2"
87408738
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-3.6.2.tgz#f8cdecc6169a255be9098ae8b0c53d378931d14f"
@@ -8787,11 +8785,6 @@ lodash.tonumber@^4.0.3:
87878785
resolved "https://registry.yarnpkg.com/lodash.tonumber/-/lodash.tonumber-4.0.3.tgz#0b96b31b35672793eb7f5a63ee791f1b9e9025d9"
87888786
integrity sha1-C5azGzVnJ5Prf1pj7nkfG56QJdk=
87898787

8790-
lodash.trimend@^4.5.1:
8791-
version "4.5.1"
8792-
resolved "https://registry.yarnpkg.com/lodash.trimend/-/lodash.trimend-4.5.1.tgz#12804437286b98cad8996b79414e11300114082f"
8793-
integrity sha1-EoBENyhrmMrYmWt5QU4RMAEUCC8=
8794-
87958788
lodash@^4.1.2, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@~4.17.15, lodash@~4.17.19:
87968789
version "4.17.21"
87978790
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"

0 commit comments

Comments
 (0)