Add server.allowed-characters (IRC formatting bytes and printable Unicode glyphs in identifiers) - #2457
Closed
kevinpostal wants to merge 2 commits into
Closed
Add server.allowed-characters (IRC formatting bytes and printable Unicode glyphs in identifiers)#2457kevinpostal wants to merge 2 commits into
kevinpostal wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Two moderate issues remain in operator validation ordering and 0x04 formatting-byte handling.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds configurable support for IRC formatting bytes and printable Unicode glyphs in identifiers.
Changes:
- Adds and documents
server.allowed-characters. - Updates identifier validation, casefolding, skeleton generation, and startup wiring.
- Adds tests and build validation for formatting and Unicode support.
| File | Summary |
|---|---|
traditional.yaml |
Documents the new settings. |
irc/strings.go |
Implements character filtering and casefolding. Moderate (3 votes): 0x04 is allowlisted but not stripped, so hex-colour identifiers remain rejected. |
irc/strings_test.go |
Tests formatting and printable glyph support. |
irc/server.go |
Applies the runtime configuration. |
irc/i18n/strings.go |
Supports permissive Unicode handling. |
irc/config.go |
Parses and validates configuration. Moderate (1 vote): operator validation occurs before the configured character policy is applied. |
irc/client_lookup_set.go |
Adjusts nickname safety checks. |
default.yaml |
Documents the new settings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if b < 32 || b == 127 { | ||
| if allowIRCFormatting { | ||
| switch b { | ||
| case 0x02, 0x03, 0x04, 0x0F, 0x11, 0x16, 0x1D, 0x1E, 0x1F: |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Configurable control over which characters are legal in identifiers (nicknames, account names, channel names), extracted from waveplate/ergo branch
ts6-linking(commits ac7e06d, 8c3ad28, author @waveplate, cherry-picked verbatim).Two new flags under
server.allowed-characters(both default false; documented indefault.yamlandtraditional.yaml):What the change does (verified against the diff):
irc/strings.go: newAllowedCharactersConfig{IRCFormatting, PrintableGlyphs}type and a package-global set at startup from config (irc/server.go);containsDisallowedControlCharspermits exactly these control bytes whenirc-formattingis on (verified in the diff):case 0x02, 0x03, 0x04, 0x0F, 0x11, 0x16, 0x1D, 0x1E, 0x1F:i.e. bold, colour, hex-colour, reset, monospace, reverse, italic, strikethrough, underline. All other C0 controls and DEL remain forbidden.
ircfmt.Stripin bothCasefoldandSkeleton), so\\x02fooandfoocasefold identically and collide instead of coexisting as confusingly similar nicks.printable-glyphsis on and the configured casemapping's PRECIS casefold rejects a glyph,Casefoldfalls back to the permissive mapping (i18n.CasemappingPermissive) rather than rejecting the identifier.irc/config.go: rejects builds where i18n was compiled out but the config asks for a non-ASCII casemapping orprintable-glyphs. (The second commit, 8c3ad28, is a gofmt fix to that hunk plus removal of a test case covering a Unicode 16.0 character unsupported by the bundled PRECIS tables.)TestAllowedCharactersIRCFormattingandTestAllowedCharactersPrintableGlyphsinirc/strings_test.go— both pass with full build tags (make testuses-tags "i18n mysql postgresql sqlite"; without the i18n tag the glyphs test skips, as designed).Motivation: the server-linking work needs charset parity with linked peers whose users may carry formatting bytes or non-ASCII glyphs in their nicks; without this the link would force-rename or reject those users.
Testing:
make test(gencapdefs check, gofmt check, vet, unit tests, full and empty tag sets) passes locally on this branch, exit 0, no failures.make irctestwas NOT run (needs the irctest harness).Author credit: @waveplate.