Skip to content

Guard against empty TARGET_DIR - #15

Open
vagos wants to merge 1 commit into
FusionAuth:mainfrom
vagos:guard-empty-target-dir
Open

vagos wants to merge 1 commit into
FusionAuth:mainfrom
vagos:guard-empty-target-dir

Conversation

@vagos

@vagos vagos commented Aug 24, 2026

Copy link
Copy Markdown

This prevents the installer from continuing when TARGET_DIR resolves to an empty value before it creates or removes install directories.

Without this guard, the cleanup step can expand paths like $TARGET_DIR/bin to /bin.

Copilot AI lite review requested due to automatic review settings August 24, 2026 18:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a safety check in the zip install path to prevent running directory creation/cleanup logic when TARGET_DIR is invalid, reducing the risk of destructive rm -rf operations against unintended paths.

Changes:

  • Added a guard in install_zip() to exit early when TARGET_DIR is empty.
  • Minor whitespace adjustment in the cleanup branch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread install.sh
Comment on lines +35 to +38
if [ -z "${TARGET_DIR}" ]; then
echo "Need to set TARGET_DIR to a valid directory. Set it and try again."
exit 1
fi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlikely that a user would set TARGET_DIR to /, but otherwise no pushback from me on this.

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.

2 participants