π‘οΈ Sentinel: [HIGH] Fix environment hijacking and arbitrary file move/deletion in install.sh - #53
Conversation
β¦/deletion in install.sh Initialize critical installer-flow variables (ANTIGRAVITY_BAK, ANTIGRAVITY_VA39_BAK, INSTALL_BIN_DIR, SECURE_TMP_DIR, and INSTALL_SUCCESS) to safe defaults at the script entry of install.sh. This ensures pre-existing environment variables cannot hijack trap cleanup handlers to execute arbitrary file deletions or moves on premature exits or script cancellations. Additionally, ensure INSTALL_BIN_DIR is validated to be non-empty before executing restore commands.
|
π 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. |
π¨ Severity: HIGH
π‘ Vulnerability:
Critical variables used within the installer's exit/cleanup trap (
ANTIGRAVITY_BAK,ANTIGRAVITY_VA39_BAK,INSTALL_BIN_DIR,SECURE_TMP_DIR) were not explicitly initialized at script startup. An attacker or user could pre-set these variables in their environment. If the script exited prematurely (e.g., during env/prerequisite checks or SIGINT/cancellation), the cleanup trap was invoked using those parent environment values, causing arbitrary files to be moved or deleted (rm -formv -f).π§ Fix:
ANTIGRAVITY_BAK,ANTIGRAVITY_VA39_BAK,INSTALL_BIN_DIR,SECURE_TMP_DIR, andINSTALL_SUCCESSto safe defaults (""and0) at script entry.INSTALL_BIN_DIRbefore attempting restoremvcommands in the trap logic.β Verification:
ANTIGRAVITY_BAK=dummy_sensitive_fileno longer deletes or moves the file during early script exits.bash -n install.sh) and existing test suites (python3 test_statusline.py) successfully with zero regressions.PR created automatically by Jules for task 9289392815037441823 started by @qapdex-maker