Fix: Harden TCP liveness, atomic IP assignment, and invalid network input handling - #7
Open
mertcano wants to merge 1 commit into
Open
Fix: Harden TCP liveness, atomic IP assignment, and invalid network input handling#7mertcano wants to merge 1 commit into
mertcano wants to merge 1 commit into
Conversation
…nput handling ### Description This PR addresses High-severity networking and liveness vulnerabilities in the `deterministic-simulator` repository, as identified during the workspace-wide security audit. **Quality & Security Defects Remediated:** * **TCP Connection Liveness (`msim/src/sim/net/network.rs`, `msim/src/sim/net/mod.rs`):** The simulator previously passed only the local TCP ID when deregistering a connection. This caused remote peer reads to hang indefinitely because they waited on their own local ID. The teardown path now accurately carries and routes both IDs, instantly waking the remote mailbox. * **Network State Integrity (`msim/src/sim/net/network.rs`):** IP conflicts (`set_ip`) previously mutated the address map before throwing a panic while the `NetSim` mutex was held, poisoning the simulator. IP assignment now strictly validates the conflict before mutation and gracefully returns typed `io::ErrorKind::AddrInUse` or `io::ErrorKind::NotFound` errors. * **Invalid Network Input Handling:** Binding to unspecified addresses without a node IP previously reached a `todo!()` macro, and empty `ToSocketAddrs` iterators triggered panics via unwrapping. These paths now gracefully return `io::ErrorKind::AddrNotAvailable` and `io::ErrorKind::InvalidInput`, respectively.
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.
Description
This PR addresses High-severity networking and liveness vulnerabilities in the
deterministic-simulatorrepository, as identified during the workspace-wide security audit.Quality & Security Defects Remediated:
msim/src/sim/net/network.rs,msim/src/sim/net/mod.rs): The simulator previously passed only the local TCP ID when deregistering a connection. This caused remote peer reads to hang indefinitely because they waited on their own local ID. The teardown path now accurately carries and routes both IDs, instantly waking the remote mailbox.msim/src/sim/net/network.rs): IP conflicts (set_ip) previously mutated the address map before throwing a panic while theNetSimmutex was held, poisoning the simulator. IP assignment now strictly validates the conflict before mutation and gracefully returns typedio::ErrorKind::AddrInUseorio::ErrorKind::NotFounderrors.todo!()macro, and emptyToSocketAddrsiterators triggered panics via unwrapping. These paths now gracefully returnio::ErrorKind::AddrNotAvailableandio::ErrorKind::InvalidInput, respectively.