Skip to content

fix: strip world-writable bit; add --allow-world-writable flag#94

Merged
bug-ops merged 2 commits intomainfrom
bug-world-writable-files-abort
Mar 15, 2026
Merged

fix: strip world-writable bit; add --allow-world-writable flag#94
bug-ops merged 2 commits intomainfrom
bug-world-writable-files-abort

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Fixes #84.

Summary

  • World-writable files (mode 0o777) aborted extraction with an error, while setuid/setgid bits were silently stripped — inconsistent behavior
  • Strip the world-writable bit (0o002) by default, consistent with existing setuid/setgid stripping
  • Add --allow-world-writable CLI flag and allow_world_writable: bool in SecurityConfig.allowed for explicit opt-in

Changes

  • crates/exarch-core/src/security/permissions.rs: replace Err(InvalidPermissions) with sanitized &= !0o002 strip; add test_world_writable_allowed_with_config, test_world_writable_stripped_by_default, test_world_writable_bit_only_stripped
  • crates/exarch-cli/src/cli.rs: add --allow-world-writable flag to ExtractArgs
  • crates/exarch-cli/src/commands/extract.rs: wire flag to allowed.world_writable
  • CHANGELOG.md: document fix and new flag under [Unreleased]

Test plan

  • cargo +nightly fmt --all -- --check passes
  • cargo clippy --all-targets --all-features --workspace -- -D warnings passes
  • cargo nextest run --workspace --all-features --exclude exarch-python --exclude exarch-node --lib --bins — 516 tests pass
  • Existing tests updated: test_sanitize_permissions_strip_world_writable now asserts Ok(0o775) instead of error
  • New tests: allow_world_writable = true preserves bit; 0o666 → 0o664 (only other-write stripped)

World-writable files (mode 0o777) aborted extraction with an error,
while setuid/setgid bits were silently stripped. Make behavior consistent:
strip the world-writable bit (0o002) by default, and add
`--allow-world-writable` CLI flag / `allow_world_writable` SecurityConfig
option for explicit opt-in.
@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 00:55
@bug-ops bug-ops merged commit 7721953 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the bug-world-writable-files-abort branch March 15, 2026 00:58
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: world-writable files abort extraction with no CLI override (inconsistent with setuid/setgid stripping)

1 participant