M1: dalek 4, fuzzing and fixes, tsc-model with server flavor
- curve25519-dalek-ng -> curve25519-dalek 4. - fuzz/: cargo-fuzz targets for packets, commands and the license chain, plus a nightly workflow. Fixes for the panics they found: empty license, unchecked license property bounds, wrong index in the C2S audio invalid-codec error. - tsc-model: ServerVersion/ServerFlavor/Capabilities parsed from virtualserver_version; tsctl shows the flavor in the tree header. - CI lints every non-vendored crate via scripts/own-crates.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
1 parent
369cbde85d
commit
aa19afbcd0
24 files changed
+1835
-57
No files matched your search
@@ -0,0 +1,4 @@
|
||||
target/
|
||||
corpus/
|
||||
artifacts/
|
||||
coverage/
|
||||
Generated
+1431
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,38 @@
|
||||
[package]
|
||||
name = "tsc-fuzz"
|
||||
version = "0.0.0"
|
||||
publish = false
|
||||
edition = "2024"
|
||||
|
||||
[package.metadata]
|
||||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
libfuzzer-sys = "0.4"
|
||||
ts-bookkeeping = { path = "../crates/proto/ts-bookkeeping" }
|
||||
tsproto = { path = "../crates/proto/tsproto" }
|
||||
tsproto-packets = { path = "../crates/proto/tsproto-packets" }
|
||||
|
||||
# Not part of the main workspace: cargo-fuzz needs a nightly toolchain.
|
||||
[workspace]
|
||||
|
||||
[[bin]]
|
||||
name = "packet"
|
||||
path = "fuzz_targets/packet.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
|
||||
[[bin]]
|
||||
name = "command"
|
||||
path = "fuzz_targets/command.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
|
||||
[[bin]]
|
||||
name = "license"
|
||||
path = "fuzz_targets/license.rs"
|
||||
test = false
|
||||
doc = false
|
||||
bench = false
|
||||
@@ -0,0 +1,24 @@
|
||||
//! Decrypted command payloads, parsed into typed messages.
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use ts_bookkeeping::messages::s2c::InMessage;
|
||||
use tsproto_packets::commands::CommandParser;
|
||||
use tsproto_packets::packets::{Direction, InPacket};
|
||||
|
||||
/// S2C header: 8 byte MAC, packet id 1, type Command with the NewProtocol flag.
|
||||
const HEADER: [u8; 11] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x22];
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let (_, args) = CommandParser::new(data);
|
||||
for arg in args {
|
||||
let _ = format!("{arg:?}");
|
||||
}
|
||||
|
||||
let mut packet = HEADER.to_vec();
|
||||
packet.extend_from_slice(data);
|
||||
let packet = InPacket::new(Direction::S2C, &packet);
|
||||
if let Ok(msg) = InMessage::new(&packet.header(), data) {
|
||||
let _ = format!("{msg:?}");
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,11 @@
|
||||
//! The license chain sent in `initivexpand2 l=...` during the handshake.
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use tsproto::license::Licenses;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(licenses) = Licenses::parse_ignore_expired(data.to_vec()) {
|
||||
let _ = format!("{licenses:?}");
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,15 @@
|
||||
//! Raw UDP packets from the server.
|
||||
#![no_main]
|
||||
|
||||
use libfuzzer_sys::fuzz_target;
|
||||
use tsproto_packets::packets::{Direction, InPacket};
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
for dir in [Direction::S2C, Direction::C2S] {
|
||||
if let Ok(packet) = InPacket::try_new(dir, data) {
|
||||
let _ = format!("{packet:?}");
|
||||
let _ = packet.header().packet_type();
|
||||
let _ = packet.ack_packet();
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user