Menu

#341 auth: make the challenge prompt pure ASCII (arrow + em-dash in _challenge_message)

closed
nobody
2026-08-11
2026-08-11
Anonymous
No

Originally created by: fu351
Originally owned by: atiqur-rahman-pro

What

_challenge_message in src/doberman/auth/provider.py builds the text a human reads to approve or deny a live action. Lines 81-82 contain two non-ASCII characters:

  • -> is currently the arrow U+2192 in the action line
  • the reason line joins its parts with an em-dash U+2014

Why it matters

CLI output in this repo is pure ASCII by contract (branding.py: "pure ASCII (enforced by tests)") because non-cp1252 characters crashed onboarding on legacy Windows consoles once before (PR [#54]). This string reaches all three prompters (CliPrompter, TtyPrompter, GuiPrompter), and it is the highest-stakes text in the app: the approval prompt itself. An earlier fix cleaned the same character class out of 2fa remove and locked it with a test - this is the same bug in a file no ASCII test covers.

The fix

  1. Replace the arrow with -> and the em-dash with - in _challenge_message (a two-character diff).
  2. Add a test asserting the challenge message is ASCII-encodable: build a small Decision/SecurityObject fixture, call _challenge_message, and assert .encode("ascii") does not raise. Follow the sibling pattern in tests/unit/test_cli_encode_safe.py (or extend tests/unit/test_auth_provider.py).
  3. Mutation-check the new test: put the em-dash back, confirm the test goes red, revert.

One function, an existing test pattern to copy, no behavior change beyond the two characters. Found by the 2026-08-11 UX re-audit.

Related

Tickets: #347
Tickets: #54

Discussion

  • Anonymous

    Anonymous - 2026-08-11

    Originally posted by: atiqur-rahman-pro

    Hi @fu351,

    I would like to take this on!

    I will replace the non-ASCII arrow ( -> ->) and em-dash ( -> -) in _challenge_message inside src/doberman/auth/provider.py and add the ASCII-encodable assertion test in tests/unit/test_auth_provider.py.

    Could you please assign this issue to me? thank you.

     
  • Anonymous

    Anonymous - 2026-08-11
     
  • Anonymous

    Anonymous - 2026-08-11

    Ticket changed by: fu351

    • status: open --> closed
     

Log in to post a comment.