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

dir: Set up the apply_extra sandbox like flatpak-run --sandbox #5466

Merged
merged 1 commit into from
Jul 3, 2023
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
15 changes: 11 additions & 4 deletions common/flatpak-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -8328,15 +8328,22 @@ apply_extra_data (FlatpakDir *self,
"--cap-drop", "ALL",
NULL);

/* Might need multiarch in apply_extra (see e.g. #3742).
* Should be pretty safe in this limited context */
run_flags = (FLATPAK_RUN_FLAG_MULTIARCH |
/* Run flags which equal flatpak run --sandbox */
run_flags = (FLATPAK_RUN_FLAG_SANDBOX |
FLATPAK_RUN_FLAG_NO_SESSION_HELPER |
FLATPAK_RUN_FLAG_NO_PROC |
FLATPAK_RUN_FLAG_NO_SESSION_BUS_PROXY |
FLATPAK_RUN_FLAG_NO_SYSTEM_BUS_PROXY |
FLATPAK_RUN_FLAG_NO_A11Y_BUS_PROXY);

/* Might need multiarch in apply_extra (see e.g. #3742).
* Should be pretty safe in this limited context. */
run_flags |= FLATPAK_RUN_FLAG_MULTIARCH;

/* This sandbox is run as root and /proc/self/exe can sometimes be used to
* access outside files (see cd21428).
* Disable /proc entirely in this context. */
run_flags |= FLATPAK_RUN_FLAG_NO_PROC;

if (!flatpak_run_setup_base_argv (bwrap, runtime_files, NULL, runtime_arch,
run_flags, error))
return FALSE;
Expand Down