Skip to content

Zip 23c7583 import - #8

Merged
Badxd merged 26 commits into
mainfrom
zip-23c7583-import
Nov 3, 2026
Merged

Badxd merged 26 commits into
mainfrom
zip-23c7583-import

Conversation

@Badxd

@Badxd Badxd commented Nov 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

claude and others added 26 commits October 31, 2026 19:29
Channel message updates (new, edit, delete) are now gated by their own
channel pts. The first update seen for a channel sets its baseline and is
trusted. Gaps trigger updates.getChannelDifference for that channel, using
the access hash from the peer cache. Baselines are in-memory only.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Uploads read each part from disk instead of loading the whole file; the
MD5 for inputFile is computed in a streaming pass (skipped for big files).
A file that shrinks during upload fails. Downloads resume from an aligned
offset in <path>.part (resume_offset, tested). A partial file is kept on
failure and discarded on a size mismatch.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
on_connection_state (Connected, Disconnected, Reconnecting), on_auth_state
and on_rpc_error. Every RPC goes through call_rpc, which reports Telegram
errors before rethrowing. Handler exceptions are isolated and reported via
on_error.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
New CGE1 format: scrypt key derivation (N=2^15, r=8, p=1), random salt and
nonce per encryption, header authenticated as AAD, bounded KDF parameters
on decrypt. Passphrase is read from CPPGRAM_SESSION_PASSPHRASE. Not yet
wired into the session file storage; that is a separate step.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
IPv4, IPv6 and domain targets, per-operation timeouts, RFC 1928 reply
mapping, and a bounded retry that only repeats transient failures. Returns
a plain connected fd so an MTProto obfuscated proxy can be added later
without changing framing. Not yet wired into Connection; that is a
separate step. Tests use a scripted loopback proxy.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
When the passphrase env var is set, saved session files are wrapped in the
CGE1 envelope (scrypt + AES-256-GCM). Encrypted files without a passphrase
are refused with SessionCorruptError. Plain files still load and are
encrypted on the next save (migration). SQLite session storage and
session strings are not encrypted by this change.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
ClientOptions::socks5 routes the DC connection through a SOCKS5 proxy.
Connection::connect_via_socks5 throws ProxyError; rejected credentials and
refused targets are not retried, transient failures use the existing
bounded retry. CDN downloads still connect directly. Tested against a
scripted loopback proxy. Live proxy testing is not done.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
With CPPGRAM_SESSION_PASSPHRASE set, the key column holds a CGE1 envelope.
Plain rows still load and are encrypted on next save. Encrypted rows without
the passphrase, or with the wrong one, throw SessionCorruptError. Tests check
that the raw key bytes are absent from the database file.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
With CPPGRAM_SESSION_PASSPHRASE set, encode_session_string returns a
"cge1:" CGE1 envelope. Decoding an encrypted string without the passphrase
or with the wrong one throws instead of reporting "no session". Plain
strings are unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
ThreadSanitizer run of CancelStress found one waiter returning normally
after a stop request. condition_variable_any waited on an internal mutex,
so the stop callback could fire between the waiter's check and its wait.
Now a std::condition_variable with a stop callback that takes the waiter's
mutex, plus a deadline loop. TSan: 188/188 pass, 0 warnings.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Parses plain (32 hex), dd (34 chars) and ee (fake-TLS domain) secrets with
strict hex and length checks. Errors never echo the secret. The obfuscated
handshake itself is not implemented: the official transport spec could not
be fetched in this environment, so its byte layout and key derivation are
not claimed as verified.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
HttpServer.h included <utility> after the Boost.Asio and Beast headers.
Boost 1.74 awaitable.hpp uses std::exchange without including <utility>
itself, so on GCC 12 + Boost 1.74 + C++20 it failed with
"'exchange' is not a member of 'std'". Standard includes now precede all
Boost includes in HttpServer.h, and both webhook .cpp files include
<utility> first.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
…ffline network tests

- Add obfuscated2 codec (obfuscated.h/.cpp): 64-byte handshake with reserved-prefix
  rejection, tag and DC id encryption, SHA256(key || secret) key mixing, AES-256-CTR per
  direction, intermediate and padded-intermediate framing, and a server-side decode used by tests.
- Connection: connect_obfuscated() for MTProto proxies; non-blocking TCP connect bounded by a
  timeout (direct and proxy paths); SO_SNDTIMEO applied with the receive timeout.
- ClientOptions::mtproto_proxy (host, port, hex secret, timeout). Fake-TLS (ee) secrets are
  rejected. socks5 and mtproto_proxy together are rejected. Direct and SOCKS5 paths unchanged.
- Tests: obfuscated_test (layout, key mixing, tamper, framing, CTR), connection_net_test
  (refused connect, reconnect after drop, receive timeout, accept-queue connect timeout,
  scripted obfuscated proxy plain and padded, proxy drop), and a flood-wait cancellation test.
  The obfuscated expectations come from the layout rules, not from captured proxy traffic.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Builds fuzz_tl_reader, fuzz_session_string and fuzz_html_parser with clang-18 and runs each for a
fixed budget (default 600 s), logging to build-fuzz/logs and a summary with wall time.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdXUzdYQNMHLdQC61Ljxmr
@Badxd
Badxd merged commit 65daf2c into main Nov 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants