From 15f3f2065625b05496632c1f5cf61fd150afef3c Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 19 Sep 2016 11:18:17 -0700 Subject: Prevent Accessibility access for macOS >= 10.12 See https://github.com/caskroom/homebrew-cask/issues/24519 Feel free to suggest alternative wording and such.--- Library/Homebrew/cask/lib/hbc/installer.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 72a9b3077..8c948d717 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -225,7 +225,12 @@ class Hbc::Installer def enable_accessibility_access return unless @cask.accessibility_access ohai "Enabling accessibility access" - if MacOS.version <= :mountain_lion + if MacOS.version >= :sierra + opoo <<-EOS.undent + Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. + If needed, enable manually via the app or System Preferences. + EOS + elsif MacOS.version <= :mountain_lion @command.run!("/usr/bin/touch", args: [Hbc.pre_mavericks_accessibility_dotfile], sudo: true) @@ -248,7 +253,12 @@ class Hbc::Installer def disable_accessibility_access return unless @cask.accessibility_access - if MacOS.version >= :mavericks + if MacOS.version >= :sierra + opoo <<-EOS.undent + Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. + If needed, disable manually via the app or System Preferences. + EOS + elsif MacOS.version >= :mavericks ohai "Disabling accessibility access" @command.run!("/usr/bin/sqlite3", args: [ -- cgit v1.2.3 From 169a07990372c1d3217db0a45b9457ae58edb4f5 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 20 Sep 2016 18:19:48 -0700 Subject: Make wording more similar to existing messages --- Library/Homebrew/cask/lib/hbc/installer.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 8c948d717..7037a5694 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -227,8 +227,8 @@ class Hbc::Installer ohai "Enabling accessibility access" if MacOS.version >= :sierra opoo <<-EOS.undent - Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. - If needed, enable manually via the app or System Preferences. + Accessibility access cannot be enabled automatically on this version of macOS. + See System Preferences to enable it manually. EOS elsif MacOS.version <= :mountain_lion @command.run!("/usr/bin/touch", @@ -255,8 +255,8 @@ class Hbc::Installer return unless @cask.accessibility_access if MacOS.version >= :sierra opoo <<-EOS.undent - Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. - If needed, disable manually via the app or System Preferences. + Accessibility access cannot be disabled automatically on this version of macOS. + See System Preferences to disable it manually. EOS elsif MacOS.version >= :mavericks ohai "Disabling accessibility access" -- cgit v1.2.3 From d282565bd08bacf5aa03418e26d3fe9e7b0869cb Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 21 Sep 2016 08:33:10 -0700 Subject: Improved accessibility access conditional style --- Library/Homebrew/cask/lib/hbc/installer.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 7037a5694..7c1006b8a 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -225,12 +225,7 @@ class Hbc::Installer def enable_accessibility_access return unless @cask.accessibility_access ohai "Enabling accessibility access" - if MacOS.version >= :sierra - opoo <<-EOS.undent - Accessibility access cannot be enabled automatically on this version of macOS. - See System Preferences to enable it manually. - EOS - elsif MacOS.version <= :mountain_lion + if MacOS.version <= :mountain_lion @command.run!("/usr/bin/touch", args: [Hbc.pre_mavericks_accessibility_dotfile], sudo: true) @@ -241,24 +236,29 @@ class Hbc::Installer "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL);", ], sudo: true) - else + elsif MacOS.version <= :el_capitan @command.run!("/usr/bin/sqlite3", args: [ Hbc.tcc_db, "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','#{bundle_identifier}',0,1,1,NULL,NULL);", ], sudo: true) + else + opoo <<-EOS.undent + Accessibility access cannot be enabled automatically on this version of macOS. + See System Preferences to enable it manually. + EOS end end def disable_accessibility_access return unless @cask.accessibility_access - if MacOS.version >= :sierra + if MacOS.version <= :mountain_lion opoo <<-EOS.undent - Accessibility access cannot be disabled automatically on this version of macOS. - See System Preferences to disable it manually. + Accessibility access was enabled for #{@cask}, but it is not safe to disable + automatically on this version of macOS. See System Preferences. EOS - elsif MacOS.version >= :mavericks + elsif MacOS.version <= :el_capitan ohai "Disabling accessibility access" @command.run!("/usr/bin/sqlite3", args: [ @@ -268,8 +268,8 @@ class Hbc::Installer sudo: true) else opoo <<-EOS.undent - Accessibility access was enabled for #{@cask}, but it is not safe to disable - automatically on this version of macOS. See System Preferences. + Accessibility access cannot be disabled automatically on this version of macOS. + See System Preferences to disable it manually. EOS end end -- cgit v1.2.3 From 3c31e29d5c46720ed51b7a75a863e2ff4577439f Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 21 Sep 2016 10:56:26 -0700 Subject: Simplify accessibility access disable warnings --- Library/Homebrew/cask/lib/hbc/installer.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index 7c1006b8a..e3e83eff2 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -253,12 +253,7 @@ class Hbc::Installer def disable_accessibility_access return unless @cask.accessibility_access - if MacOS.version <= :mountain_lion - opoo <<-EOS.undent - Accessibility access was enabled for #{@cask}, but it is not safe to disable - automatically on this version of macOS. See System Preferences. - EOS - elsif MacOS.version <= :el_capitan + if MacOS.version >= :mavericks && MacOS.version <= :el_capitan ohai "Disabling accessibility access" @command.run!("/usr/bin/sqlite3", args: [ -- cgit v1.2.3 From b63f024b0788df0ea79d031f2c3cf6a140846387 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 22 Sep 2016 22:25:12 -0700 Subject: Updated accessibility test for Sierra --- .../Homebrew/cask/test/cask/accessibility_test.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/test/cask/accessibility_test.rb b/Library/Homebrew/cask/test/cask/accessibility_test.rb index ee192b4cb..eeb76f01d 100644 --- a/Library/Homebrew/cask/test/cask/accessibility_test.rb +++ b/Library/Homebrew/cask/test/cask/accessibility_test.rb @@ -22,8 +22,7 @@ describe "Accessibility Access" do @installer.enable_accessibility_access end end - - it "can enable accessibility access in OS X releases prior to Mavericks" do + it "can enable accessibility access in macOS releases prior to Mavericks" do MacOS.stubs(version: MacOS::Version.new("10.8")) Hbc::FakeSystemCommand.expects_command( @@ -33,6 +32,14 @@ describe "Accessibility Access" do @installer.enable_accessibility_access end end + it "warns about enabling accessibility access on new macOS releases" do + MacOS.stubs(version: MacOS::Version.new("10.12")) + + @installer.stubs(bundle_identifier: "com.example.BasicCask") + + capture_io { @installer.enable_accessibility_access }[1] + .must_match("Warning: Accessibility access cannot be enabled automatically on this version of macOS.") + end end describe "uninstall" do @@ -48,7 +55,7 @@ describe "Accessibility Access" do @installer.disable_accessibility_access end end - it "warns about disabling accessibility access on old OS X releases" do + it "warns about disabling accessibility access on old macOS releases" do MacOS.stubs(version: MacOS::Version.new("10.8")) @installer.stubs(bundle_identifier: "com.example.BasicCask") @@ -56,5 +63,13 @@ describe "Accessibility Access" do capture_io { @installer.disable_accessibility_access }[1] .must_match("Warning: Accessibility access was enabled for with-accessibility-access, but it is not safe to disable") end + it "warns about disabling accessibility access on new macOS releases" do + MacOS.stubs(version: MacOS::Version.new("10.12")) + + @installer.stubs(bundle_identifier: "com.example.BasicCask") + + capture_io { @installer.disable_accessibility_access }[1] + .must_match("Warning: Accessibility access cannot be disabled automatically on this version of macOS.") + end end end -- cgit v1.2.3 From 741e68766368b4ad18120a81b2180743790b529e Mon Sep 17 00:00:00 2001 From: Josh Hagins Date: Fri, 23 Sep 2016 10:28:15 -0500 Subject: accessibility_test: fix warning message --- Library/Homebrew/cask/test/cask/accessibility_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/cask/test/cask/accessibility_test.rb b/Library/Homebrew/cask/test/cask/accessibility_test.rb index eeb76f01d..8da8937fe 100644 --- a/Library/Homebrew/cask/test/cask/accessibility_test.rb +++ b/Library/Homebrew/cask/test/cask/accessibility_test.rb @@ -61,7 +61,7 @@ describe "Accessibility Access" do @installer.stubs(bundle_identifier: "com.example.BasicCask") capture_io { @installer.disable_accessibility_access }[1] - .must_match("Warning: Accessibility access was enabled for with-accessibility-access, but it is not safe to disable") + .must_match("Warning: Accessibility access cannot be disabled automatically on this version of macOS.") end it "warns about disabling accessibility access on new macOS releases" do MacOS.stubs(version: MacOS::Version.new("10.12")) -- cgit v1.2.3