Repository navigation
v0.1.0
Security
- The HPACK integer decoder refuses a sixth continuation byte before shifting, so a 32-bit
(wasm) build no longer shifts past its word size on a hostile header block. - The HTTP/2 frame reader drops taken bytes once per read instead of once per frame, so a
server that sends many tiny frames costs linear time, not quadratic. - Tunnel Worker: a lease renewal that reaches the per-IP counter after the tunnel's release no
longer takes the slot back for up to 30 minutes. - A snapshot whose item or id counter is at its maximum is refused as damaged when the counter
would move, instead of panicking (debug) or wrapping to a negative id (release). - Breaking: the store key is required:
ClientBuilder::startfails without.key(…)
(it used to default to an empty key that anyone could open), and JSClient.startrefuses
an emptykey. A new store derives its key with Argon2id (19 MiB, 2 passes, 1 lane) over
the passphrase and a random per-store salt kept in itskdfmeta row, instead of one
unsalted HKDF. Stores made before still open with their old key and are not upgraded. - Snapshots are authenticated as a whole: format 2 ends with an HMAC over every byte, so a
changed, deleted or rolled-back row or a rewound counter is refused on open. The id counters
are checked against a sealed copy in both backends, which a store from before gets on its
first open, and SQLite overwrites deleted rows (secure_delete). In SQLite, putting back an
older sealed row is still not detected. - Breaking (tunnel Worker): it is no longer an open TCP proxy by default. Without
ALLOWED_HOSTSit reaches only the preset SimpleX SMP and XFTP relays;ALLOWED_HOSTSadds
hosts andALLOWED_HOSTS=*allows any public host. Every record the client sends before the
relay's first encrypted record is checked (a second ClientHello after a HelloRetryRequest
too), the relay must answer in TLS records, and the per-IP limits fail closed when the
counter or the rate limiter errors. - A blocking TLS read that fails for any reason but a timeout now fails every later read and
write too, as the sans-I/O client already did; a retry could otherwise skip a forged record. - TLS refuses handshake messages that span a key change (RFC 8446 section 5.1): the encrypted
server flight sent unencrypted in the ServerHello record, anything after the server Finished
in its record, and anything after a KeyUpdate in its record. - Stricter TLS 1.3 checks: the ServerHello must carry
supported_versions= TLS 1.3, an
extension type may appear once, EncryptedExtensions may only answer what the ClientHello
offered, a CertificateRequest must carrysignature_algorithms, records over the plaintext
limit are refused withrecord_overflow, and a record sequence number never wraps. - The blocking SMP connect (TCP, TLS and the SMP handshake) ends with
SmpError::Timeoutat
ConnConfig::connect_timeout, then the next host is tried; the timeout used to bound each
socket read, so a server dripping a byte now and then held a connect forever. Blocking XFTP
connects bound TCP and TLS by the connect timeout and the handshake by one per request. - Server certificates must be valid now:
verify_server_chainchecks every certificate's
notBefore and notAfter (no skew allowance, as upstream), in SMP connects, PKEY and XFTP. The
time comes from the newConnConfig::wall_clockandxftp::ClientConfig::wall_clock
(defaultsmp::system_wall_clock);verify_server_chainandHandshakeConfigtake it too. - SMP and XFTP connects check the server's pinned identity inside the TLS handshake, before the
client Finished, as upstream does; newTlsStream::connect_pinned,TlsClient::start_pinned,
tls::PinandTlsError::Identity. - The tunnel pool redials at once after a
1000 lifetimeclose only when the session was up
and the tunnel lived an hour; earlier ones wait out the back-off, so a hostile tunnel cannot
force a reconnect loop. - A forwarded command's answer (PRES) under the command's own nonce is refused as the proxy's
error before it is opened; it could only be the proxy reflecting the client's own PFWD body. - A relay can no longer replace a connection's per-queue key through a message header to force
a ratchet re-sync: once set, the stored key is always used, as simplexmq does. - A message that fails to decrypt no longer advances or saves the ratchet, so a tampered copy
can't destroy the key the genuine message needs. - Ed25519 signatures are checked with
verify_strict. - Ratchet and agent secrets are wiped from memory after encoding and loading.
- Envelopes above the supported client versions are refused, and invitation short links get
the same server check as addresses.
Added
-
simplex_client::limits: every limit and rule of the official SimpleX Chat 7.1.4 client in
one module, each with its upstream source (reactions, file sizes, message size, mentions,
names, bio, pictures, edit and delete windows, group roles), andlimits::checkfor a
request. -
The engine refuses what breaks them before sending, with new codes:
ReactionNotAllowed,
FileTooLarge,TextTooLong,TooManyMentions,InvalidName,NotAllowedand
PictureTooLarge(SX-CHT-018to024); JS rejects withreaction_not_allowed,
file_too_large,text_too_long,too_many_mentions,invalid_name,not_allowedand
picture_too_large.Client::requestfails at once for the rules that need no lookup. -
Display and group names are checked as upstream's
mkValidNamedoes, at most 50
characters; a changed bio is at most 160 bytes; a new store's name is checked at start. -
A friend's fourth reaction on a message, or one on a message without content, is ignored.
-
File transfers in the wasm build (browser, Node.js and Bun):
friend.sendFile,
group.sendFile,message.download()and thefileProgressevent, over a sans-I/O XFTP
session on a sans-I/O HTTP/2 client. -
Private message routing (SMP proxying,
PRXY/PFWD) with the chat's defaults; set it with
ClientBuilder::private_routing/allow_direct, orprivateRouting/allowDirectin JS. -
Initial extraction from the author's app, ported from simplex-chat v7.1.4 and simplexmq
commitfdbcb24d. -
Protocol stack: SMP queues, the agent's double ratchet with the post-quantum KEM, chat
messages, contacts, groups, XFTP files and calls. -
Low-level public modules:
smp,agent,ratchet,chat,crypto,xftp,tls,h2,
encoding,store,engine,types. -
High-level
Clientwith a builder, an event stream and request methods (nativefeature,
on by default). -
wasmfeature: the pure protocol core and small wasm-bindgen bindings for
wasm32-unknown-unknown. -
The full client on
wasm32-unknown-unknown: a JSClient(Client.start, named events,
Promise-returning calls) on a single-threaded runtime, reaching relays through a WebSocket
byte tunnel with TLS inside wasm;examples/browseris a minimal chat page. -
The same build on Node.js 22+ and Bun, over direct TCP with no tunnel; a
simplex-clientnpm
package (built byscripts/build-js.sh, not published) andexamples/node/bot.mjs. -
store: an in-memory backend beside SQLite, andexport_snapshot/open_snapshotfor a
sealed, versioned snapshot of either. -
CI for formatting, clippy, tests, wasm, MSRV 1.95, cargo-deny and docs.
-
Files in the wasm build, in browsers, Node.js and Bun:
friend.sendFile(bytes, name),
group.sendFile(bytes, name),message.download()resolving with{name, bytes}, and a
fileProgressevent. Transfers run in memory, up tosetFileLimitbytes (64 MiB unless
set), over the tunnel or TCP. -
h2::H2Clientandxftp::XftpSession: sans-I/O HTTP/2 and XFTP, driven by bytes in and out. -
Event::Offline(true)at a start without a network, from the first relay check, and
Offline(false)once a relay answers again. -
Private message routing: messages, confirmations, SKEY, LKEY and LGET for someone else's
relay go through one of our own relays (PRXY/PFWD), so that relay never sees our IP
address.Config::proxy_modeandConfig::proxy_fallbackchoose when; they default to the
chat'sunknown(proxy unless the relay is one of ours) andprotected(never fall back to
a direct connection, as this client has no SOCKS or onion transport).AgentConfighas the
same settings, defaulting to the agent'snever. -
The preset relays in use are checked like own relays when the config names none.
-
Chat notices for a peer's address switch and for ratchet re-syncs
(ChatNotice::AddressSwitch,ChatNotice::RatchetSync). -
The JS package runs on Bun too; CI runs the JS tests on Node.js and Bun.
-
Objects to act on:
Message(reply,react,edit,delete,author,chat),
FriendRequest(accept,reject),Friend(send,remove,history,show_code),
Group(send,add_member,leave,members),GroupInviteandMember, in Rust and
in JS. The client keeps the chat list:friend(id),friends(),groups(), and
create_groupreturns the newGroup(JS:client.friends,client.groups,
createGroup).
Changed
Ratchet::decryptno longer advances on failure;MsgEncryptKey::encrypt_msgtakesself.- JS rejections carry a snake-case
codeeverywhere (no_connectioninstead of
SX-CHT-004); a file over the memory limit rejects withfile_too_large, nottoo_large. - JS calls that queue a request (
send,react,edit,delete, …) now reject when the
request breaks a limit, instead of resolving. setFileLimitnever goes above 1 GiB, the official client's file limit.- A message whose JSON is over 15 602 bytes is refused even when it would compress to fit,
as upstream refuses it. types::REACTION_EMOJIislimits::REACTIONS, a slice;chat::reaction::REACTION_EMOJIis
gone.- Breaking:
simplex_client::Eventis now the high-level event:Ready,Message,
MessageUpdate,Request,FriendAdd,FriendRemove,GroupAdd,GroupRemove,
GroupInvite,MemberAdd,OfflineandRawfor the rest. The engine's events stay at
simplex_client::types::Event.simplex_client::FriendandFriendRequestare now the
objects; the chat list's records aretypes::model::FriendandFriendRequest. A
wasm-only build has no rootEvent; usetypes::Event. - Breaking (JS): events carry objects and are named
ready,message,messageUpdate,
request,friendAdd,friendRemove,groupAdd,groupRemove,groupInvite,
memberAdd,offline,online,changeandraw(wasevent);chatsis gone. The
client's id-taking methods (send,reply,accept,members, …) moved onto the
objects, every method returns a Promise,profile()is theusergetter, andonceis new.
Fixed
- A repeated
x.grp.invwith the same link updates the group only while the user has not
joined yet, and only from the friend who invited. 7.1.4 rewrites the user's member id, role
and the group profile even after joining. - At most 50 joins through a group's link wait for their connection; past that the oldest is
dropped with its connection. 7.1.4 accepts group link requests without limit, each with a
member, a connection and server queues. x.grp.link.acptacts only on a member waiting for approval or review. 7.1.4 takes any
member, so a moderator could demote an owner or bring a removed member back; such a message
is now ignored.- A moderator's "block for all" (
x.grp.mem.restrict) is applied, asxGrpMemRestrictdoes:
the member is kept asblocked_by_admin, shown asblockedin the member list, their
messages are collapsed and never unread, their mentions are dropped, their pictures are not
fetched by themselves and their items stay out of the history a host sends. A
ChatNotice::MemberBlockeditem tells it, and an unblock undoes it. The user's own unblock
does not.x.grp.mem.introcarries the block both ways (memberRestrictions), so a member
who joins later learns of it. - A friend's deletion of its own message is taken only if the relay took it within 78 hours
of the message (limits::RCV_DELETE_WINDOW_MS, Subscriber.hsrcvItemDeletable); a later
one is ignored.AgentEvent::Msgcarries the relay's time (broker_ts) for it. - A message that skips, repeats or breaks the chain before it (
MsgIntegrity) now shows a
ChatNotice::Integrityitem before it, as simplex-chat'sCIRcvIntegrityErrordoes: "skipped
message ID", "unexpected message ID", "incorrect message hash", "duplicate message ID". A
receipt whose hash differs shows the message asDelivery::DeliveredBadHash; in a group, one
such receipt wins over the good ones. A message that does not decrypt shows a
ChatNotice::DecryptionError(header, too many skipped, earlier message, other), and the
same error again counts on that notice, asCIRcvDecryptionErrordoes. A blocked friend's
chat gets neither. Engine records are format 2 now; format 1 still reads. - A forward's time with a year past 9999, or a date out of range, no longer overflows (a
panic in debug builds, a wrapped time in release): the JSONx.grp.msg.forwardis refused,
as Aeson refuses it, and a binary forward takes the time it arrived. - A received file description that is a redirect is refused, on native and in memory, as
simplex-chat 7.1.4 does ("redirect not allowed"): its inner description could send the
download to servers the user never approved. The file shows as failed. This client never
sends redirects in chat, as 7.1.4 does not. DownloadParams::max_size(breaking): a native download fetches no more encrypted bytes than
the offer allows (min(size, 5 GiB) + 10 MiB), so a file offered as small cannot fill the
disk.MemDownload::progressnow returns the pair itself.- A file description nested more than eight levels deep, or longer than its replica limit
allows, is refused before parsing recurses. A line of dashes in a description used to
overflow the stack and abort the process, with no click needed for pictures. - Connections agreed at agent version 7 move to version 8 once both sides speak it: every
message offers the highest agent version (AgentConfig::agent_versions), and a higher one
from the peer raises the stored version, as simplexmq'supdateConnVersiondoes. A queue
switch started the v7 way still ends the v7 way. - A group member's chat version range follows each JSON message they send, not only the
handshake (updateMemberChatVRange).