Repository navigation
v0.1.68-2: security, stability, HTTP/2 & XPC performance, and P2 API overhaul - #3
Merged
Merged
Conversation
…esced WINDOW_UPDATE - Mask the reserved high bit on HTTP/2 stream IDs and WINDOW_UPDATE increments (RFC 9113 §4.1, §6.9), and handle PADDED DATA frames. - Ignore unknown SETTINGS parameters (RFC 9113 §6.5.2) and unknown/unused frame types (PRIORITY, PUSH_PROMISE, CONTINUATION, extensions) instead of tearing down the connection; parse PING frames and auto-reply PING ACK. - Slice outbound DATA frames to `min(remaining, 16384, conn_win, stream_win)` so peers advertising `InitialWindowSize < 16384` (or a partially consumed window) never deadlock, flush queued frames before waiting, and bound flow-control waits with a configurable timeout (30s default). - Coalesce inbound WINDOW_UPDATE frames to a per-window threshold `(win / 4).clamp(16 KiB, 256 KiB)` (capped at `win / 2`) written in one contiguous 26-byte write+flush, and skip stream WINDOW_UPDATE after END_STREAM / RST_STREAM. Co-Authored-By: Claude Code <noreply@anthropic.com>
…dact credential Debug output - Upgrade `rsa` 0.9 -> 0.10 (`pkcs1v15`) and `x509-cert` 0.2 -> 0.3 with `sha2_011` (`sha2` 0.11.3, skipping yanked 0.11.2) for the `pair` feature, eliminating `RUSTSEC-2023-0071` (Marvin Attack). Preserve exact iOS lockdownd certificate extensions (SKI, BasicConstraints ca=true, KeyUsage, empty host CA subject and `CN=Device` subject) via a custom `BuilderProfile`. Remove unused `dep:rsa` from `remote_pairing`. - Replace derived `Debug` on `PairingFile` (both rustls and openssl cfgs), `RawPairingFile`, and `CaReturn` with manual impls redacting private keys and `escrow_bag`; redact `e_private_key` and `alt_irk` in `RpPairingFile` `Debug` and stop logging raw `RpPairingFile` plist dictionaries. - Replace `.unwrap()` on `ca::generate_certificates` in `LockdownClient` with an `IdeviceError::UnexpectedResponse` propagation. Co-Authored-By: Claude Code <noreply@anthropic.com>
…PC->plist, and fix HEVC wraparound
- Cap post-auth plist length in `Idevice::read_plist_value` to 64 MiB.
- Harden XPC wire format (`xpc/format.rs`, `xpc/mod.rs`):
- Replace `todo!()` / `.unwrap()` in `From<plist::Value>` with full
`Date`/`Uid`/`UInt64` handling and safe `Date` encoding.
- Bound `XPCMessage::decode` `body_len` (64 MiB) with checked `+ 24`,
cap container recursion depth at 64, check remaining cursor bytes
before allocating `String`/`Data`/`Array`/`Dictionary`, replace
float padding with `(4 - (len & 3)) & 3` and stack zeros, and check
`wrapper_len` addition in `strip_xpc_wrapper_prefix`.
- Add consuming `XPCObject::into_plist(self)` and use it in
`RemoteXpcClient::recv_any`/`recv_from_channel` + `dict.remove("image")`
in `ScreenCaptureServiceClient::take_screenshot` to eliminate two
multi-MiB clones per screenshot.
- Validate `AfcPacketHeader` (`entire_len <= 64 MiB`, checked subtraction
for `header_payload_len >= 40` and `entire_len >= header_payload_len`).
- Harden DVT `Message::from_reader` & `Aux::from_bytes` (`fragment_count > 0`,
`fragment_id < fragment_count`, max 4096 fragments / 64 MiB message,
checked slicing/arithmetic, and check-before-alloc in `read_exact_vec`).
- Bound `os_trace_relay` packet length (4 MiB) and replace unchecked
`- 1` slices with `take_cstr` (`strip_suffix(b"\0")`).
- Fix `HevcDepacketizer` reorder gap-skip to pick the earliest buffered
key in modular 16-bit sequence order (RFC 1982) instead of numeric min,
and prune stale keys behind the jump.
Co-Authored-By: Claude Code <noreply@anthropic.com>
…TLS cache, and CoreDeviceProxy MTU API - NetworkSession (`network_session.rs`): enable TCP keepalive (15s idle / 5s interval / 3 retries) and Linux `TCP_USER_TIMEOUT` (30s) via `socket2` (native targets only), add a 10s default connect timeout, and expose `set_connect_timeout` / `set_retry_backoff`. - Installation helpers (`utils/installation/helpers.rs`, `mod.rs`): generate unique `PublicStaging/<stem>-<hex>.<ext>` paths per upload so concurrent installs/retries never collide, and remove stale `remote_name` docs. - Per-device TLS config cache (`sni.rs`, `lib.rs`): cache `Arc<ClientConfig>` keyed by `(device_cert, host_cert, host_private_key)` (bounded LRU of 16) to avoid rebuilding verifiers/keys per connect while keeping distinct devices' rustls session caches isolated despite shared SNI `"Device"`. - Service connect dedup (`lib.rs`, `services/lockdown.rs`): fetch the pairing file once per `connect_service_socket`, query `UniqueDeviceID` only for `com.apple.mobilebackup2`, and add `LockdownClient::start_service_stream`. - CoreDeviceProxy (`services/core_device_proxy.rs`): expose `pub with_mtu` and unconditional `pub connect_with_mtu(provider, mtu)`. Co-Authored-By: Claude Code <noreply@anthropic.com>
…d set_items, structured NSError, DVT return_value)
- `os_trace_relay`: add standalone `os_trace_relay` Cargo feature (with
`syslog_relay` implying it for backwards compatibility), expose
`os_trace_relay::stream_flags` (`DEFAULT`, `LIVE`, bit constants), and
add `OsTraceRelayClient::start_trace_with_flags(pid, message_filter, stream_flags)`.
- `AppServiceClient`: add `launch_application_with_payload_url` inserting
`options.payloadURL = { relative: url }` when provided.
- `PasteboardServiceClient`: add `PasteboardSourceMetadata`,
`PasteboardWriteItem`, and `set_items` so callers can restore multi-item
/ multi-UTI clipboards and pass `sourceMetadata` for local-only writes
(avoiding Universal Clipboard broadcast).
- `utils::ns_error`: add structured `NsErrorInfo` + recursive
`NSKeyedArchive` Uid resolver that follows references through custom
`NSError` objects and nested `NSUserInfo` / `NSUnderlyingError` chains;
wire it into `CoreDeviceError::DeviceError`, `PasteboardPayload::Error`,
and both `XCT_UI_INIT_DID_FAIL` & `XCT_DID_FAIL_BOOTSTRAP` in `dvt::xctest`.
- `dvt::message::PayloadHeader`: add `return_value()` (`msg_type = 3`),
`with_msg_type(u8)`, and `msg_type() -> u8`.
- Apply `cargo fmt` polish, `TlsConfigCache` type alias in `sni.rs`, and
fix private intra-doc link on `CoreDeviceProxy::connect_with_mtu`.
Co-Authored-By: Claude Code <noreply@anthropic.com>
…ardening
- HTTP/2: reject stream_id 0 on DATA and RST_STREAM (RFC 9113 §6.1/§6.4),
force stream_id 0 on SETTINGS ACK (§6.5), enforce 2^31-1 flow-control
window ceiling on WINDOW_UPDATE and SETTINGS deltas (§6.9.1/§6.9.2), and
clamp available send window before casting to usize (prevents 32-bit
truncation to 0).
- utils::ns_error: add MAX_ARCHIVE_NODES (4096) visit budget to block DAG
amplification bombs within MAX_ARCHIVE_DEPTH, and unwrap CoreDevice Swift
Codable {"string": "..."} / {"error": ...} userInfo wrappers.
- dvt/process_control & message: route launch_app and launch_with_options
error reporting through utils::ns_error (removing private
extract_ns_error_message and gating xctest-only helpers), use wrapping_neg
for i32::MIN channel negation, read DVT fragments directly into packet_data
without doubling peak memory, and bound Aux::from_bytes cursor to body_end.
- xpc/format & os_trace_relay & core_device_proxy: cap initial XPC container
preallocation at 4096 entries, bound create_archive chunk reads at 64 MiB,
and use saturating_sub(60) when computing jktcp MSS from arbitrary MTU.
Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Comprehensive fork upgrade (
feat/v0.1.68-2-> target tagv0.1.68-2after review and two-device real hardware regression) addressing all P0/P1/P2 audit items:P0 — Security & Stability
76644c0):0x7FFF_FFFF) onstream_idandWINDOW_UPDATEincrement; handlePADDEDDATA frames.SETTINGSparameters (RFC 9113 §6.5.2) and unknown/unused frame types (PRIORITY,PUSH_PROMISE,CONTINUATION, extensions); parsePINGand auto-replyPING ACK.DATAframes tomin(remaining, 16384, conn_win, stream_win)(fixingInitialWindowSize < 16384deadlock), flush queued frames before waiting, and bound flow-control wait with a configurable timeout (30s default).rsa 0.9 -> 0.10.0&x509-cert 0.2 -> 0.3.1+ CredentialDebugredaction (dab5582):RUSTSEC-2023-0071(Marvin Attack) inideviceusingsha2_011(0.11.3, skipping yanked0.11.2) and a customBuilderProfilereproducing exact iOSlockdowndcertificate extensions and subjects (""/CN=Device). Removes unuseddep:rsafromremote_pairing.Debugredacting private keys /escrow_bag/alt_irkonPairingFile(both rustls & openssl cfgs),RawPairingFile,CaReturn, andRpPairingFile; stops logging rawRpPairingFileplist dicts..unwrap()onca::generate_certificatesinLockdownClient.69735c0):read_plist_value,XPCMessage::decode,AfcPacketHeader, and DVTMessage::from_reader; 4 MiB cap onos_trace_relay.todo!()/.unwrap()inXPCObject::from(plist::Value), adds XPC depth cap (64), check-before-alloc forString/Data/Array/Dictionaryand DVTAux::read_exact_vec, bit-op padding, checked arithmetic across AFC / DVT / XPC /os_trace_relay.HevcDepacketizerreorder gap-skip across 16-bit RTP sequence wraparound (RFC 1982 modular distance + stale key pruning).b90a140):TCP_USER_TIMEOUT(30s) viasocket2(native only), 10s default connect timeout, configurableset_connect_timeout/set_retry_backoff.b90a140):PublicStaging/<stem>-<hex>.<ext>staging paths preserving.ipa/.ipcc/.appextensions; cleans staleremote_namedoc comments.P1 — Performance & Resource Efficiency
WINDOW_UPDATE(76644c0):(win / 4).clamp(16 KiB, 256 KiB)capped atwin / 2(256 KiB on RemoteXPC 1 MiB window), written in one 26-byte write+flush, skipping stream updates onEND_STREAM/RST_STREAM.XPCObject::into_plist(self)+dict.remove("image")(69735c0): eliminates two multi-MiB buffer clones per screenshot.Arc<rustls::ClientConfig>cache &connect_service_socketdedup (b90a140): keyed by(device_cert, host_cert, host_private_key)(LRU 16) to keep distinct devices' session caches isolated under shared SNI"Device"; singleget_pairing_file()per connect;UniqueDeviceIDfetched only forcom.apple.mobilebackup2; newLockdownClient::start_service_stream.CoreDeviceProxy::with_mtu&connect_with_mtu(b90a140).P2 — Public APIs Eliminating
iphone-controlWorkarounds (7e1def8)os_trace_relayCargo feature (syslog_relayimplies it),os_trace_relay::stream_flags, andOsTraceRelayClient::start_trace_with_flags.AppServiceClient::launch_application_with_payload_url.PasteboardServiceClient::set_items+PasteboardSourceMetadata+PasteboardWriteItem.utils::ns_error::NsErrorInfowith recursiveNSKeyedArchiveUid resolution throughNSError/NSUserInfo/NSUnderlyingError, wired intoCoreDeviceError::DeviceError,PasteboardPayload::Error, and bothXCT_UI_INIT_DID_FAIL&XCT_DID_FAIL_BOOTSTRAP.dvt::message::PayloadHeader::{return_value, with_msg_type, msg_type}.Verification
cargo fmt -p idevice -- --check— cleancargo clippy -p idevice --features full --lib --tests -- -D warnings— 0 warningscargo clippy -p idevice --no-default-features --features ring,pair,os_trace_relay,core_device,dvt,xctest,tunnel_tcp_stack,usbmuxd,tcp,display_stream,afc,heartbeat,installation_proxy,mobile_image_mounter,tss,screenshotr,springboardservices,wda,rsd,xpc --lib -- -D warnings— 0 warningscargo check -p idevice --no-default-features --features ring,os_trace_relay&ring,pair— cleancargo test -p idevice --features full --lib— 92 passed, 0 failed (+23 new unit tests)cargo test -p idevice --features full --test paired_tls— 8 passed, 0 failed🤖 Generated with Claude Code