From f60328ccf6b2a0bb44ba12534b73c4e6e54164d8 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Wed, 14 Oct 2026 15:16:18 +0000 Subject: [PATCH] BR-002: name a pasted secret before the username length limit --- auth.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/auth.py b/auth.py index d51bc75..e21d1d8 100644 --- a/auth.py +++ b/auth.py @@ -119,17 +119,20 @@ def normalize_admin_username(value): can show; the HTTP handler maps it to a ``400`` and the maintenance command to a failed exit. A value that looks like a wallet secret is refused for the same reason, and the message never repeats the value (sections 2 and 15). + That check runs before the length limit, so a seed phrase pasted here is + answered with what it looks like rather than with "too long", which would + invite the user to shorten the phrase instead of removing it. """ if not isinstance(value, str): raise ValueError("admin username must be text") username = value.strip() if not username: raise ValueError("admin username must not be empty") - if len(username) > ADMIN_USERNAME_MAX_LENGTH: - raise ValueError("admin username is too long") label = find_secret(username) if label is not None: raise ValueError(rejection_message("admin username", label)) + if len(username) > ADMIN_USERNAME_MAX_LENGTH: + raise ValueError("admin username is too long") return username