Clean environment variables to account for sandbox work directory.
Unset HOME to prevent username leak.
Bug: 363037195
Change-Id: I7a8694f746d58de8f6e41adb6ad52abbaf955ef4
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index d9ca854..6c46000 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -187,8 +187,17 @@
return args
}
+func (c *Cmd) workDir() string {
+ if !c.config.UseABFS() {
+ wd, _ := os.Getwd()
+ return wd
+ }
+
+ return abfsSrcDir
+}
+
func (c *Cmd) wrapSandbox() {
- wd, _ := os.Getwd()
+ wd := c.workDir()
var sandboxArgs []string
sandboxArgs = append(sandboxArgs,
@@ -226,7 +235,7 @@
)
sandboxArgs = append(sandboxArgs,
- c.readMountArgs()...
+ c.readMountArgs()...,
)
sandboxArgs = append(sandboxArgs,