From 8abf726f043994c23b78d81c5733ebd459fd90cc Mon Sep 17 00:00:00 2001 From: RagavRida Date: Fri, 24 Apr 2026 00:04:30 +0530 Subject: [PATCH] fix(build-app): escape sed replacement metachars in Chromium rebrand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit build-app.sh injects \$APP_NAME directly into the replacement half of sed's s/// when patching Chromium's localized InfoPlist.strings. If \$APP_NAME ever carries '/', '&', or '\\' — the command either breaks or starts interpreting input as sed syntax. The trailing '|| true' would then silently hide the failure and ship a DMG that still says 'Google Chrome for Testing' in the menu bar. Escape replacement metachars before substitution. No change for the default name 'GStack Browser'. --- scripts/build-app.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 1c7b0c303..90ba8a748 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -94,7 +94,9 @@ if [ -f "$CHROMIUM_PLIST" ]; then if [ -f "$CHROMIUM_STRINGS" ]; then # InfoPlist.strings may be binary plist, convert to xml first plutil -convert xml1 "$CHROMIUM_STRINGS" 2>/dev/null || true - sed -i '' "s/Google Chrome for Testing/$APP_NAME/g" "$CHROMIUM_STRINGS" 2>/dev/null || true + # Escape sed replacement metachars (& / \) in $APP_NAME so unusual names can't break or inject into the s/// command. + APP_NAME_SED_ESCAPED=$(printf '%s' "$APP_NAME" | sed 's/[&/\]/\\&/g') + sed -i '' "s/Google Chrome for Testing/${APP_NAME_SED_ESCAPED}/g" "$CHROMIUM_STRINGS" 2>/dev/null || true fi # Replace Chromium's icon with ours so the Dock shows the GStack icon # (Chromium's process owns the Dock icon, not our launcher)