Repository navigation
Security and Stability
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.
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
UserDataFolderpermission 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 /
.NETdependencies (metadata.jsonrequests zero frame permissions or elevated browser capabilities).
| 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. |
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 bothwgpuhardware acceleration andtiny-skiaCPU software rendering, selectable automatically or explicitly viaICED_BACKEND=tiny-skia.
-
Near-0% Idle CPU:
robocopy2rust-win32runs standard Win32 message dispatch;robocopy2rust-iceduses Iced 0.14 reactive rendering and activates its60 mspolling subscription only whileis_running == true. -
Bounded Log Ring Buffers: Prevents unbounded RAM growth during multi-million-file Robocopy transfers (
MAX_LOG_LINES = 25_000inrobocopy2rust-win32;MAX_LOG_BUFFER_LINES = 50_000inrobocopy2rust-iced). -
Windows Thread Stack Hardening (
.cargo/config.toml): Sets a 16 MiB stack on both Windows toolchains (link-arg=/STACK:16777216onx86_64-pc-windows-msvcandlink-arg=-Wl,--stack,16777216onx86_64-pc-windows-gnu) to prevent stack overflow inside complex GUI layouts and deep parser/dialog calls.
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, checksC:\Windows\System32\robocopy.exefirst before scanningPATH, mitigating executable hijacking/shadowing from the current directory or untrustedPATHentries. -
CREATE_NO_WINDOW(0x0800_0000): Set on spawnedrobocopy.exeandtaskkillchild processes on Windows. -
Clean Cancellation (
CancelToken): Cancels running child trees explicitly (taskkill /PID <pid> /T /Fon 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 exit130.
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:
-
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 fromC:/). -
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.
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. |
-
XSS-Safe, Zero-Network HTML Reports:
robocopy2rust-report/src/html.rsHTML-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 inRunResult, JSON, Markdown, and HTML reports. -
Atomic Profile & History Persistence:
ProfileStorewrites JSON payloads to a.json.tmpsibling file before renaming overprofiles.json/history.json, preventing file corruption on crash or power loss. -
Logging Hygiene: All
tracingdiagnostics targetstderr(or--log-file) sostdoutstays uncorrupted for--jsonCLI pipelines andstdioJSON-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:
- https://github.com/adpaolucci/robocopy2rust/security/advisories/new
- Target acknowledgment SLA: within 48 hours.
robocopy2rust (v0.1.0) • GUAP Ecosystem (guap.ca) • Rust 2024 Edition • Apache-2.0 License • Repository • Security Policy