🛡️ Sentinel: [CRITICAL] Restrict shell_execute to allowed commands - #35
🛡️ Sentinel: [CRITICAL] Restrict shell_execute to allowed commands#35JustinWoodring wants to merge 1 commit into
Conversation
- Implements an allowlist for `shell_execute` in `slatron-server` (only `yt-dlp`, `ffmpeg`, `ffprobe` allowed). - Blocks potentially dangerous `--exec` argument for `yt-dlp` to prevent RCE. - Adds regression tests in `src/rhai_engine/security_test.rs` to verify blocked commands and arguments. This addresses a critical vulnerability where arbitrary shell commands could be executed via Rhai scripts. Co-authored-by: JustinWoodring <41842051+JustinWoodring@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Code ReviewGood security improvement overall! This PR successfully restricts shell_execute from allowing arbitrary commands to a small allowlist. However, I found one security concern that should be addressed: Security Issue: Incomplete argument restrictions for ffmpeg Location: slatron/slatron-server/src/rhai_engine/mod.rs Lines 177 to 194 in 7cb68a1 While the PR correctly blocks --exec for yt-dlp, ffmpeg and ffprobe are allowed without argument restrictions. This creates a security bypass opportunity. Malicious content_loader scripts could exploit ffmpeg to overwrite arbitrary files and achieve code execution. For example, downloading malicious content from a remote URL and writing it to shell config files. Context: Recommendation: Otherwise, excellent work on the security hardening and comprehensive test coverage! |
This PR addresses a critical security vulnerability in
slatron-server's Rhai scripting engine. Previously, theshell_executefunction allowed execution of arbitrary shell commands. This change introduces:shell_executeis now restricted to a predefined list of safe commands:yt-dlp,ffmpeg, andffprobe.yt-dlp, the--execargument is explicitly blocked to prevent command injection/bypass.src/rhai_engine/security_test.rsverify that unauthorized commands (likels) and dangerous arguments are correctly rejected with a "Security Alert".This change prevents RCE via malicious or compromised scripts.
PR created automatically by Jules for task 15446079692671839145 started by @JustinWoodring