🔒 Fix insecure temporary file creation in atomic_write - #406
Conversation
|
👋 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. |
🎯 What: Replaced the predictable temporary filename generator (
format!(".tmp.{}.{}.{}", file_name, pid, nanos)) inatomic_write/atomic_write_strwithtempfile::Builderto create unguessable, cryptographically secure temporary files using OS primitives (mkstemp/O_TMPFILE).🛡️ Solution: Added
tempfile = "3.8"toCargo.tomland updatedatomic_writeinserver_manager/src/core/atomic_io.rsto usetempfile::Builder::new().prefix(&prefix).tempfile_in(parent). Added POSIX permission controls on creation, flushed and synced buffers, and atomically persisted the temporary file to the destination path usingtemp_file.persist(dest).PR created automatically by Jules for task 10188298294900936929 started by @Cylae