feat: add username/hostname support with IRC hostmask format #82

Merged
sneak merged 8 commits from feature/username-hostname-support into main 2026-03-20 06:53:36 +01:00

8 Commits

Author SHA1 Message Date
user
6244cf039d makefile: rerun tests with -v only on failure
All checks were successful
check / check (push) Successful in 1m31s
2026-03-17 20:31:51 -07:00
clawbot
3e6dc108db fix: speed up tests and reduce output verbosity
All checks were successful
check / check (push) Successful in 58s
- Use bcrypt.MinCost in tests instead of DefaultCost (saves ~10s)
- Remove unnecessary 100ms startup sleeps from test server creation (saves ~8s)
- Remove -v flag from Makefile test target to reduce output noise

Handler tests: 24.4s → 13.8s, DB tests: 2.6s → 1.5s
Total make test: 38s → 28s (well under 30s timeout)
2026-03-17 20:23:52 -07:00
user
67460ea6b2 fix: use timing-safe comparison for OPER credentials
Some checks failed
check / check (push) Failing after 1m49s
Replace plain != string comparison with crypto/subtle.ConstantTimeCompare
for both operator name and password checks in handleOper to prevent
timing-based side-channel attacks.

Closes review feedback on PR #82.
2026-03-17 19:42:44 -07:00
user
b7999b201f fix: correct misplaced doc comments for handleOper and handleAway 2026-03-17 19:42:44 -07:00
clawbot
d85956ca1a feat: add OPER command and oper-only WHOIS client info
- Add OPER command with NEOIRC_OPER_NAME/NEOIRC_OPER_PASSWORD config
- Add is_oper column to sessions table
- Add RPL_WHOISACTUALLY (338): show client IP/hostname to opers
- Add RPL_WHOISOPERATOR (313): show oper status in WHOIS
- Add GetOperCount for accurate LUSERS oper count
- Fix README schema: add ip/is_oper to sessions, ip/hostname to clients
- Add OPER command documentation and numeric references to README
- Refactor executeWhois to stay under funlen limit
- Add comprehensive tests for OPER auth, oper WHOIS, non-oper WHOIS

Closes #81
2026-03-17 19:42:44 -07:00
user
58f958c8d3 fix: include hostmask in NAMES replies (RPL_NAMREPLY) 2026-03-17 19:42:26 -07:00
user
0fef7929ad add IP to sessions, IP+hostname to clients
- Add ip column to sessions table (real client IP of session creator)
- Add ip and hostname columns to clients table (per-connection tracking)
- Update CreateSession, RegisterUser, LoginUser to store new fields
- Add GetClientHostInfo query method
- Update SessionHostInfo to include IP
- Extract executeCreateSession to fix funlen lint
- Add tests for session IP, client IP/hostname, login client tracking
- Update README with new field documentation
2026-03-17 19:41:25 -07:00
user
c4652728b8 feat: add username/hostname support with IRC hostmask format
- Add username and hostname columns to sessions table (001_initial.sql)
- Accept optional username field in session creation and registration
  endpoints; defaults to nick if not provided
- Resolve hostname via reverse DNS of connecting client IP at session
  creation time (supports X-Forwarded-For and X-Real-IP headers)
- Display real username and hostname in WHOIS (311 RPL_WHOISUSER) and
  WHO (352 RPL_WHOREPLY) responses instead of nick/servername
- Add FormatHostmask helper for nick!user@host format
- Add SessionHostInfo type and GetSessionHostInfo query
- Include username/hostname in MemberInfo and ChannelMembers results
- Extract validateHashcash and resolveUsername helpers to stay under
  funlen limits
- Add comprehensive unit tests for all new DB functions, hostmask
  formatting, and integration tests for WHOIS/WHO responses
- Update README with hostmask documentation, new API fields, and
  updated schema reference
2026-03-17 19:41:25 -07:00