If the sticky bit is set on the parent directory of the workspace,
it's inherited by the workspace directory and then inherited by the
image root directory and infects the entire image. Let's make sure
it is not set on the workspace directory to avoid leaking host specific
details into the image.
def setup_workspace(args: Args, config: Config) -> Iterator[Path]:
with contextlib.ExitStack() as stack:
workspace = Path(tempfile.mkdtemp(dir=config.workspace_dir_or_default(), prefix="mkosi-workspace"))
+ os.chmod(workspace, 0o700)
stack.callback(lambda: rmtree(workspace, tools=config.tools(), sandbox=config.sandbox))
(workspace / "tmp").mkdir(mode=0o1777)