You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
portal: --env-fd can collide with fds passed across D-Bus #4286
1.10.0+ (regression in aeb6a7a), 1.8.5+, and distro versions with aeb6a7a backported
Description of the problem
The --env-fd created for flatpak run by flatpak-portal can collide with fds from --forward-fd. If it does, flatpak run will try to read environment variables from one of the fds from --forward-fd instead of from the intended temporary file.
[📦 any app ~]$ for i in $(seq 20 30); do eval "exec $i</dev/null"; done
[📦 any app ~]$ command="flatpak-spawn --env=FOO=bar"
[📦 any app ~]$ $command sh -c 'echo $FOO'
bar
[📦 any app ~]$ for i in $(seq 20 30); do command="$command --forward-fd=$i"; done
[📦 any app ~]$ $command sh -c 'echo $FOO'
The range 20 to 30 is arbitrary, and you might need to adjust it; it needs to be something that is going to include whatever happens to be first free file descriptor for use by --env-fd.
Mitigation
#4285 makes this harder to reproduce, because it makes the --env-fd get larger until it goes beyond the range of reasonable fds.
Activity
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Add some design-for-test
portal: Add some test coverage
portal: Add some design-for-test
portal: Add some test coverage
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Add some design-for-test
portal: Add some test coverage
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Add some design-for-test
portal: Add some test coverage
7 remaining items
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space
portal: Use a GArray to store fds
portal: Remap --env-fd into child process's fd space