fix(e2e): trim bootstrap password before hashing (BUNYIP-166) #186

Merged
nrupard merged 1 commit from fix/BUNYIP-166-bootstrap-trim-password into main 2026-06-22 20:16:19 +02:00
Owner

What

Fixes bunyip-e2e-bootstrap hashing the password with incidental surrounding whitespace, which caused a staging login to fail with "email or password incorrect" even though the seed value and E2E_STAGING_PASSWORD matched character-for-character.

The asymmetry:

  • bootstrap hashed the raw &password (only password.trim().is_empty() was checked).
  • the suite logs in with the TRIMMED password (e2e/lib/env.ts required() -> value.trim()).
  • bunyip login trims the email but NOT the password (auth_pages.rs).

So a seed value with a trailing \n stored a hash for "P\n" while the suite sent "P". Now the bootstrap trims before hashing (.hash(password.trim())), matching the suite.

Test

Not compiled locally (musl/dunite workspace); CI validates. Trivial string-trim, password is now &str, no type impact. Empty/whitespace-only still bails.

Deploy / unblock

The existing seeded account still carries the old (whitespaced) hash until re-seeded. After this lands: rebuild the image, redeploy c-01, then just e2e-bootstrap again (now trims). Immediate workaround without waiting for this: re-seed with a whitespace-clean value, since the suite already trims.

#BUNYIP-166

## What Fixes `bunyip-e2e-bootstrap` hashing the password with incidental surrounding whitespace, which caused a staging login to fail with `"email or password incorrect"` even though the seed value and `E2E_STAGING_PASSWORD` matched character-for-character. The asymmetry: - bootstrap hashed the raw `&password` (only `password.trim().is_empty()` was checked). - the suite logs in with the TRIMMED password (`e2e/lib/env.ts` `required()` -> `value.trim()`). - bunyip login trims the email but NOT the password (`auth_pages.rs`). So a seed value with a trailing `\n` stored a hash for `"P\n"` while the suite sent `"P"`. Now the bootstrap trims before hashing (`.hash(password.trim())`), matching the suite. ## Test Not compiled locally (musl/dunite workspace); CI validates. Trivial string-trim, `password` is now `&str`, no type impact. Empty/whitespace-only still bails. ## Deploy / unblock The existing seeded account still carries the old (whitespaced) hash until re-seeded. After this lands: rebuild the image, redeploy c-01, then `just e2e-bootstrap` again (now trims). Immediate workaround without waiting for this: re-seed with a whitespace-clean value, since the suite already trims. #BUNYIP-166
fix(e2e): trim the bootstrap password before hashing (whitespace login mismatch)
Some checks failed
E2E / Playwright against deployment (pull_request) Failing after 1m59s
Check / fmt + clippy + build + tests (pull_request) Successful in 11m49s
Create release / Create release from merged PR (pull_request) Has been skipped
7c4ac025d7
A staging login failed with "email or password incorrect" despite the seed password and E2E_STAGING_PASSWORD matching character-for-character. Cause: a whitespace asymmetry. bunyip-e2e-bootstrap hashed the password UNtrimmed (checked only password.trim().is_empty(), then hashed the raw &password), while the suite logs in with the TRIMMED password (e2e/lib/env.ts required() returns value.trim()) and bunyip login trims the email but NOT the password. So a seed value with a trailing newline (common from a secret-store fetch / file / paste) stored a hash for "P\n" while the suite sent "P", failing login.

Trim the password once after reading it and use the trimmed value for both the empty check and the hash, aligning the seed side with the suite's trim. Passwords carry no meaningful surrounding whitespace.

Not compiled locally (musl/dunite workspace build); CI check.yml validates. The change is a string trim with no type impact (password is now &str). c-01 needs a rebuilt image + redeploy + RE-SEED for the existing account's hash to be recomputed from the trimmed value.

#BUNYIP-166

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
nrupard scheduled this pull request to auto merge when all checks succeed 2026-06-22 20:13:14 +02:00
nrupard deleted branch fix/BUNYIP-166-bootstrap-trim-password 2026-06-22 20:16:19 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/bunyip!186
No description provided.