Skip to content

fix: πŸ›‘οΈ Sentinel: [HIGH] Prevent Option Injection / Arbitrary Command Execution in swapfile creation#218

Merged
Hardonian merged 2 commits into
mainfrom
fix-swapfile-injection-26154607767391731
May 29, 2026
Merged

fix: πŸ›‘οΈ Sentinel: [HIGH] Prevent Option Injection / Arbitrary Command Execution in swapfile creation#218
Hardonian merged 2 commits into
mainfrom
fix-swapfile-injection-26154607767391731

Conversation

@Hardonian

Copy link
Copy Markdown
Owner

🎯 What:
The preflight script used sudo dd, sudo mkswap, sudo chmod, and sudo swapon with a hardcoded swapfile path, but lacked explicit protection against arbitrary option injection and path traversal if the path was parameterized.

⚠️ Risk:
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:

  1. Created isValidSwapPath(path) to strictly validate alphanumeric names, enforcing absolute paths, and rejecting ...
  2. Passed the parameterized path correctly through to the commands, and added the end-of-options -- delimiter to chmod, mkswap, swapon, swapoff and rm to disallow option injection.
  3. Passed the parameterized path correctly through to the fstab regex check.

PR created automatically by Jules for task 26154607767391731 started by @Hardonian

@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@Hardonian
Hardonian merged commit e0e2b00 into main May 29, 2026
5 of 12 checks passed
@Hardonian
Hardonian deleted the fix-swapfile-injection-26154607767391731 branch May 29, 2026 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant