🔒 Fix DoS vulnerability on read_line input handling in CLI helpers#46
Conversation
Replaced the `.expect()` call on `io::stdin().read_line()` with a safe `match` statement in `prompt_microstructure_variable` and `prompt_cutoff_value` inside `src/helpers.rs` to return `None` on IO errors. Replaced `.unwrap()` on stdout flush with graceful silent failure. Co-authored-by: soniapi <396009+soniapi@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Added installation of `protobuf-compiler` and `libpq-dev` to `.github/workflows/rust.yml` to resolve CI build failures caused by missing system libraries required by the `prost-build` and `pq-sys` crates respectively. Co-authored-by: soniapi <396009+soniapi@users.noreply.github.com>
620bd80 to
c7f9489
Compare
🎯 What: The vulnerability fixed
The unhandled
Resultresponses on userstdinoperations (such as.expectonread_lineor.unwraponstdout().flush()) were modified to use safe error handling (returningNoneor silently swallowing the flush error).Panicking directly on a bad user input stream or a closed output stream could lead to Denial of Service (DoS) situations where the application forcefully crashes upon encountering an IO failure.
🛡️ Solution: How the fix addresses the vulnerability
Replaced the panic-inducing calls with structured control flow. For
read_line, amatchstatement handles anErrby gracefully returningNone. Forflush, the output is matched to safely ignore standard flush failure vialet _ = ....PR created automatically by Jules for task 11507617284266801024 started by @soniapi