Currently we don’t have proper whitespace handling.
bash -c "
bwrap \
--ro-bind /bin /bin \
...
--ro-bind ${main_app_dir}/machine-id /etc/machine-id \
...
10< <(getent passwd root ${app_user} nobody) \
11< <(getent group root ${app_user} nobody) \
12< ${seccomp_filter} \
${bwrap_args} \
${wrapper_script} ${@}"
User names or folder names with white spaces wouldn’t work, but we don’t have these and check that there are no such characters.
Arguments however ${@}
would be broken. Such as
sandbox-app-launcher start vlc "my video"
would break. That would result in VLC trying to open a file my
and a file video
.
It could be made to work similar to: proper whitespace handling · Kicksecure/apparmor-profile-everything@d3eccd4 · GitHub
But since the brwap command is very lengthy, that would be rather ugly.
I guess we couldn’t even use
command+=("--ro-bind /bin /bin")
command+=("--ro-bind /usr/bin /usr/bin")
...
Because that would be interpreted as:
‘–ro-bind /bin /bin’
And not as intended as:
–ro-bind /bin /bin
However, the following would probably work
command+=("--ro-bind")
command+=("/bin")
command+=("/bin")
...
bash -c "${command[@]}"
but make code look much worse. (60 lines of bwrap command would become I guestimate 180 lines.)
The issue comes from bash subshell opening with another double quote bash -c "
:
sudo \
...
bash -c "
bwrap \
...
--seccomp 12 \
10< <(getent passwd root ${app_user} nobody) \
11< <(getent group root ${app_user} nobody) \
12< ${seccomp_filter} \
${bwrap_args} \
${wrapper_script} ${@}"
Do you think it would be a good idea to move that into its own /usr/share/sandbox-app-launcher/bwrap-wrapper
script? Then I believe whitespace handling could be easily fixed.
(No need for command+=("--ro-bind")
or "${command[@]}"
.)