Syndicate

Syndicate content

Flattr


Flattr this

If you like this, you can use flattr. ;)

Imprint

About
eMail: wishinet at gmail . com
PGP ID: 0xCCCA5E74

Jabber: wishi@jabber.ccc.de

Tags for this post

Safari Sandbox 0.2

txttxt

A slight update

Here's a slight update on my sandbox-exec script for Safari 4.x. I prefer Safari for browsing for numerous reasons, however as a security minded individual I couldn't stand the access-permissions Safari by default has.

  1. #009900;">(version #0000dd;">1#009900;">)
  2. #009900;">(debug deny#009900;">) #339933;">; Use #009900;">(debug all#009900;">) to see every action#009900;">)
  3. #009900;">(allow network#339933;">-outbound#009900;">)
  4. #009900;">(allow signal#009900;">)
  5. #009900;">(allow ipc#339933;">-posix#339933;">-shm#009900;">) #339933;">; Needed #b1b100;">for POSIX shared memory
  6. #339933;">;; #b1b100;">if that is your Safari path
  7. #339933;">;#009900;">(allow process#339933;">-exec #009900;">(regex #339933;">#"^/Applications/Safari.app/*"))
  8. #009900;">(allow sysctl#339933;">-read#009900;">)
  9. #009900;">(allow file#339933;">-read#339933;">-metadata#009900;">)
  10. #009900;">(allow signal#009900;">)
  11. #009900;">(allow process#339933;">*#009900;">)
  12. #339933;">;#009900;">(allow mach#339933;">*#009900;">)
  13. #009900;">(allow mach#339933;">-lookup#009900;">)
  14. #339933;">;#009900;">(allow process#339933;">-exec #009900;">(regex #ff0000;">"^/System/Library/CoreServices/*"#009900;">)#009900;">)
  15. #339933;">;;
  16. #339933;">;; This is the most important part
  17. #339933;">;; Allow to read these files#339933;">:
  18. #339933;">;;
  19. #009900;">(allow file#339933;">-read#339933;">*
  20. #009900;">(regex
  21. #339933;">#"^/Users/YOUR_HOME/$"
  22. #339933;">#"^/Users/YOUR_HOME/downloads"
  23. #339933;">#"^/place_your_downloads-folder_here"
  24. #339933;">#"^/Users/YOUR_HOMES/Library"
  25. #339933;">#"^/Users/YOUR_HOMES/Public"
  26. #339933;">#"^/Users/YOUR_HOMES/Sites"
  27. #339933;">#"^/Applications/Safari.app"
  28. #339933;">#"^/Library/*"
  29. #339933;">#"^/System/Library/*"
  30. #339933;">#"^/usr/lib/*"
  31. #339933;">#"^/usr/share/*"
  32. #339933;">#"^/private/*"
  33. #339933;">#"^/dev/*"
  34. #339933;">;; entirely optional #339933;">- but I use some Safari hacks
  35. #339933;">#"^/Library/Application Support/SIMBL/Plugins/*"
  36. #339933;">#"^/Library/Application Support/Glims/*"
  37. #339933;">#"^/Library/Application Support/Glims/PlugIns/Glims.bundle/Contents/MacOS/*"
  38. #339933;">#"^/Users/YOUR_HOME/Library/Internet Plug-Ins/*"
  39. #339933;">#"^/Library/Internet Plug-Ins/*"
  40. #339933;">#"^/Library/InputManagers/*"
  41. #339933;">#"^/Applications/1Password.app"
  42. #339933;">#"^/Applications/Evernote.app/Contents/*"
  43. #339933;">#"^/Users/YOUR_HOME/Library/Application Support/Evernote/*"
  44. #009900;">)
  45. #009900;">)
  46. #339933;">;; Allow to write these files#339933;">:
  47. #009900;">(allow file#339933;">-write#339933;">*
  48. #009900;">(regex
  49. #339933;">#"^/Users/YOUR_HOME/Downloads/*"
  50. #339933;">#"^/Users/YOUR_HOME/Library/.*"
  51. #339933;">#"^/private/var/*"
  52. #339933;">#"^/dev/dtracehelper"
  53. #339933;">;; well... #202020;">that is how it works at least
  54. #339933;">#"^/Library/Application Support/SIMBL/Plugins/*"
  55. #339933;">#"^/Library/Application Support/Glims/PlugIns/Glims.bundle/Contents/MacOS/*"
  56. #339933;">#"^/Users/YOUR_HOME/Library/Application Support/Evernote/*"
  57. #009900;">)
  58. #009900;">)
  59. #009900;">(deny #b1b100;">default#009900;">)

The Applescript code still is:

  1. #b1b100;">do shell script #ff0000;">"sandbox-exec -f /Users/YOUR_HOMES/policies/sandbox-safari.sb /Applications/Safari.app/Contents/MacOS/Safari"

I considered the comments, too. However it doesn't really work. So... here we are.

Exceptions for which plugins?

The reason for the optional read/write permissions are plugins: Glims (many nice functions), PithHelmet (Cookie and JS/Java script controls similar to NoScript), AdBlock Safari, Safari Cookies, ForgetMeNot (saves sessions) and some crappy ones I don't dare to mention. Sometimes I just changed in the Info.plist:

  1. #339933;"><key#339933;">>BundleIdentifier#339933;"></key#339933;">>
  2.                         #339933;"><string#339933;">>*</string#339933;">>
  3.                         #339933;"><key#339933;">>MaxBundleVersion#339933;"></key#339933;">>
  4.                         #339933;"><string#339933;">>*</string#339933;">>
  5.                         #339933;"><key#339933;">>MinBundleVersion#339933;"></key#339933;">>
  6.                         #339933;"><string#339933;">>*</string#339933;">>

Yes... kind of nasty. However practical. :) The really important data are save from any exploit, drive-by attack or magic affecting Safari. I didn't manage to build such a policy for Firefox. Other WebKit based browsers maybe compatible.

Have fun,
wishi

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Save the nature. Don't print this!


I provide textual exports for every blog entry. However let's save the nature together. The nature is everything around us. Every being should be respected. Save the nature - don't print too much.


Die Umgehung dieser Ausdrucksperre ist nach § 95a UrhG verboten!
Inhaltlich Verantwortlicher gemäß § 10 Absatz 3 MDStV: Marius Ciepluch - Anschrift via eMail. Die eMail Adresse entnehmen sie dem Impresseum dieser englischsprachigen Seite.
Aus Datenschutzgründen habe ich weder offiziellen noch behördlichen Schriftverkehr via eMail. Dazu ist die postalische, beim Dienstleister hinterlegte, Anschrift zu verwenden.

Datenerfassung

Es werden keine personenbezogenen Daten erfasst. Logdaten werden anonymisiert.