increase minimum number of words on passphrases to 6 (#11675)

This commit is contained in:
✨ Audrey ✨ 2024-10-24 15:16:10 -04:00 committed by GitHub
parent c44476788f
commit 0254550b07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 25 additions and 25 deletions

View File

@ -60,7 +60,7 @@
<div class="tw-grid tw-grid-cols-12 tw-gap-4">
<bit-form-field class="tw-col-span-6">
<bit-label>{{ "minimumNumberOfWords" | i18n }}</bit-label>
<input bitInput type="number" min="3" max="20" formControlName="minNumberWords" />
<input bitInput type="number" min="6" max="20" formControlName="minNumberWords" />
</bit-form-field>
</div>
<bit-form-control>

View File

@ -1,6 +1,6 @@
function initializeBoundaries() {
const numWords = Object.freeze({
min: 3,
min: 6,
max: 20,
});

View File

@ -3,7 +3,7 @@ import { PassphraseGenerationOptions } from "../types";
/** The default options for passphrase generation. */
export const DefaultPassphraseGenerationOptions: Partial<PassphraseGenerationOptions> =
Object.freeze({
numWords: 3,
numWords: 6,
wordSeparator: "-",
capitalize: false,
includeNumber: false,

View File

@ -164,7 +164,7 @@ describe("Password generator options builder", () => {
},
);
it.each([3, 8, 18, 20])(
it.each([6, 8, 18, 20])(
"should set `numWords` (= %i) to the input value when it is within the boundaries",
(numWords) => {
expect(numWords).toBeGreaterThanOrEqual(DefaultPassphraseBoundaries.numWords.min);

View File

@ -72,9 +72,9 @@ describe("PassphrasePolicyConstraints", () => {
});
it.each([
[1, 3],
[1, 6],
[21, 20],
])("fits numWords (=%p) within the default bounds (3 <= %p <= 20)", (value, expected) => {
])("fits numWords (=%p) within the default bounds (6 <= %p <= 20)", (value, expected) => {
const policy = new PassphrasePolicyConstraints(Policies.Passphrase.disabledValue);
const { numWords } = policy.adjust({ ...SomeSettings, numWords: value });
@ -83,7 +83,7 @@ describe("PassphrasePolicyConstraints", () => {
});
it.each([
[1, 4, 4],
[1, 6, 6],
[21, 20, 20],
])(
"fits numWords (=%p) within the policy bounds (%p <= %p <= 20)",

View File

@ -98,7 +98,7 @@ describe("Passphrase generation strategy", () => {
const strategy = new PassphraseGeneratorStrategy(randomizer, null);
const result = await strategy.generate({
numWords: 4,
numWords: 6,
capitalize: true,
includeNumber: true,
wordSeparator: "!",
@ -106,7 +106,7 @@ describe("Passphrase generation strategy", () => {
expect(result).toEqual("passphrase");
expect(randomizer.randomEffLongWords).toHaveBeenCalledWith({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: true,
separator: "!",
@ -135,14 +135,14 @@ describe("Passphrase generation strategy", () => {
const strategy = new PassphraseGeneratorStrategy(randomizer, null);
const result = await strategy.generate({
numWords: 4,
numWords: 6,
includeNumber: true,
wordSeparator: "!",
});
expect(result).toEqual("passphrase");
expect(randomizer.randomEffLongWords).toHaveBeenCalledWith({
numberOfWords: 4,
numberOfWords: 6,
capitalize: DefaultPassphraseGenerationOptions.capitalize,
number: true,
separator: "!",
@ -153,14 +153,14 @@ describe("Passphrase generation strategy", () => {
const strategy = new PassphraseGeneratorStrategy(randomizer, null);
const result = await strategy.generate({
numWords: 4,
numWords: 6,
capitalize: true,
wordSeparator: "!",
});
expect(result).toEqual("passphrase");
expect(randomizer.randomEffLongWords).toHaveBeenCalledWith({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: DefaultPassphraseGenerationOptions.includeNumber,
separator: "!",
@ -171,14 +171,14 @@ describe("Passphrase generation strategy", () => {
const strategy = new PassphraseGeneratorStrategy(randomizer, null);
const result = await strategy.generate({
numWords: 4,
numWords: 6,
capitalize: true,
includeNumber: true,
});
expect(result).toEqual("passphrase");
expect(randomizer.randomEffLongWords).toHaveBeenCalledWith({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: true,
separator: DefaultPassphraseGenerationOptions.wordSeparator,

View File

@ -350,14 +350,14 @@ describe("optionsToRandomAsciiRequest", () => {
describe("optionsToEffWordListRequest", () => {
it("should map options", async () => {
const result = optionsToEffWordListRequest({
numWords: 4,
numWords: 6,
capitalize: true,
includeNumber: true,
wordSeparator: "!",
});
expect(result).toEqual({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: true,
separator: "!",
@ -381,13 +381,13 @@ describe("optionsToEffWordListRequest", () => {
it("should default capitalize", async () => {
const result = optionsToEffWordListRequest({
numWords: 4,
numWords: 6,
includeNumber: true,
wordSeparator: "!",
});
expect(result).toEqual({
numberOfWords: 4,
numberOfWords: 6,
capitalize: DefaultPassphraseGenerationOptions.capitalize,
number: true,
separator: "!",
@ -396,13 +396,13 @@ describe("optionsToEffWordListRequest", () => {
it("should default includeNumber", async () => {
const result = optionsToEffWordListRequest({
numWords: 4,
numWords: 6,
capitalize: true,
wordSeparator: "!",
});
expect(result).toEqual({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: DefaultPassphraseGenerationOptions.includeNumber,
separator: "!",
@ -411,13 +411,13 @@ describe("optionsToEffWordListRequest", () => {
it("should default wordSeparator", async () => {
const result = optionsToEffWordListRequest({
numWords: 4,
numWords: 6,
capitalize: true,
includeNumber: true,
});
expect(result).toEqual({
numberOfWords: 4,
numberOfWords: 6,
capitalize: true,
number: true,
separator: DefaultPassphraseGenerationOptions.wordSeparator,

View File

@ -348,7 +348,7 @@ describe("LegacyPasswordGenerationService", () => {
const innerPassphrase = createPassphraseGenerator(
{},
{
minNumberWords: 5,
minNumberWords: 6,
capitalize: true,
includeNumber: true,
},
@ -370,7 +370,7 @@ describe("LegacyPasswordGenerationService", () => {
expect(result).toBe(options);
expect(result).toMatchObject({
numWords: 5,
numWords: 6,
capitalize: true,
includeNumber: true,
});