fix: π‘οΈ Sentinel: [HIGH] Prevent Option Injection / Arbitrary Command Execution in swapfile creation#218
Conversation
β¦ Execution in swapfile creation
|
π 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. |
π― What:
The preflight script used
sudo dd,sudo mkswap,sudo chmod, andsudo swaponwith a hardcoded swapfile path, but lacked explicit protection against arbitrary option injection and path traversal if the path was parameterized.A malicious user or process could supply a payload mimicking command line flags (e.g.
--some-option=value) or traverse directories (e.g.../) allowing them to execute arbitrary actions as the root user. This could be abused to execute commands or overwrite crucial system files.π‘οΈ Solution:
isValidSwapPath(path)to strictly validate alphanumeric names, enforcing absolute paths, and rejecting...--delimiter tochmod,mkswap,swapon,swapoffandrmto disallow option injection.PR created automatically by Jules for task 26154607767391731 started by @Hardonian