Skip to content

fix: enforce exact sanitized permissions after extraction, bypassing umask#101

Merged
bug-ops merged 3 commits intomainfrom
extracted-file-permissions-sil
Mar 15, 2026
Merged

fix: enforce exact sanitized permissions after extraction, bypassing umask#101
bug-ops merged 3 commits intomainfrom
extracted-file-permissions-sil

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 15, 2026

Summary

  • create_file_with_mode called OpenOptions::mode() which is subject to the process umask (typically 022), silently stripping group-write bits — sanitized mode 0o775 would land as 0o755
  • Fix: after opening the file, call fs::set_permissions(path, Permissions::from_mode(m)) to enforce the exact sanitized mode, bypassing umask
  • Added two tests: one that verifies end-to-end extraction honors sanitized mode, and one (test_create_file_with_mode_bypasses_strict_umask) that explicitly sets umask to 0o077 to directly validate the bypass

Closes #97

Test plan

  • cargo +nightly fmt --all -- --check — passes
  • cargo clippy --all-targets --all-features --workspace -- -D warnings — passes
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features --workspace — passes
  • cargo nextest run --workspace --all-features --exclude exarch-python --exclude exarch-node --lib --bins — 534/534 pass
  • cargo deny check — passes

bug-ops added 2 commits March 15, 2026 02:14
…umask

`create_file_with_mode` used `OpenOptions::mode()` which is subject to
the process umask. A typical umask of 022 would silently strip group-write
bits, causing sanitized mode 0o775 to land as 0o755.

After opening the file, call `fs::set_permissions` with the intended mode
to override umask and enforce the exact sanitized permissions.

Closes #97
@github-actions github-actions bot added core Changes to exarch-core docs Documentation labels Mar 15, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 01:21
@bug-ops bug-ops merged commit c1ce147 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the extracted-file-permissions-sil branch March 15, 2026 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to exarch-core docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: extracted file permissions silently restricted by process umask (group-write stripped unexpectedly)

1 participant