Skip to content

[BUG] Trezu - Settings: Whitespace-only display name Is accepted #1218

Description

@rknearn-qa

Summary

The Display Name field accepts a value containing only whitespace characters.

The current validation checks only that the value contains at least one character, but does not trim whitespace before validation. As a result, a display name consisting entirely of spaces can be submitted, approved, and stored as an effectively blank name.

Preconditions

Steps To Reproduce

  1. Open Settings → General.
  2. Set Display Name to whitespace only
  3. Save/create the resulting Change Policy request.
  4. Approve the request until it is Executed.
  5. Check the Treasury header, Settings, and request details/diff.

Actual Result

  • Whitespace-only Display Name is accepted.
  • The request can be created and approved successfully.
  • After execution, the Treasury name appears blank or consists only of whitespace.
  • No validation error is displayed.
Image

Expected Result

  • Whitespace-only values should be rejected.
  • Display Name should be trimmed before validation.
  • A validation error should be displayed when the value contains no non-whitespace characters.
  • The request should not be created until a valid display name is provided.

Special Notes

Possible Root Cause:

The Display Name Zod schema uses `.min(1)` without trimming the value first.

`.min(1)` considers a whitespace character to be a valid character,
so a value such as "   " passes validation.

The validation should normalize the input before checking its length:

    trim → validate minimum length

This should also be applied consistently to other user-facing text
fields where whitespace-only values are not meaningful.

Workarounds

  • Enter at least one non-whitespace character in the Display Name.

Repro Rate

Always (10/10)

Setup - OS - Browser - Environment

  • OS / Devices: Windows 11 (x64), Motorola G23 (Android 14), Iphone XR (iOs 18.7.6)
  • Screen resolution(s): 1366 x 768, 1600 x 720, 1792×828
  • Browser(s) + version(s): Chrome (150.0.7871.129), Mozilla Firefox (151.0.3), Brave (1.91.168), Safari (18.7.4), Edge (149.0.4022.52)
  • Wallet: Meteor
  • App environment: Staging (trezu.app)
  • Near Network: Mainnet

Resources & Additional Notes

Impact

User Impact

  • Users can unintentionally configure a Treasury with an effectively blank display name.
  • The Treasury may appear unnamed in the header and Settings.
  • Request diffs can contain meaningless whitespace values.

System Impact

  • Invalid presentation data can be persisted on-chain.
  • Validation does not correctly distinguish meaningful input from whitespace-only input.

Business / Release Risk

  • Low functional risk, but creates invalid/poor-quality Treasury configuration data.
  • Can lead to confusing Treasury identification across the UI.

QA Verdict

Verdict: ❌ Needs Fix

Rationale

A display name containing only whitespace is semantically empty and should not be accepted as a valid Treasury name. Input should be trimmed before applying the required-field validation.

Recommendation

  • Apply trimming before validating Display Name.

  • Reject values where trimmedValue.length === 0.

  • Consider trimming leading/trailing whitespace before persisting valid names.

  • Add regression coverage for:

    • Empty string.
    • Whitespace-only value.
    • Leading/trailing whitespace.
    • Valid name with internal spaces.
    • Normal display name.

Priority

🟡 P2 : Medium

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions