Skip to content

Zeroize daemon authentication secrets during module listing - #1050

Merged
oferchen merged 1 commit into
masterfrom
implement-missing-components-for-oc-rsync
Oct 24, 2025
Merged

oferchen merged 1 commit into
masterfrom
implement-missing-components-for-oc-rsync

Conversation

@oferchen

@oferchen oferchen commented Oct 24, 2025 •

Copy link
Copy Markdown
Owner

Summary

  • wrap daemon authentication secrets in a zeroizing helper so temporary buffers are wiped after use
  • update module listing authentication flow to reuse the helper and expose safe accessors
  • add unit tests covering the zeroization helpers for both client-side storage types

Testing

  • cargo test

@oferchen
oferchen merged commit e094f03 into master Oct 24, 2025
@oferchen
oferchen deleted the implement-missing-components-for-oc-rsync branch October 24, 2025 18:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/core/src/client.rs
Comment on lines +6141 to 6172
struct SensitiveBytes(Vec<u8>);

impl SensitiveBytes {
fn new(bytes: Vec<u8>) -> Self {
Self(bytes)
}

fn to_vec(&self) -> Vec<u8> {
self.0.clone()
}

fn as_slice(&self) -> &[u8] {
&self.0
}
}

#[cfg(test)]
impl SensitiveBytes {
fn into_zeroized_vec(mut self) -> Vec<u8> {
for byte in &mut self.0 {
*byte = 0;
}
std::mem::take(&mut self.0)
}
}

