Skip to content

[PM-36021] Remove hyphenated words from passphrase generator input/output#1007

Merged
harr1424 merged 6 commits into
mainfrom
PM-36021-Remove-hyphens-from-hyphenated-words-in-EFF-word-list
May 6, 2026
Merged

[PM-36021] Remove hyphenated words from passphrase generator input/output#1007
harr1424 merged 6 commits into
mainfrom
PM-36021-Remove-hyphens-from-hyphenated-words-in-EFF-word-list

Conversation

@harr1424
Copy link
Copy Markdown
Contributor

@harr1424 harr1424 commented Apr 28, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-36021

📔 Objective

This PR removes hyphenated words from the slice of words used to generate passphrases. This accomplishes the following:

  • avoid obscure test failures
  • avoid passphrase output that appears to violate requested word count

As an example, the word list formerly contained the word "drop-down" which resulted in the following test failure:

failures:

---- test_generate_passphrase_default_words stdout ----

thread 'test_generate_passphrase_default_words' (26459) panicked at crates/bw/tests/generate.rs:208:5:
assertion `left == right` failed: Default passphrase should have 6 words, got: safeness-drop-down-proud-endpoint-siesta-bobble
  left: 7
 right: 6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

⚠️ 4 words out of 7776 in the wordlist will effectively be filtered from the input of words used to generate a random passphrase, slightly reducing the amount of entropy present in this process.

@harr1424 harr1424 requested review from a team as code owners April 28, 2026 21:48
@harr1424 harr1424 requested a review from Thomas-Avery April 28, 2026 21:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

Logo
Checkmarx One – Scan Summary & Detailsdc71ed87-879d-4bad-b1c6-440024f13f07

Great job! No new security vulnerabilities introduced in this pull request

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 28, 2026

🔍 SDK Breaking Change Detection

SDK Version: PM-36021-Remove-hyphens-from-hyphenated-words-in-EFF-word-list (7c1a610)

Client Status Details

| typescript | ⚠️ Workflow execution issues | Check workflow logs for details |

| android | ⚠️ Workflow execution issues | Check workflow logs for details |

Results update as workflows complete.

Copy link
Copy Markdown
Contributor

@quexten quexten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should base changes to cryptographic entropy on the fact that test failures occur. However, I would argue that felt, tip, are two separate words juts as well as felt-tip is one, so in the context of felt-tip-drool, it is unclear whether the user has chosen three words or two. In the context of our application use of joining with -, these words create inconsistent output generation (as discovered by the test).

If we were to do this, we must add a proper comment. We no longer use the EFF wordlist. We should rename the const to EFF_WORDLIST_MODIFIED.

However, this currently introduces a breaking change that makes cryptographic fingerprints incompatible with the old set of fingerprints. The unit tests also confirm this.

let entropy_per_word = (EFF_LONG_WORD_LIST.len() as f64).log2();

Because of this, my suggestion is to actually introduce a tools-owned function to filter the EFF wordlist to exclude these specific words, and to use that in your code.

@harr1424 harr1424 marked this pull request as draft April 29, 2026 14:31
This reverts commit 7c1a610.

revert word removal
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.51%. Comparing base (3aa1201) to head (8cb78da).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1007      +/-   ##
==========================================
+ Coverage   84.30%   84.51%   +0.20%     
==========================================
  Files         395      403       +8     
  Lines       48632    49981    +1349     
==========================================
+ Hits        41000    42240    +1240     
- Misses       7632     7741     +109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@harr1424 harr1424 changed the title [PM-36021] Remove hyphenated words from passphrase generator word list [PM-36021] Remove hyphenated words from passphrase generator output Apr 29, 2026
@harr1424 harr1424 marked this pull request as ready for review April 29, 2026 15:31
@harr1424 harr1424 requested review from a team as code owners April 29, 2026 15:31
@harr1424 harr1424 requested a review from dani-garcia April 29, 2026 15:31
@harr1424 harr1424 changed the title [PM-36021] Remove hyphenated words from passphrase generator output [PM-36021] Remove hyphenated words from passphrase generator input/output Apr 29, 2026
@Thomas-Avery Thomas-Avery removed their request for review April 29, 2026 15:52
@harr1424 harr1424 requested a review from quexten April 29, 2026 16:02
Comment thread crates/bitwarden-generators/src/passphrase.rs
Co-authored-by: Bernd Schoolmann <accounts@quexten.com>
@harr1424 harr1424 requested a review from quexten April 30, 2026 13:44
mcamirault
mcamirault previously approved these changes Apr 30, 2026
assert_eq!(
&gen_words(&mut rng, 4),
&["crust", "subsystem", "undertook", "protector"]
&["crust", "substance", "undertook", "protector"]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to gen_words() effectively reduce the size of the wordlist used, but only local to that function call. The tests in this file have been updated so that word removals have been accounted for.

@harr1424 harr1424 requested a review from mcamirault April 30, 2026 14:34
@sonarqubecloud
Copy link
Copy Markdown

@harr1424 harr1424 merged commit 21488a3 into main May 6, 2026
67 checks passed
@harr1424 harr1424 deleted the PM-36021-Remove-hyphens-from-hyphenated-words-in-EFF-word-list branch May 6, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants