Commit Graph

674 Commits

Author SHA1 Message Date
Shivaram Lingamneni 08d8145f26 draft/AUTHTOKEN support (#2385)
Includes two compatibility breaks:

* New, incompatible configuration format for extjwt
* JWTs accepted with IRCV3BEARER MUST have an expiration time
2026-06-30 12:13:56 -07:00
Shivaram Lingamneni 51b2476af7 fix #2402
Labeled QUIT from the client should receive a labeled QUIT in return
2026-05-19 03:08:39 +00:00
Shivaram Lingamneni 6ccd4e2313 ensure always-on state is flushed
* Fix a race condition in persisting channel memberships for always-on
  clients (the asynchronous write of the client's channel memberships
  could precede the update to the channel's member list, resulting in
  the membership not being observed and written)

* Ensure always-on state is flushed on shutdown (we were already
  flushing timestamps, because those writes are heavily debounced, but
  we were relying on immediate asynchronous writeback for channel
  memberships and similar state).
2026-05-08 04:25:09 +00:00
Shivaram Lingamneni de005ee69f enhanced auth integrations (#2383)
* Harvest cookies from the initial websocket handshake to pass to an
  auth-script (#2185)
* Allow running auth-script and ip-check-script over unix domain socket
  (#2280)
2026-04-15 01:48:29 -04:00
Shivaram Lingamneni 9556e5c025 add support for draft/chathistory-end tag (#2379) 2026-04-13 22:50:24 -04:00
Shivaram Lingamneni e7558f292c build changes (#2356)
* default build includes everything
* allow compiling out PRECIS and Skeleton (still included by default)
* consistently use `postgresql` in identifiers
2026-03-12 21:48:37 -04:00
Shivaram Lingamneni 768c01c17b add a sqlite history backend (#2352) 2026-03-12 21:32:13 -04:00
Shivaram Lingamneni 5fd8ed8ed6 add a postgres history backend (#2322)
Postgres support is behind a build tag; use `make build_full`
or `make install_full` to compile it in.
2026-03-05 01:18:28 -05:00
Shivaram Lingamneni 6386b9ef70 fix some redact bugs (#2320)
* Consistently return UNKNOWN_MSGID for unknown or invalid msgids
* If both client's DMs are stored in persistent history, a single
  server.DeleteMessage will delete the single canonical copy of the message.
  So the second call will fail, which is fine.
2025-12-31 02:15:11 -05:00
Shivaram Lingamneni 9f54ea07b7 prep for alternative history databases (#2316)
* abstract history DB interface

* make mysql error logging consistent

Consistently propagate database errors to the client, making the client
responsible for logging them.

* move ListCorrespondents from Sequence to Database/Buffer
2025-12-30 23:12:30 -05:00
Shivaram Lingamneni 53664694c4 add RPL_WHOISKEYVALUE output (#2302) 2025-12-14 04:32:02 -05:00
Shivaram Lingamneni fdd261a1e6 fix #2303 (#2304)
Fix inconsistent behavior when history.enabled is set but
history.chathistory-maxmessages is not
2025-12-14 02:13:15 -05:00
Shivaram Lingamneni f91d1d94f6 add METADATA response when MONITOR triggered 2025-12-01 07:03:26 +00:00
Shivaram Lingamneni ed841ee62a configurable idle timeouts
Fixes #2292
2025-11-09 21:11:04 -05:00
Shivaram Lingamneni 8798676ae9 update metadata corresponding to spec edits (#2282)
* spec update: metadata keys are lowercase

* add batch parameter to metadata batches

* fix: connecting clients receive METADATA, not RPL_KEYVALUE

* spec update: send RPL_METADATASUBS in a metadata-subs batch

* move some helpers

* bump irctest to forked hash

This is https://github.com/progval/irctest/pull/314 but I don't want to
couple the merges

* fix: empty value is valid

* fix: deleting a nonexistent key gets a FAIL
2025-06-22 18:59:42 -04:00
Shivaram Lingamneni 73e51333ad implement metadata before-connect (#2281)
* metadata spec update: disallow colon entirely

* refactor key validation

* implement metadata before-connect

* play the metadata in reg burst to all clients with the cap

* bump irctest

* remove all case normalization for keys

From spec discussion, we will most likely either require keys to be lowercase,
or else treat them as case-opaque, similar to message tag keys.
2025-06-22 13:57:46 -04:00
Shivaram Lingamneni 3b7db7fff7 round 1 of follow-up for metadata (#2277)
* refactoring
* send an empty batch if necessary, as per spec
* don't broadcast no-op updates
* don't trim spaces before validating the key
* bump irctest to cover metadata
* replay existing metadata to reattaching always-on clients
* use canonicalized name everywhere
* use utils.SafeErrorParam in FAIL lines
* validate key names for sub
* fix error for METADATA CLEAR
* max-keys is enforced for channels as well
* remove unlimited configurations
* maintain the limit exactly without off-by-one cases
* add final channel registration check
2025-06-18 00:22:49 -04:00
Shivaram Lingamneni 686ce4d5b2 fix #2252
Fix SAREGISTER creating always-on clients with no user modes.

Also fix UNREGISTER/ERASE not deleting the stored push subscriptions.
2025-05-07 22:09:08 -04:00
Shivaram Lingamneni 4ab1a10eec clean up redundant caching 2025-04-28 00:29:40 -04:00
Shivaram Lingamneni 54b17b0700 improve robustness of timestamp parsing (#2250)
* Clamp CHATHISTORY timestamp selectors to be in [0, MaxInt64]
* Convert everything to UTC up front (probably a no-op)
2025-04-24 23:37:48 -04:00
Shivaram Lingamneni 9c3173f573 safer 005 length limits (#2241)
* Limit the payload to 380 bytes instead of 400
* Don't translate the final parameter

This leaves about 60 bytes for the server name.
2025-04-06 02:59:03 -04:00
Shivaram Lingamneni a6df370bd9 block HTTP DoS attacks (#2239)
Block uses of the JS Fetch API to send HTTP message bodies that are also valid
IRC. The constraint on such messages is that they must begin with a valid HTTP
verb; we can detect this and reject them immediately.
2025-03-30 21:33:06 -04:00
Shivaram Lingamneni ea81ec86e1 MVP for HTTP API (#2231)
Co-authored-by: Klaas Tammling <klaas@tammling.hamburg>
2025-03-18 23:13:03 -04:00
Shivaram Lingamneni 7b71839615 fix buggy persistence of push timestamps
getPushSubscriptions() could have a stale view of the latest subscription
renewal and successful push times. We don't want to rebuild on every renewal
or every push, so add a boolean refresh argument that controls rebuilding.
2025-01-16 00:06:11 -05:00
Shivaram Lingamneni 21ee867ebb fix #2198 (#2199)
Add require-sasl support to KLINE / UBAN on NUH masks
2025-01-13 22:20:47 -05:00
Shivaram Lingamneni 36e5451aa5 implement draft/webpush (#2205) 2025-01-13 21:47:21 -05:00
Shivaram Lingamneni efd3764337 add unique connection ID to debug logs (#2207)
Fixes #2206
2025-01-11 23:07:04 -05:00
Shivaram Lingamneni eddd4cc723 fix incorrect batch parameter in draft/extended-isupport (#2197) 2024-10-26 22:11:20 -04:00
Shivaram Lingamneni 7586520032 implement draft/extended-isupport (#2184) 2024-09-27 00:40:56 -04:00
Shivaram Lingamneni 7726160ec7 add a config switch to accept hostnames from WEBIRC
See #1686; this allows i2pd to pass the i2p address to Ergo, which may be
useful for moderation under some circumstances.
2024-04-13 21:43:41 -04:00
Shivaram Lingamneni cab192e2af fix #2130
We load registered channels unconditionally; reloading them again on rehash
is incorrect. This caused buggy behavior when channel registration was
disabled in the config, but some registered channels were already loaded.
2024-02-25 03:34:21 -05:00
Shivaram Lingamneni 75bd63d0bc add channel autojoin feature
See discussion on #2077
2023-07-04 21:44:18 -04:00
Shivaram Lingamneni 0f39fde647 remove insecure reattach check
See #2013; given that plaintext is deprecated now, it seems like there is no
added value from continuing to police this.
2023-06-05 04:22:40 -04:00
Shivaram Lingamneni 7ce0636276 refactor of channel persistence to use UUIDs 2023-01-04 05:06:21 -05:00
Shivaram Lingamneni d17faf6bcb fix #1975
Provide a nondestructive stack trace dump option even when the http pprof
listener is disabled
2022-12-10 22:15:37 -08:00
Shivaram Lingamneni ae1de2554e add persistence broadcasting 2022-12-10 22:05:46 -08:00
Shivaram Lingamneni 893922afe0 don't report PERSISTENCE STATUS in reg burst for anonymous clients 2022-12-10 22:05:46 -08:00
Shivaram Lingamneni 99d27ff737 initial implementation of draft/persistence 2022-12-10 22:05:46 -08:00
Shivaram Lingamneni 35128bfc23 use new aligned atomic types everywhere
See 69448b13a1 / #1969; the compiler can now ensure that a uint64
intended for atomic access is always aligned to a 64-bit boundary.
Convert atomic operations on uint32s and pointers as well.
2022-08-10 02:47:39 -04:00
Shivaram Lingamneni a99c8a42f9 remove utils.ConfigStore in favor of atomic.Pointer[T] 2022-08-03 00:59:00 -04:00
Shivaram Lingamneni 737697d1d4 exempt operators from history cutoffs
See #1593; this enables a client-side implementation of bulk deletion
2022-05-12 16:43:11 -04:00
Shivaram Lingamneni c5579a6a34 fix #1688
* Add ACCEPT-tracking functionality (authorizing users to send DMs
  despite +R or other applicable restrictions)
* Sending a DM automatically accepts the recipient
* Add explicit ACCEPT command
2022-05-05 22:34:43 -04:00
Shivaram Lingamneni d5814c10ab Merge pull request #1949 from slingamn/generic_config.2
genericize atomic config changes
2022-05-04 01:30:52 -04:00
Shivaram Lingamneni 077081076c fix #1941
KLINE'd clients would produce a QUIT snotice without a corresponding
CONNECT snotice; explicitly suppress the QUIT snotice.
2022-05-03 13:13:29 -04:00
Shivaram Lingamneni c603d41d08 genericize atomic config changes 2022-05-03 11:12:11 -04:00
Shivaram Lingamneni 2b8eb93c00 clean up magic numbers 2022-04-24 11:57:21 -04:00
Shivaram Lingamneni 51cdebf167 fix #1935
RPL_WHOISCHANNELS didn't have proper line breaks
2022-04-24 02:47:31 -04:00
Val Lorentz 379632a9e6 Fix implementation of LIST <n 2022-04-16 22:55:58 +02:00
Shivaram Lingamneni 32f7868bfd implement draft/read-marker capability 2022-03-30 23:16:09 -04:00
Shivaram Lingamneni 0a59f41cf9 add ip-check-script.exempt-sasl 2022-01-02 01:51:31 -05:00