impl Drop for SensitiveBytes {
fn drop(&mut self) {
for byte in &mut self.0 {
*byte = 0;
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use non-optimizable zeroization for secrets

The new SensitiveBytes drop implementation clears the buffer with a plain for loop that writes 0 (impl Drop for SensitiveBytes). Rust does not guarantee that such writes are retained after optimisation if the data is never read again, so compilers may elide the loop and leave the authentication secret in memory. Since this commit’s goal is to reliably wipe passwords, the destructor should use a zeroization primitive that cannot be removed (e.g. the zeroize crate or ptr::write_volatile/zeroize::Zeroizing). Without that, the change does not actually guarantee the secrets are cleared.

Useful? React with 👍 / 👎.

oferchen added a commit that referenced this pull request May 5, 2026
Adds an audit for task #1048 quantifying the path-storage portion of
the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current
per the flist-memory baseline). Per-entry breakdown of `name: PathBuf`
(24 B inline + heap with capacity slack) and `dirname: Arc<Path>`
(16 B inline + 16 B `ArcInner` header), comparison to upstream's
pool-allocated `struct file_struct` + `lastdir` cache from
`flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing
file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena
with `(offset, len)` slice fields as the natural shape for #1050,
with `Box<[u8]>` post-sort as the smaller mechanical fallback.
oferchen added a commit that referenced this pull request May 7, 2026
Document the container-level RSS gap between oc-rsync's
Vec<FileEntry> + segmented file lists and upstream rsync's
pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment
fragmentation, and pointer-array overhead at 100K and 1M file
scales, then propose five remediation paths ranked by effort/payoff:
pre-size from getdents count, bumpalo arena, typed-arena, custom
slab pool, and inline-string path collapse. Recommend stacking
the cheapest two for an estimated 40-50 MiB win at 1M entries.
oferchen added a commit that referenced this pull request May 7, 2026
Static audit comparing upstream rsync's per-flist slab pool
(`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus
per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations.
Lists bumpalo / typed-arena candidates for collapsing the file
list into a single slab and the lifetime, Drop, and signal-cleanup
risks that gate the pilot.
oferchen added a commit that referenced this pull request May 16, 2026
Walks current owner sites of FileEntry to confirm the bumpalo arena
swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing
extras fields, and the Arc<FileEntry> job pipeline. Records the
exact code sites that would have to move, recommends pre-size +
path-collapse as cheaper prerequisites per the prior #1050 audits.
oferchen added a commit that referenced this pull request May 16, 2026
Walks current owner sites of FileEntry to confirm the bumpalo arena
swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing
extras fields, and the Arc<FileEntry> job pipeline. Records the
exact code sites that would have to move, recommends pre-size +
path-collapse as cheaper prerequisites per the prior #1050 audits.
oferchen added a commit that referenced this pull request May 18, 2026
Adds an audit for task #1048 quantifying the path-storage portion of
the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current
per the flist-memory baseline). Per-entry breakdown of `name: PathBuf`
(24 B inline + heap with capacity slack) and `dirname: Arc<Path>`
(16 B inline + 16 B `ArcInner` header), comparison to upstream's
pool-allocated `struct file_struct` + `lastdir` cache from
`flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing
file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena
with `(offset, len)` slice fields as the natural shape for #1050,
with `Box<[u8]>` post-sort as the smaller mechanical fallback.
oferchen added a commit that referenced this pull request May 18, 2026
Document the container-level RSS gap between oc-rsync's
Vec<FileEntry> + segmented file lists and upstream rsync's
pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment
fragmentation, and pointer-array overhead at 100K and 1M file
scales, then propose five remediation paths ranked by effort/payoff:
pre-size from getdents count, bumpalo arena, typed-arena, custom
slab pool, and inline-string path collapse. Recommend stacking
the cheapest two for an estimated 40-50 MiB win at 1M entries.
oferchen added a commit that referenced this pull request May 18, 2026
Static audit comparing upstream rsync's per-flist slab pool
(`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus
per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations.
Lists bumpalo / typed-arena candidates for collapsing the file
list into a single slab and the lifetime, Drop, and signal-cleanup
risks that gate the pilot.
oferchen added a commit that referenced this pull request May 18, 2026
Walks current owner sites of FileEntry to confirm the bumpalo arena
swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing
extras fields, and the Arc<FileEntry> job pipeline. Records the
exact code sites that would have to move, recommends pre-size +
path-collapse as cheaper prerequisites per the prior #1050 audits.
oferchen added a commit that referenced this pull request May 18, 2026
Walks current owner sites of FileEntry to confirm the bumpalo arena
swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing
extras fields, and the Arc<FileEntry> job pipeline. Records the
exact code sites that would have to move, recommends pre-size +
path-collapse as cheaper prerequisites per the prior #1050 audits.
oferchen added a commit that referenced this pull request Aug 24, 2026
Adds an audit for task #1048 quantifying the path-storage portion of
the 100K-files RSS gap (87.5 vs 7.4 MB at v0.5; 42.6 vs 7.9 MB current
per the flist-memory baseline). Per-entry breakdown of `name: PathBuf`
(24 B inline + heap with capacity slack) and `dirname: Arc<Path>`
(16 B inline + 16 B `ArcInner` header), comparison to upstream's
pool-allocated `struct file_struct` + `lastdir` cache from
`flist.c`/`rsync.h`, and a test/benchmark plan reusing the existing
file-entry memory benchmark. Recommends an `Arc<[u8]>` per-flist arena
with `(offset, len)` slice fields as the natural shape for #1050,
with `Box<[u8]>` post-sort as the smaller mechanical fallback.
oferchen added a commit that referenced this pull request Aug 24, 2026
Document the container-level RSS gap between oc-rsync's
Vec<FileEntry> + segmented file lists and upstream rsync's
pool_alloc.c slab arena. Quantify Vec doubling slack, per-segment
fragmentation, and pointer-array overhead at 100K and 1M file
scales, then propose five remediation paths ranked by effort/payoff:
pre-size from getdents count, bumpalo arena, typed-arena, custom
slab pool, and inline-string path collapse. Recommend stacking
the cheapest two for an estimated 40-50 MiB win at 1M entries.
oferchen added a commit that referenced this pull request Aug 24, 2026
Walks current owner sites of FileEntry to confirm the bumpalo arena
swap remains blocked by Vec/Arc by-value pipelines, Drop-bearing
extras fields, and the Arc<FileEntry> job pipeline. Records the
exact code sites that would have to move, recommends pre-size +
path-collapse as cheaper prerequisites per the prior #1050 audits.
oferchen added a commit that referenced this pull request Aug 24, 2026
Static audit comparing upstream rsync's per-flist slab pool
(`lib/pool_alloc.c`) against oc-rsync's `Vec<FileEntry>` plus
per-entry `PathBuf` and `Box<FileEntryExtras>` heap allocations.
Lists bumpalo / typed-arena candidates for collapsing the file
list into a single slab and the lifetime, Drop, and signal-cleanup
risks that gate the pilot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant