Skip to content

Security and Stability

Andrew Paolucci edited this page Nov 19, 2026 · 1 revision

Security & Stability Considerations

Because systems administrators routinely launch robocopy2rust elevated as Administrator (required for /B, /ZB, /COPYALL, SeBackupPrivilege, and SeRestorePrivilege), over Windows Server RDP, and inside Hyper-V / VMware / Proxmox VMs, both UI toolkit architecture and process-execution mechanics are treated as first-class security and stability boundaries.


1. Elevated Privilege Surface & Supply-Chain Security

Why WebView / Browser UIs Were Rejected

Running a Chromium/Edge WebView2 or Electron runtime (e.g., Tauri, Electron, dioxus-desktop) inside an elevated Administrator process introduces serious operational hazards:

  • Large multi-million-line C++ + JavaScript JIT engines executing under an elevated token.
  • UIPI (User Interface Privilege Isolation) drag/drop and COM/IPC boundary friction when running as Administrator under a standard desktop login.
  • WebView2 UserDataFolder permission conflicts and stale background cache locks.

robocopy2rust avoids browser engines completely:

  • Zero JavaScript runtime, zero DOM/XSS parser, zero embedded HTTP/IPC bridge, and zero Node.js / .NET dependencies (metadata.json requests zero frame permissions or elevated browser capabilities).

C/C++ FFI Risk & Dependency Blast Radius

Risk Tier Stack Category Assessment for robocopy2rust
Lowest WinSafe 0.0.29 (robocopy2rust-win32) Pure-Rust bindings directly to already-trusted Windows OS DLLs; zero third-party UI crate dependencies; minimal supply-chain blast radius.
Low Iced 0.14 (robocopy2rust-iced with wgpu + tiny-skia) 100% Rust rendering & layout stack (pinned via Cargo.lock); no bundled Chromium/GTK4/Qt C++ runtime libraries.
Higher (Avoided) Bundled C/C++ GUIs (gtk4-rs, Skia/Qt backends, WebView2/Electron) Shipping third-party C/C++ UI libraries transfers upstream C/C++ CVEs onto every utility release.

2. Windows Server, RDP, VM & Runtime Stability

Graphics Driver Resilience (RDP & Virtual Machines)

Windows Server RDP sessions and unaccelerated Hyper-V/VMware/Proxmox consoles often expose only the Microsoft Basic Render Driver (OpenGL 1.1, no Vulkan, no hardware Direct3D 12). Toolkits tied strictly to OpenGL (glow via eframe/egui) or GPU-only pipelines (gpui) can fail window creation on these hosts.

robocopy2rust eliminates graphics driver failures on both tracks:

  • robocopy2rust-win32 (WinSafe): 10/10 Server/RDP Stability. Uses native Windows GDI/Common Controls v6 with zero GPU dependency, native Per-Monitor DPI v2 scaling, and native OS accessibility (UIA / screen readers).
  • robocopy2rust-iced (Iced 0.14): 9/10 Cross-Platform Fallback Stability. Bundles both wgpu hardware acceleration and tiny-skia CPU software rendering, selectable automatically or explicitly via ICED_BACKEND=tiny-skia.

Retained-Mode CPU Efficiency & Bounded Memory

  • Near-0% Idle CPU: robocopy2rust-win32 runs standard Win32 message dispatch; robocopy2rust-iced uses Iced 0.14 reactive rendering and activates its 60 ms polling subscription only while is_running == true.
  • Bounded Log Ring Buffers: Prevents unbounded RAM growth during multi-million-file Robocopy transfers (MAX_LOG_LINES = 25_000 in robocopy2rust-win32; MAX_LOG_BUFFER_LINES = 50_000 in robocopy2rust-iced).
  • Windows Thread Stack Hardening (.cargo/config.toml): Sets a 16 MiB stack on both Windows toolchains (link-arg=/STACK:16777216 on x86_64-pc-windows-msvc and link-arg=-Wl,--stack,16777216 on x86_64-pc-windows-gnu) to prevent stack overflow inside complex GUI layouts and deep parser/dialog calls.

3. Command Injection, Quoting & Process Execution Controls

Safe Direct Process Invocation

robocopy2rust-runner executes robocopy.exe directly via std::process::Command::new(&binary).args(&args) (no cmd.exe /c shell wrapper, preventing shell metacharacter injection via crafted filenames or paths).

  • Trusted Binary Discovery (env.rs): On Windows, checks C:\Windows\System32\robocopy.exe first before scanning PATH, mitigating executable hijacking/shadowing from the current directory or untrusted PATH entries.
  • CREATE_NO_WINDOW (0x0800_0000): Set on spawned robocopy.exe and taskkill child processes on Windows.
  • Clean Cancellation (CancelToken): Cancels running child trees explicitly (taskkill /PID <pid> /T /F on Windows; kill -TERM <pid> on Unix) and maps interrupted runs cleanly to exit code -1 (cancelled: true). In the CLI, Ctrl+C installs a two-stage handler: first interrupt cancels cleanly; second interrupt forces exit 130.

CommandLineToArgvW Trailing-Backslash Protection (command.rs & parser.rs)

Because Windows CommandLineToArgvW treats \" as a literal escaped double quote, naively quoting root drives like "C:\" breaks Microsoft Robocopy argument boundaries (turning destination paths into concatenated garbage).

robocopy2rust-core applies two safeguards:

  1. normalize_robocopy_path: Strips trailing slashes on non-root directories (C:\Users\Alice\ → C:\Users\Alice, \\server\share\ → \\server\share) while preserving drive roots (C:\, normalized from C:/).
  2. quote_windows_arg: Doubles any trailing backslashes immediately preceding the closing quote (C:\ → "C:\\", C:\My Docs\ → "C:\My Docs\\"), and generates argument-array PowerShell scripts ($robocopyArgs = @(...)) with single-quote escaping ('') to avoid shell string re-parsing.

4. Defense-in-Depth Destructive Flag Guards

Flags capable of deleting destination or source files — /MIR, /PURGE, /MOVE, and /MOV — are gated across every entry point whenever Dry-Run (/L) is disabled (job.has_destructive_flags()):

Surface Enforcement Mechanism
Core Model & Validator Emits DESTRUCTIVE_FLAGS_ACTIVE (Warning) and recommends /L dry-run; provides with_list_only() non-destructive clone helper.
Win32 GUI (robocopy2rust-win32) Blocks execution behind a native OS MessageBox warning listing the active destructive switches and requiring explicit confirmation.
Iced GUI (robocopy2rust-iced) Opens ActiveModal::ConfirmDestructive highlighting active switches with a one-click Run Dry-Run (/L) Instead escape hatch.
CLI (robocopy2rust run) Refuses execution unless --yes (-y) is explicitly passed on the command line.
MCP Server (robocopy2rust_run) Refuses execution with an explicit SAFETY REFUSAL error unless confirm_destructive: true is supplied, guiding AI agents to run robocopy2rust_dry_run first.

5. Offline Air-Gapped Reports, Atomic Writes & Vulnerability Disclosure

  • XSS-Safe, Zero-Network HTML Reports: robocopy2rust-report/src/html.rs HTML-escapes all file paths, error lines, timestamps, and titles (&, <, >, ", ') and embeds 100% inline CSS/JavaScript — zero remote fonts, zero CDNs, zero external <script src=...>.
  • SHA-256 Log Integrity: Streams all raw stdout/stderr lines into a SHA-256 hash (log_sha256) stored in RunResult, JSON, Markdown, and HTML reports.
  • Atomic Profile & History Persistence: ProfileStore writes JSON payloads to a .json.tmp sibling file before renaming over profiles.json / history.json, preventing file corruption on crash or power loss.
  • Logging Hygiene: All tracing diagnostics target stderr (or --log-file) so stdout stays uncorrupted for --json CLI pipelines and stdio JSON-RPC MCP transports.

Reporting Security Issues (SECURITY.md)

Do not disclose command-injection, quoting, or destructive-guard bypasses via public GitHub Issues. Submit reports privately via GitHub Private Vulnerability Reporting:

Clone this wiki locally