Skip to content

Commit 554afda

Browse files
committed
chore(settings): replace fxa-common-password-list npm package with vendored lib
Migrate fxa-settings and fxa-content-server off the stale npm package (v0.0.4, last published 2018) to the in-repo @fxa/vendored/common-password-list. Adds webpack aliases for content-server and Jest moduleNameMapper for fxa-settings, and removes the npm dependency.
1 parent dcb1b56 commit 554afda

7 files changed

Lines changed: 20 additions & 28 deletions

File tree

packages/fxa-content-server/app/scripts/models/password_strength/password_strength_balloon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class PasswordStrengthBalloonModel extends Model {
5959

6060
_getCommonPasswordList() {
6161
return import(
62-
/* webpackChunkName: "fxa-common-password-list" */ 'fxa-common-password-list'
62+
/* webpackChunkName: "common-password-list" */ '@fxa/vendored/common-password-list'
6363
);
6464
}
6565

packages/fxa-content-server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"fast-text-encoding": "^1.0.4",
5858
"fxa-auth-client": "workspace:*",
5959
"fxa-auth-server": "workspace:*",
60-
"fxa-common-password-list": "0.0.4",
6160
"fxa-geodb": "workspace:*",
6261
"fxa-mustache-loader": "0.0.2",
6362
"fxa-pairing-channel": "1.0.2",

packages/fxa-content-server/webpack.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ const webpackConfig = {
8282
uuid: require.resolve('node-uuid/uuid'),
8383
vat: require.resolve('node-vat/vat'),
8484
'fxa-auth-client/browser': require.resolve('fxa-auth-client/browser'),
85+
'@fxa/vendored/common-password-list': path.resolve(
86+
__dirname,
87+
'../../libs/vendored/common-password-list/src/index.ts'
88+
),
89+
'@fxa/vendored/incremental-encoder': path.resolve(
90+
__dirname,
91+
'../../libs/vendored/incremental-encoder/src/index.ts'
92+
),
8593
},
8694
},
8795

packages/fxa-settings/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
"@fxa/shared/metrics/glean": "<rootDir>/../../libs/shared/metrics/glean/src/index.ts",
8282
"^@fxa/shared/assets(.*)$": "<rootDir>/../../libs/shared/assets/src$1",
8383
"@fxa/accounts/errors": "<rootDir>/../../libs/accounts/errors/src/index.ts",
84-
"@fxa/accounts/oauth": "<rootDir>/../../libs/accounts/oauth/src/index.ts"
84+
"@fxa/accounts/oauth": "<rootDir>/../../libs/accounts/oauth/src/index.ts",
85+
"@fxa/vendored/common-password-list": "<rootDir>/../../libs/vendored/common-password-list/src/index.ts",
86+
"@fxa/vendored/incremental-encoder": "<rootDir>/../../libs/vendored/incremental-encoder/src/index.ts"
8587
},
8688
"moduleFileExtensions": [
8789
"web.js",
@@ -155,7 +157,6 @@
155157
"file-saver": "^2.0.5",
156158
"fs-extra": "^11.2.0",
157159
"fxa-auth-client": "workspace:*",
158-
"fxa-common-password-list": "^0.0.4",
159160
"fxa-react": "workspace:*",
160161
"html-webpack-plugin": "^5.6.0",
161162
"identity-obj-proxy": "^3.0.0",

packages/fxa-settings/src/components/FormPassword/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,12 @@ export const FormPassword = ({
195195
return !passwordValidator.isSameAsEmail(value.toLowerCase());
196196
},
197197
uncommon: async (value: string) => {
198-
// @ts-ignore
199-
const list = await import('fxa-common-password-list');
198+
const { test: isCommon } = await import(
199+
'@fxa/vendored/common-password-list'
200+
);
200201
const input = value.toLowerCase();
201202
return (
202-
!list.test(input) && !passwordValidator.isBanned(input)
203+
!isCommon(input) && !passwordValidator.isBanned(input)
203204
);
204205
},
205206
},

packages/fxa-settings/src/components/FormPasswordWithInlineCriteria/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,12 @@ export const FormPasswordWithInlineCriteria = ({
289289
);
290290
},
291291
uncommon: async (value: string) => {
292-
// @ts-ignore
293-
const list = await import('fxa-common-password-list');
292+
const { test: isCommon } = await import(
293+
'@fxa/vendored/common-password-list'
294+
);
294295
const input = value.toLowerCase();
295296
return (
296-
!list.test(input) && !passwordValidator.isBanned(input)
297+
!isCommon(input) && !passwordValidator.isBanned(input)
297298
);
298299
},
299300
},

yarn.lock

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36481,15 +36481,6 @@ __metadata:
3648136481
languageName: unknown
3648236482
linkType: soft
3648336483

36484-
"fxa-common-password-list@npm:0.0.4, fxa-common-password-list@npm:^0.0.4":
36485-
version: 0.0.4
36486-
resolution: "fxa-common-password-list@npm:0.0.4"
36487-
dependencies:
36488-
incremental-encoder: "npm:0.0.1"
36489-
checksum: 10c0/ec639effd2d14e5394fbaee29ccec032eab2bf43b15cea33732a0b158ea49733288c26a6dcaa9b7d028ff2c8cf17f48baa4e35e0a77dbf8d27551f0ec7c8b348
36490-
languageName: node
36491-
linkType: hard
36492-
3649336484
"fxa-content-server@workspace:*, fxa-content-server@workspace:packages/fxa-content-server":
3649436485
version: 0.0.0-use.local
3649536486
resolution: "fxa-content-server@workspace:packages/fxa-content-server"
@@ -36534,7 +36525,6 @@ __metadata:
3653436525
firefox-profile: "npm:4.7.0"
3653536526
fxa-auth-client: "workspace:*"
3653636527
fxa-auth-server: "workspace:*"
36537-
fxa-common-password-list: "npm:0.0.4"
3653836528
fxa-geodb: "workspace:*"
3653936529
fxa-mustache-loader: "npm:0.0.2"
3654036530
fxa-pairing-channel: "npm:1.0.2"
@@ -37048,7 +37038,6 @@ __metadata:
3704837038
file-saver: "npm:^2.0.5"
3704937039
fs-extra: "npm:^11.2.0"
3705037040
fxa-auth-client: "workspace:*"
37051-
fxa-common-password-list: "npm:^0.0.4"
3705237041
fxa-react: "workspace:*"
3705337042
fxa-shared: "workspace:*"
3705437043
grunt: "npm:^1.6.1"
@@ -40061,13 +40050,6 @@ __metadata:
4006140050
languageName: node
4006240051
linkType: hard
4006340052

40064-
"incremental-encoder@npm:0.0.1":
40065-
version: 0.0.1
40066-
resolution: "incremental-encoder@npm:0.0.1"
40067-
checksum: 10c0/646032c1ff35ee8556e55d6fbf817fcb172147f4442f5ed786f6b8845cb05e7cc0633ef3c22e57cbf758ac328aac69215d4126f093118e206047ef2a98a4fc66
40068-
languageName: node
40069-
linkType: hard
40070-
4007140053
"indent-string@npm:^4.0.0":
4007240054
version: 4.0.0
4007340055
resolution: "indent-string@npm:4.0.0"

0 commit comments

Comments
 (0)