Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize app_name before anything else and fix app_path #25

Merged
merged 2 commits into from Apr 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions usr/bin/sandbox-app-launcher
Expand Up @@ -5,15 +5,21 @@

set -e

app_name="${1}"
shift 1

if ! [[ "${app_name}" =~ [0-9a-zA-Z/] ]]; then
echo "ERROR: Invalid character."
exit 1
fi

main_app_dir="/usr/share/sandbox-app-launcher"
auto_dir="/var/cache/sandbox-app-launcher-autogenerated"
symlink_dir="${auto_dir}/symlinks"
appdata_dir="/home/sandbox-app-launcher-appdata"
app_name="${1}"
shift 1
app_user="sandbox-${app_name}"
app_homedir="${appdata_dir}/${app_name}"
app_path="$(type -P "${app_name}")"
app_path="$(type -P "${app_name}" || true)"
seccomp_filter="${auto_dir}/seccomp-filter.bpf"
wx_whitelist="${main_app_dir}/wx_whitelist"
shared_dir="/shared"
Expand All @@ -35,11 +41,6 @@ if ! [ "$(id -u)" = "0" ]; then
exit 1
fi

if ! [[ "${app_name}" =~ [0-9a-zA-Z/] ]]; then
echo "ERROR: Invalid character."
exit 1
fi

if [ -f "/etc/sandbox-app-launcher/${app_name}.conf" ]; then
. "/etc/sandbox-app-launcher/${app_name}.conf"
fi
Expand Down