[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41050: Improve disk leak sanitization on startup.

ma1 (@ma1) git at gitlab.torproject.org
Tue Dec 19 09:23:36 UTC 2023



ma1 pushed to branch main at The Tor Project / Applications / tor-browser-build


Commits:
5a97ba07 by hackademix at 2023-12-19T10:22:07+01:00
Bug 41050: Improve disk leak sanitization on startup.

- - - - -


1 changed file:

- projects/browser/RelativeLink/start-browser


Changes:

=====================================
projects/browser/RelativeLink/start-browser
=====================================
@@ -258,18 +258,32 @@ HOME="${PWD}"
 export HOME
 
 # Prevent disk leaks in $HOME/.local/share (tor-browser#17560)
+function erase_leaky() {
+	local leaky="$1"
+	[ -e "$leaky" ] &&
+	( srm -r "$leaky" ||
+	  wipe -r "$leaky" ||
+	  find "$leaky" -type f -exec shred -u {} \; ;
+	  rm -rf "$leaky"
+	) > /dev/null 2>&1
+}
 local_dir="$HOME/.local/"
 share_dir="$local_dir/share"
-if [ -d "$share_dir" ]; then
-    ( srm -r "$share_dir" ||
-      wipe -r "$share_dir" ||
-      find "$share_dir" -type f -exec shred -u {} \; ;
-      rm -rf "$share_dir"
-    ) > /dev/null 2>&1
-else
-    mkdir -p "$local_dir"
+# We don't want to mess with symlinks, possibly pointing outside the
+# Browser directory (tor-browser-build#41050).
+# We're not using realpath/readlink for consistency with the (possibly
+# outdated) availability assumptions made elsewhere in this script.
+if ! [ -L "$local_dir" -o -L "$share_dir" ]; then
+	if [ -d "$share_dir" ]; then
+		for leaky_path in "gvfs-metadata" "recently-used.xbel"; do
+			erase_leaky "$share_dir/$leaky_path"
+		done
+	else
+		mkdir -p "$local_dir"
+	fi
+	ln -fs /dev/null "$share_dir"
 fi
-ln -fs /dev/null "$share_dir"
+[ -L "$HOME/.cache" ] || erase_leaky "$HOME/.cache/nvidia"
 
 [% IF c("var/tor-browser") -%]
 SYSARCHITECTURE=$(getconf LONG_BIT)



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/5a97ba07148a176580dd536a65dc7ebba6565775

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/5a97ba07148a176580dd536a65dc7ebba6565775
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20231219/af8e9dbb/attachment-0001.htm>


More information about the tbb-commits mailing list