Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions system_files/shared/usr/libexec/bbrew-launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -euo pipefail

BBREW_PATH="/home/linuxbrew/.linuxbrew/bin/bbrew"
BREW_PATH="/home/linuxbrew/.linuxbrew/bin/brew"

if [[ ! -x "$BREW_PATH" ]]; then
echo "FATAL: Homebrew is not installed at $BREW_PATH"
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The error message should be directed to stderr instead of stdout. Error messages should use >&2 to ensure they appear in the error stream. Change to: echo "FATAL: Homebrew is not installed at $BREW_PATH" >&2

Suggested change
echo "FATAL: Homebrew is not installed at $BREW_PATH"
echo "FATAL: Homebrew is not installed at $BREW_PATH" >&2

Copilot uses AI. Check for mistakes.
exit 1
fi

eval "$($BREW_PATH shellenv)"

Comment on lines +13 to +14
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The eval "$($BREW_PATH shellenv)" command could be a security risk if BREW_PATH or its output is compromised. Consider adding validation to verify BREW_PATH hasn't been tampered with, or at minimum add a comment documenting this security consideration. Additionally, the script should handle the case where shellenv fails or returns unexpected output.

Suggested change
eval "$($BREW_PATH shellenv)"
# SECURITY NOTE: The following command executes shell code generated by Homebrew.
# If $BREW_PATH or its output is compromised, this could be a security risk.
# We validate $BREW_PATH and check shellenv output before eval.
# Validate that BREW_PATH is the expected binary (optional: check hash or symlink)
if ! [[ "$(readlink -f "$BREW_PATH")" == "/home/linuxbrew/.linuxbrew/bin/brew" ]]; then
echo "FATAL: $BREW_PATH does not resolve to expected Homebrew binary."
exit 1
fi
SHELLENV_OUTPUT="$($BREW_PATH shellenv 2>/dev/null)"
if [[ $? -ne 0 || -z "$SHELLENV_OUTPUT" ]]; then
echo "FATAL: Failed to get shellenv from Homebrew."
exit 1
fi
# Basic validation: ensure output only contains variable assignments and 'export'
if ! echo "$SHELLENV_OUTPUT" | grep -Eq '^(export [A-Z_]+=|PATH=|MANPATH=|INFOPATH=)'; then
echo "FATAL: Unexpected output from brew shellenv."
exit 1
fi
eval "$SHELLENV_OUTPUT"

Copilot uses AI. Check for mistakes.
if [[ -x "$BBREW_PATH" ]]; then
exec "$BBREW_PATH" "$@"
else
echo "Bold Brew first time setup. Installing..."
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The informational message should be directed to stderr instead of stdout since this is a status message and not data output. This prevents the message from interfering with any command output. Change to: echo "Bold Brew first time setup. Installing..." >&2

Suggested change
echo "Bold Brew first time setup. Installing..."
echo "Bold Brew first time setup. Installing..." >&2

Copilot uses AI. Check for mistakes.
"$BREW_PATH" install Valkyrie00/homebrew-bbrew/bbrew
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The brew install command runs without any confirmation or error handling beyond the final existence check. If the installation fails silently or is interrupted, the user won't get helpful feedback. Consider capturing the installation output and providing more specific error messages, such as: if ! "$BREW_PATH" install Valkyrie00/homebrew-bbrew/bbrew; then echo "FATAL: Installation command failed. Check brew logs for details." >&2; exit 1; fi

Suggested change
"$BREW_PATH" install Valkyrie00/homebrew-bbrew/bbrew
if ! "$BREW_PATH" install Valkyrie00/homebrew-bbrew/bbrew; then
echo "FATAL: Installation command failed. Check brew logs for details." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
if [[ -x "$BBREW_PATH" ]]; then
exec "$BBREW_PATH" "$@"
else
echo "FATAL: Installation failed."
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The error message should be directed to stderr instead of stdout. Error messages should use >&2 to ensure they appear in the error stream. Change to: echo "FATAL: Installation failed." >&2

Suggested change
echo "FATAL: Installation failed."
echo "FATAL: Installation failed." >&2

Copilot uses AI. Check for mistakes.
exit 1
fi
fi
10 changes: 10 additions & 0 deletions system_files/shared/usr/share/applications/bbrew.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Name=Bold Brew
Comment=A terminal UI for managing Homebrew packages and casks
Exec=/usr/libexec/bbrew-launch
Icon=bbrew
Terminal=true
Type=Application
Categories=Development;System;
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The Categories field is missing a semicolon at the end. According to the Desktop Entry Specification, list values should end with a semicolon. This should be Categories=Development;System; to properly conform to the specification.

Copilot uses AI. Check for mistakes.
Keywords=homebrew;brew;package
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

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

The Keywords field is missing a semicolon at the end. According to the Desktop Entry Specification, list values should end with a semicolon. This should be Keywords=homebrew;brew;package; to properly conform to the specification.

Suggested change
Keywords=homebrew;brew;package
Keywords=homebrew;brew;package;

Copilot uses AI. Check for mistakes.
StartupNotify=false
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.