mirror of
https://github.com/openai/codex.git
synced 2026-10-29 19:08:43 +00:00
## What changed - Add helper protocol requests to create a WebRTC offer, apply an answer, and report readiness once the ordered `oai-events` data channel opens. - Support UDP and TCP candidates while bounding signaling size, remote candidates, inbound TCP streams, and WebRTC buffers. Redact session descriptions and peer errors from diagnostics. - Close unexpected remote data channels and tear down the peer during helper shutdown, including when the parent pipe is lost during startup. ## Testing - Exercise offer/answer negotiation and clean shutdown over real UDP and TCP sockets. - Cover signaling validation, candidate and connection limits, early packet loss, slow TCP connection setup, and blocked-startup parent loss. GitOrigin-RevId: 5f5e60a3a4d1d8eaca2e4724e66284f54061b6af
29 lines
932 B
Rust
29 lines
932 B
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn signaling_roundtrips_without_diagnostic_secrets() {
|
|
let secret = "a=ice-pwd:synthetic-secret";
|
|
let message = Message::ApplyAnswer {
|
|
sdp: secret.to_owned().try_into().unwrap(),
|
|
};
|
|
let debug = format!("{message:?}");
|
|
assert!(!debug.contains(secret));
|
|
assert!(debug.contains("REDACTED"));
|
|
assert_eq!(
|
|
decode_frame(&encode_frame(&message).unwrap()).unwrap(),
|
|
Some(message)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn signaling_bounds_apply_to_untrusted_wire_input() {
|
|
for sdp in [String::new(), "x".repeat(64 * 1024 + 1)] {
|
|
let json = serde_json::json!({"type": "applyAnswer", "sdp": sdp}).to_string();
|
|
let mut frame = (json.len() as u32).to_be_bytes().to_vec();
|
|
frame.extend(json.as_bytes());
|
|
let error = decode_frame(&frame).unwrap_err();
|
|
assert_eq!(error.to_string(), "invalid voice frame");
|
|
}
|
|
}
|