Skip to content

fix(id): invite names refuse control and format characters (#1770) - #3759

Merged
dezren39 merged 1 commit into
mainfrom
queue/4799-1770-invite-cf-cc
Nov 1, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/4799-1770-invite-cf-cc

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Fixes #1770 (queue task 4799; policy pinned by triage task 1998).

What changed

  • pkgs/id/src/invite.rs — Invite::new now refuses a name carrying a control character (Unicode Cc, via char::is_control) or a format character (Unicode Cf) anywhere in the raw name, checked before trimming: an edge tab/newline/CR is refused rather than trimmed away, and embedded controls or invisible format characters can no longer ride an invite onto the /invite trust prompt or into the prefilled petname. Ordinary spaces keep the long-standing trim behaviour. parse/from_query inherit the refusal through Invite::new, including percent-encoded controls (%09, %0A, %0D, …).
  • pkgs/id/src/petname.rs — the existing full-Cf predicate is_format_char (Unicode 16 ranges, from the id(petname): format characters (Cf) bypass both petname guards — U+200B makes a spoof of another contact's name, U+202E passes the 'no control characters' rule #1674 petname work) is now pub(crate) so the invite boundary refuses exactly the same set instead of duplicating the ranges.

Tests

New tests in invite.rs: direct Cc embedded and at both edges (tab, newline, CR, BEL, VT); representative Cf (soft hyphen U+00AD, zero-width space U+200B, bidi override U+202E, U+FEFF, a tag character); percent-encoded tab/newline/CR and Cf (U+200B, U+00AD) through both from_query and parse; and a positive test that ordinary spaces still trim (direct and +-as-space). Existing round-trip, plus-as-space, invalid-key and length behaviour is untouched.

Verification note

Local cargo test could not run in the laptop environment: the lib-test target fails to compile identically on clean main under default features (clap derive attributes in src/cli.rs — verified by stashing this change and re-running), and --all-features additionally requires the nix-built web/dist for RustEmbed. Per the fleet's CI-first rule, verification for this PR is the nix check suite (test-unit / test shards) on this PR; the change itself is two small, self-contained edits plus tests.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Invite::new now rejects category Cc (char::is_control) and category Cf characters on the raw name, before trimming, so an edge tab/newline/CR is refused rather than trimmed away and an embedded control or invisible format character cannot ride the invite onto the /invite trust prompt or into the prefilled petname. The Cf set is petname's existing is_format_char predicate (Unicode 16), now pub(crate) and shared instead of duplicated; ordinary spaces keep the long-standing trim. parse/from_query inherit the refusal through Invite::new, including percent-encoded controls. Tests: direct Cc embedded/edge cases, representative Cf (soft hyphen, ZWSP, bidi override, BOM, tag char), percent-encoded tab/newline/CR/Cf through both from_query and parse, and space-trimming preserved. Local cargo test could not run in the laptop environment (lib-test target fails identically on clean main under default features; all-features additionally needs the nix-built web/dist) — verification is via the PR's nix checks per the fleet CI-first rule.
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 15:50
@coderabbitai

coderabbitai Bot commented Nov 1, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6aafdf31-529f-451c-b81f-d4482c37c105
Commits

Reviewing files that changed from the base of the PR and between e764f4e and 0f31e2b.

Files selected for processing: 2
  • pkgs/id/src/invite.rs
  • pkgs/id/src/petname.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T15:51:50.842989Z 0f31e2b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant