Skip to content

Commit

Permalink
build: Convert environment into a sequence of bwrap arguments
Browse files Browse the repository at this point in the history
This means we can systematically pass the environment variables
through bwrap(1), even if it is setuid and thus is filtering out
security-sensitive environment variables. bwrap itself ends up being
run with an empty environment instead.

This fixes a regression when CVE-2021-21261 was fixed: before the
CVE fixes, LD_LIBRARY_PATH would have been passed through like this
and appeared in the `flatpak build` shell, but during the CVE fixes,
the special case that protected LD_LIBRARY_PATH was removed in favour
of the more general flatpak_bwrap_envp_to_args(). That reasoning only
works if we use flatpak_bwrap_envp_to_args(), consistently, everywhere
that we run the potentially-setuid bwrap.

Fixes: 6d1773d "run: Convert all environment variables into bwrap arguments"
Resolves: #4080
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980323
Signed-off-by: Simon McVittie <smcv@collabora.com>
  • Loading branch information
smcv authored and alexlarsson committed Jan 21, 2021
1 parent 06869af commit 9a61d2c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/flatpak-builtins-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
NULL);
}

flatpak_bwrap_envp_to_args (bwrap);

if (!flatpak_bwrap_bundle_args (bwrap, 1, -1, FALSE, error))
return FALSE;

Expand Down

0 comments on commit 9a61d2c

Please sign in to comment.