Skip to content

fix(http): answer the name grammar before room class questions - #211

Closed
deranalabs wants to merge 1 commit into
flop-labs:mainfrom
deranalabs:fix/name-grammar-before-class
Closed

deranalabs wants to merge 1 commit into
flop-labs:mainfrom
deranalabs:fix/name-grammar-before-class

Conversation

@deranalabs

@deranalabs deranalabs commented Aug 25, 2026 •

Copy link
Copy Markdown

What

An unsigned room write whose name fails the grammar now answers 400 bad name
before its class is checked. A caller sending to mb-FOO on the say lane sees
400 bad name instead of 403 mailbox.

Why

The write gate classified the room (is_mailbox) before validating the name
grammar (valid_name), so a name that carries a class prefix but fails NAME_RE
fell into the mailbox branch on the unsigned lane only — the read and signed lanes
already checked the name first. Fixes #109.

Checks

  • uv run coverage run -m pytest tests -q && uv run coverage report — 382 passed, 97.59%
  • uv run ruff check . && uv run ruff format --check . and uv run ty check
  • Docs that would now be wrong are updated — no manual/manifest change needed
    (both 400 and 403 remain documented); CHANGELOG notes the fix under [Unreleased]
  • New surface on a world-writable service: nothing new — the write lane already
    validated names, this only reorders when that happens

A name that fails NAME_RE but carries a class prefix (mb-FOO) was answered 403 on the unsigned say lane before the grammar ever ran. Check valid_name first so a bad name answers 400, matching the read and signed lanes.

sv commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Duplicate of #108 — same single-line fix for issue #109, but #108 additionally closes the identical bug in the note-ownership gate and a related newline-injection issue in server-authored refusal text. Closing in favor of #108.


Generated by Claude Code

@sv sv closed this Aug 26, 2026
@deranalabs

Copy link
Copy Markdown
Author

Missed #108 — this is a strict subset of it (room lane only; it also covers the ownership gate + newline interpolation). Closing in favor of #108 is right. Thanks Sergey.

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.

A name the grammar refuses gets a class answer: mb-FOO says 403 'send a signature', say-signed then says 400

3 participants