Files
client/docs/evidence/core-runtime.md
T

134 lines
10 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# teamspeach-core — runtime evidence
Date: 2026-10-24. Host: Windows 10.0.26100 x64. Sanitized: no private keys, tokens, SDP or
foreign user identifiers; the two probe identities are TeamsPeach test identities.
## Build
- Rust via user-scoped rustup (`rustc 1.99.1`, `x86_64-pc-windows-msvc`), VS 18 MSVC 14.51,
VS 18 CMake 4.3.1. WSL2 is unusable on this host (`HCS_E_HYPERV_NOT_INSTALLED`).
- tsclientlib vendored at `ee3bc6f45a7137db7793ba5593a321df400d53e5`; `core/vendor/tsclientlib.patch`
checked: `git apply -p1` on upstream's crate reproduces the vendored tree exactly.
- Debug and release builds succeed with `-j 2`. At full parallelism the host ran out of commit
memory (`link.exe 0xc000012d`, LNK1201/LNK1105, rustc ICE) — environment, not code.
- Linux/macOS/arm64: not verified by the core worker (CI run #1 on Linux x64 failed one unit test
because it built a mid-edit tree; see "CI" below).
## Tests (`cargo test`, Windows) — 33 unit + 3 offline stdio smoke, all pass
- Identity: create → rename ×3 → "restart" (fresh store): UID, key and key offset unchanged,
`identity.json` bytes unchanged by rename; corrupt/tampered identity → `identity_corrupt`,
file bytes untouched, `profile_create` refuses; UID/key mismatch detected; two generated
identities differ; nickname rules; corrupt profile; key-offset upgrade keeps UID and rejects a
foreign key; TeamSpeak ini export/import roundtrip; owner-only permissions (Windows protected
DACL `D:P(A;;FA;;;<current user SID>)`, Unix `0600`).
- Protocol: TeamSpeak escaping exact bytes (`\s \p \/ \\ \n \t \r \v \f`), `streamsignaling`
JSON roundtrip, multi-entry split, empty value as flag, stream allowlist; request parsing
(unknown args/commands, ids), base64 PCM frame size checks, stdin 256 KiB line cap.
- Audio: Opus Voice and Opus Music encode → server-style S2C packet → jitter buffer/decode → mix
energy and end-of-voice; TX queue drops oldest; 1000 repeated `audio_end` coalesce to one;
alternating bursts under overflow stay ≤ 21 entries, keep the newest 10 frames, every burst
still terminated; codec-error report re-armed after reset.
- Raw extras: banner/`client_is_streaming` parsing; recycled client id and recycled/deleted
channel id do not inherit values; explicit clearing; myTeamSpeak avatar parsing (https only).
- Media: image sniffing, fixed path schemes, `ts3image://` validation (port, `..`, `/`, control
characters).
- Stdio smoke of the real binary: profile lifecycle + restart UID stable; second instance on the
same data dir exits 3; errors surfaced (`unknown_command`, `not_connected`, `audio_format`);
export while running + import into a fresh dir (same UID, overwrite refused); corrupt identity
reported and left untouched; stdin EOF → exit 0; the stored private key and the exported
(obfuscated) key never appear on stdout.
## Live — server 10.10.10.160:9987, TeamSpeak `6.0.0-beta13.1 [Build: 1790080330]`
1. New identity `TeamsPeach-Probe` (UID `JYFKLvJio5Rsl5v4ikdGajb+cow=`, level 9) connects without
a password in 1.06 s (release build 1.01 s), muted; after `channelsubscribeall` the snapshot
shows clients in all channels; `disconnect` → `{"clean":true}`; exit 0.
2. Independent identity `TeamsPeach-Probe-B` (UID `RDFmfujXKiY89f0Cyiu9HTUNk5o=`, level 8) also
connects without a password.
3. Screen-share discovery (no join, no audio): `requeststreaminfo` per occupant of the demo
channel → all answered `ok`, one `notifystreaminfo` each, captured via the vendored patch.
Streaming client item keys: `id` (UUID), `clid`, `name`, `type=2`, `mode=1`, `accessibility=1`,
`audio=0`, `bitrate=36224`, `viewer=0`, `viewer_limit=0`, `return_code`; non-streamers: only
`return_code`. End-to-end WebRTC viewing through this core was verified by the desktop worker.
4. Voice loop between the two probes in an existing, empty channel (0 other occupants re-checked
before each transmission; nothing sent in the demo channel), 50 × 20 ms synthetic sine:
- A→B 440 Hz: 50/50 frames, estimated 439.0 Hz, RMS 4226 (ideal 4243), first audio after
24 ms, `speakers=[A]`, `talking` true→false, sender `transmitting` true→false, no errors.
- B→A 660 Hz: 50/50 frames, 659.5 Hz, RMS 4234, first audio after 34 ms.
- Channel text as guest → `server_error`, ts_error `2568 PermissionsClientInsufficient`,
`missing_permission 224` (server permission). Private text: sender and recipient each got
exactly one `text` event with `to_client_id`.
- `rename` while connected: server shows the new name, UID unchanged; renamed back.
- Both clean disconnects. The server listed A as `TeamsPeach-Probe1` (nickname collision with
another session; the server appends digits).
5. Metadata (read-only): 20 server groups and 8 channel groups with names, icon ids and
`name_mode`. The labels shown next to nicknames in the user's screenshot are server groups with
`name_mode:"after"` (client with groups `[7,10]` → group 10; client with `[6,7,16]` →
group 16). All 11 channels carry an icon id and `channel_banner_gfx_url` =
`ts3image://<host>?port=9987&channel=1&path=…&filename=…`, `channel_banner_mode=2`
(tsclientlib's book drops banners; read via the raw tap). One client has `country=RU`.
`client_is_streaming` is sent in every enter-view.
6. Avatars: `client_flag_avatar` is empty for every client on this server. TeamSpeak 6 sends
`client_myteamspeak_avatar`; the client shown with a picture avatar had
`2,https://storage.googleapis.com/ts-sys-myts-avatars/<uuid>/<n>`; a client with a myTeamSpeak
id but the default avatar had an empty value. That URL is public: HEAD → 200, no
authentication, `Content-Type: text/plain`, but the first bytes are a PNG signature
(277×277). Snapshot exposes `myts_avatars`; `fetch_avatar` answers `external_media` with the
URL(s) (main fetches and sniffs). Not done: an actual download through main.
`client_user_tag` carries a signed `myts_token` plus the account handle — never exposed.
Nickname colour: no colour field in enter-view (`client_user_tag`, `client_integrations`,
`client_badges`, `client_signed_badges`, `client_meta_data` checked).
7. Media over file transfer: 7 custom icons → `image/png` 2978–7850 B. Built-in ids
100/200/300/500/600 → server error 2054 `FileInvalidPath` for each, so the core answers those
exact ids locally (`not_found`, `builtin`). `fetch_banner` → PNG 108726 B and 105455 B;
`fetch_server_banner` → GIF 1613042 B. Repeated with the release build: same results.
## CI
- Gitea run #1 (commit `7287fdb`, Debian bookworm, Linux x64): `cargo test` 29 passed, 1 failed
(`raw_extras_track_banners_and_streaming`). Cause: the commit captured the core tree in the middle
of the raw-extras lifecycle change (new code, old assertion). The current tree passes on Windows;
Linux not yet re-run.
## Not verified
Server-stored avatar download (none on this server), automatic reconnect after a timeout,
kick/ban reasons, server-forced identity level upgrade, Opus Music channels live (unit tests only),
Speex/CELT error path live, importing an official TeamSpeak client export, Linux/macOS/arm64 builds
and tests.
## Logging privacy (source review, after v0.1.0 freeze)
Default stderr (`info`) does not contain values of TS6 arguments. Unknown-argument warnings log
only the argument name. Parse and book errors log only the error. `log_commands`/`log_packets`
are always off. `client_user_tag`, which carries a signed myTS token, is never logged or exposed.
Hardening item, not applied: vendored `tsclientlib/src/lib.rs` `warn!(message = ?msg, "Expected
initserver, dropping command")` would Debug-print a whole command if one arrived before
`initserver` during connect (not observed live). Proposed fix: log only the command name.
## 0.1.2: private keys with a leading zero byte (bug found and fixed)
- Found by running the unit tests concurrently (6×80): about 3% of runs failed with
`identity_corrupt: invalid private key: Failed to parse short private key` on freshly created
identities.
- Cause: upstream `EccKeyPrivP256::from_tomcrypt` (tsproto-types) passes the DER integer's
minimal bytes to `from_short`, which requires 32 bytes. A scalar starting with `0x00`
(~1 in 256 keys) is written by `to_ts` but cannot be read back. The same applies to
`Identity::new_from_ts_str` (ini import). Affected users would have had a permanently refused
identity (the core never regenerates).
- Fix (`core/src/keyfmt.rs`): upstream's own decoder shape — the same `simple_asn1::from_der`
(already in the lock through tsproto-types), the same SEQUENCE / BIT STRING / INTEGER positions —
with the single difference that the non-negative scalar is left-padded to 32 bytes. The import
path de-obfuscates (same constant as tsproto-types) and then parses the same way. The stored
format is unchanged, so already-written affected files now load; no identity is regenerated.
Malformed input returns an error, never panics. (A first hand-written TLV parser from the same
day was replaced by this after review.)
- Permanent tests are deterministic: fixed scalars with one and three leading zero bytes, a
sign-padded scalar (top bit set, 33-byte DER INTEGER) and a full-width one round-trip as plain
DER, obfuscated `…V…` and plain `…V…`; profile write → load → export → import with the
one-zero scalar; upstream test vector (known UID); malformed inputs (truncated, trailing block,
non-SEQUENCE, empty SEQUENCE, wrong first item, public-only flag, empty / 3-bit / unused-bits >
length BIT STRING, missing or non-INTEGER private slot, negative, zero, empty, ≥ group order and
33-byte scalars) are errors. `cargo test --locked`: 37 unit + 3 stdio smoke pass.
- Throwaway evidence (not kept as tests): upstream `from_ts` fails on the fixed one-zero scalar;
100 000 random keys all round-trip through the fix, 387 had a zero top byte and exactly those
387 fail upstream.
- Release `0.1.2` (root `.cargo/config.toml`, static CRT, `-j 2`): 8969216 bytes, SHA256
`6c04f1e6595740f50628374b23216d00b9e7a5bfa5c8c5cba18a8b053eb9bb57`; imports only system DLLs
(ADVAPI32, IPHLPAPI, KERNEL32, api-ms-win-core-synch, bcrypt, bcryptprimitives, ntdll, oleaut32,
ws2_32); `npm run smoke:core` passes (create → restart → same UID).