[tor-commits] [sandboxed-tor-browser/master] Bug 21928: Force a reinstall if an existing hardened bundle is present.
yawning at torproject.org
yawning at torproject.org
Wed Apr 12 19:36:40 UTC 2017
commit aeb2c854b90370fce26e36188186efb48e2eb8e0
Author: Yawning Angel <yawning at schwanenlied.me>
Date: Wed Apr 12 19:35:00 2017 +0000
Bug 21928: Force a reinstall if an existing hardened bundle is present.
If an existing hardened bundle is detected, a `Cancel`/`Ok` prompt is
displayed, and on the user clicking `Ok` the install process is started.
---
ChangeLog | 1 +
src/cmd/sandboxed-tor-browser/internal/ui/gtk/ui.go | 20 ++++++++++++++++++++
src/cmd/sandboxed-tor-browser/internal/ui/ui.go | 9 ++++++++-
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index e623392..f289b6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
Changes in version 0.0.4 - UNRELEASED:
+ * Bug 21928: Force a reinstall if an existing hardened bundle is present.
* Bug 21929: Remove hardened/ASAN related code.
* Bug 21927: Remove the ability to install/update the hardened bundle.
* Bug 21244: Update the MAR signing key for 7.0.
diff --git a/src/cmd/sandboxed-tor-browser/internal/ui/gtk/ui.go b/src/cmd/sandboxed-tor-browser/internal/ui/gtk/ui.go
index 7a6624c..55ee89a 100644
--- a/src/cmd/sandboxed-tor-browser/internal/ui/gtk/ui.go
+++ b/src/cmd/sandboxed-tor-browser/internal/ui/gtk/ui.go
@@ -70,6 +70,17 @@ func (ui *gtkUI) Run() error {
log.Printf("ui: libnotify wasn't found, no desktop notifications possible")
}
+ if ui.WasHardened {
+ log.Printf("ui: Previous `hardened` bundle detected")
+
+ ok := ui.ask("The hardened bundle has been discontinued, and the installation of a supported bundle is required.\n\nWARNING: The install process will delete the existing bundle, including bookmarks and downloads. Backup all data you wish to preserve before continuing.")
+ if !ok {
+ log.Printf("ui: User denied `hardened` bundle overwrite")
+ return nil
+ }
+ log.Printf("ui: User confirmed `hardened` bundle overwrite")
+ }
+
if ui.NeedsInstall() || ui.ForceInstall {
for {
if !ui.installDialog.run() {
@@ -330,6 +341,15 @@ func (ui *gtkUI) bitch(format string, a ...interface{}) {
ui.forceRedraw()
}
+func (ui *gtkUI) ask(format string, a ...interface{}) bool {
+ md := gtk3.MessageDialogNew(ui.mainWindow, gtk3.DIALOG_MODAL, gtk3.MESSAGE_QUESTION, gtk3.BUTTONS_OK_CANCEL, format, a...)
+ result := md.Run()
+ md.Hide()
+ ui.forceRedraw()
+
+ return result == int(gtk3.RESPONSE_OK)
+}
+
func (ui *gtkUI) notifyUpdate(update *installer.UpdateEntry) {
if update == nil {
panic("ui: notifyUpdate called with no update metadata")
diff --git a/src/cmd/sandboxed-tor-browser/internal/ui/ui.go b/src/cmd/sandboxed-tor-browser/internal/ui/ui.go
index c3882ad..899104b 100644
--- a/src/cmd/sandboxed-tor-browser/internal/ui/ui.go
+++ b/src/cmd/sandboxed-tor-browser/internal/ui/ui.go
@@ -67,7 +67,7 @@ const (
// bridges.
DefaultBridgeTransport = "obfs4"
- // chanHardened = "hardened"
+ chanHardened = "hardened"
)
func usage() {
@@ -111,6 +111,7 @@ type Common struct {
NoKillTor bool
AdvancedConfig bool
PrintVersion bool
+ WasHardened bool
}
// Init initializes the common interface state.
@@ -145,6 +146,12 @@ func (c *Common) Init() error {
return err
}
}
+
+ // #21928: Force a reinstall if an existing hardened bundle is present.
+ if c.Manif.Channel == chanHardened {
+ c.ForceInstall = true
+ c.WasHardened = true
+ }
}
return c.Cfg.Sync()
}
More information about the tor-commits
mailing list