fix: harden native store handoffs

This commit is contained in:
Kurt Himebauch committed 2026-10-28 19:04:31 -04:00
1 parent ab7390e844
commit 090b87c37c
16 files changed
+161 -68

No files matched your search

@@ -1074,8 +1074,8 @@ def handle(agent_dir, req):
return steam_selection(agent_dir, request_timeout(req, 5))
if kind == "steam-url":
url = req.get("url")
if not isinstance(url, str) or not re.fullmatch(
r"steam://(?:open/downloads|uninstall/[1-9][0-9]{0,9})", url):
match = re.fullmatch(r"steam://(?:open/downloads|uninstall/([1-9][0-9]{0,9}))", url) if isinstance(url, str) else None
if match is None or (match.group(1) is not None and int(match.group(1)) > 0xFFFFFFFF):
raise AgentError("INVALID_REQUEST", "Steam navigation URL is not supported")
wait_for_steam_ui(agent_dir, req.get("timeout", 120))
try:
@@ -125,6 +125,9 @@ nap() {
[ -n "${bl_nap_fd:-}" ] || exec {bl_nap_fd}<> <(:)
read -r -t "$1" -u "$bl_nap_fd" _ 2>/dev/null || :
}
steam_uninstall_id_valid() {
[[ ${1:-} =~ ^[1-9][0-9]{0,9}$ ]] && [ "$1" -le 4294967295 ]
}
export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}
@@ -1176,13 +1179,12 @@ BUSCONF
if [ -f "$BL_LAUNCH_DIR/steam-uninstall" ]; then
uninstall_id=$(cat "$BL_LAUNCH_DIR/steam-uninstall" 2>/dev/null)
rm -f "$BL_LAUNCH_DIR/steam-uninstall"
case $uninstall_id in
''|0*|*[!0-9]*|???????????*) echo "== steam: ignored invalid uninstall request" ;;
*)
echo "== steam: opening the uninstall dialog for $uninstall_id"
"${steam_client[@]}" "steam://uninstall/$uninstall_id" >/dev/null 2>&1 &
;;
esac
if steam_uninstall_id_valid "$uninstall_id"; then
echo "== steam: opening the uninstall dialog for $uninstall_id"
"${steam_client[@]}" "steam://uninstall/$uninstall_id" >/dev/null 2>&1 &
else
echo "== steam: ignored invalid uninstall request"
fi
fi
if [ -f "$BL_LAUNCH_DIR/steam-game" ]; then
game_id=$(cat "$BL_LAUNCH_DIR/steam-game" 2>/dev/null)