SlideShare a Scribd company logo
Escaping)the
Mac$App$Sandbox
(or$at$least$a$small$part$of$it)
Ma#$Welch
Developer(working(on(iOS,(Mac,(and(node(
apps(by(night,(and(on(the(Force.com(
pla=orm(by(day.
ma#@welcher.net
@_Ma#Welch_
h#p://ma#wel.ch
Bearings
What%is%the%Mac%App%Sandbox?
App#Sandbox!is!an!access!control!technology!provided!in!OS!X,!
enforced!at!the!kernel!level.!Its!strategy!is!twofold:
• App$Sandbox$enables$you$to$describe$how$your$app$interacts$
with$the$system.$The$system$then$grants$your$app$the$access$it$
needs$to$get$its$job$done,$and$no$more.
• App$Sandbox$allows$the$user$to$transparently$grant$your$app$
addi=onal$access$by$way$of$Open$and$Save$dialogs,$drag$and$
drop,$and$other$familiar$user$interac=ons.
(From&the&Apple&"App&Sandbox&Design&Guide")
Sandbox(Filesystem(Limita2ons
Specifically,+sandboxing+limits+an+app+to+only+those+files+or+
directories+explicitly+opened+by+the+user.
For$most$cases$this$is$OK.$(In$fact,$Deckset$here$regularly$asks$
permission$to$access$a$photo$I$want$to$use$that's$on$my$filesystem.)
Temporary)Files
The$problem$is$that$temporary$files$are$
supposed$to$be$invisible$to$the$end$user.
What%kind%of%experience%would%this%be?
Now$mul(ply$this$bad$experience$by$10.$
Or$100.$Or$however$many$hundreds$of$
photos$(in$the$case$of$Bearings$app)$that$
need$to$be$processed.
Workaround:*File*Presenters
File%Presenters?
Yes,%File%Presenters.
• Around(since(10.7,(File(Presenters((and(their("parents"(File(
Coordinators)(have(made(working(with(the(file(system(in(a(mulDE
threaded,(mulDEprocessing(environment(easier(and(safer.
Yes,%File%Presenters.
• Around(since(10.7,(File(Presenters((and(their("parents"(File(
Coordinators)(have(made(working(with(the(file(system(in(a(mulDE
threaded,(mulDEprocessing(environment(easier(and(safer.
Yes,%File%Presenters.
• Around(since(10.7,(File(Presenters((and(their("parents"(File(
Coordinators)(have(made(working(with(the(file(system(in(a(mulDE
threaded,(mulDEprocessing(environment(easier(and(safer.
Yes,%File%Presenters.
• Around(since(10.7,(File(Presenters((and(their("parents"(File(
Coordinators)(have(made(working(with(the(file(system(in(a(mulDE
threaded,(mulDEprocessing(environment(easier(and(safer.
Yes,%File%Presenters.
• Around(since(10.7,(File(Presenters((and(their("parents"(File(
Coordinators)(have(made(working(with(the(file(system(in(a(mulDE
threaded,(mulDEprocessing(environment(easier(and(safer.
Implemen'ng)File)Presenters)for)Related)
Items
Apple%has%repurposed%File%Presenters%to%enable%"Related%Items"%in%
sandboxed%apps.
Related'Items
• Must&have&the&same&name&(minus&extension)&as&the&item&to&
which&they&are&related
• Must&have&a&known9ahead9of9;me&extension
Implemen'ng)File)Presenters)for)Related)
Items
Create&a&class&that&conforms&the&the&NSFilePresenter&protocol.&
Implement&these&methods:
1. primaryPresentedItemURL#–#The#URL#for#the#original#file
2. primaryItemURL#–#the#URL#for#the#temporary#file#(the#same#as#
above,#but#with#different#extension)
3. presentedItemOperationQueue#–#the#queue#on#which#the#
app#will#perform#file#presentaGon#tasks
WRFilePresenter
// WRFilePresenter.m
// Bearings
//
// Created by Matt Welch on 3/17/14.
//
#import "WRFilePresenter.h"
@implementation WRFilePresenter
{
NSOperationQueue* queue;
NSURL* pFileURL;
NSURL* tFileURL;
}
- (id) init {
self = [super init];
if (self) {
queue = [NSOperationQueue new];
[NSFileCoordinator addFilePresenter:self];
}
return self;
}
- (NSURL*) primaryPresentedItemURL {
return pFileURL;
}
- (NSURL *) presentedItemURL {
return tFileURL;
}
- (NSOperationQueue*) presentedItemOperationQueue {
return queue;
}
-(void) setURLs:(NSURL*)url {
pFileURL=url;
NSString *fURLS=[url absoluteString];
NSString *fURLSt=[NSString stringWithFormat:@"%@%@",fURLS,@"_temp_file_extension" ];
NSURL *surl = [NSURL URLWithString:fURLSt];
tFileURL=surl;
}
@end
Implemen'ng)File)Presenters
Given&a&file&with&a&url&of&realFileURL,&implement&a&presenter&for&
it:
WRFilePresenter *filePresenter=[[WRFilePresenter alloc] init];
[filePresenter setURLs:realFileURL];
And$we're$all$set$(at$least$as$far$as$code$is$concerned).
XCode&Target&Setup
In#the#Project#Navigator,#under#the#"Info"#tab,#there#is#a#
"Documents#Type"#sec=on.
• Set%"Extension"%to%be%the%known%temporary%file%extension.
• Add%NSIsRelatedItemType%of%type%Boolean%to%"Addi<onal%
document%type%proper<es"%and%set%it%to%YES
XCode&Target&Setup
Demo
Further'Informa.on
More%in(depth%informa0on%can%be%found%at:
h5p://ma5wel.ch/temporary(files(in(sandboxed(mac(apps/
This%presenta,on%is%on%github:
h2ps://github.com/ma2welch/mac_sandbox_tempfiles_deckset
A"ribu'ons
• happiness)from)a)sandbox)1)h2ps://www.flickr.com/photos/
celinesphotographer/326629023/
• App)Sandbox)Design)Guide)1)h2ps://developer.apple.com/
library/mac/documentaIon/Security/Conceptual/
AppSandboxDesignGuide/AboutAppSandbox/
AboutAppSandbox.html
• Paperama)1)h2ps://www.flickr.com/photos/kasaa/3103799093/

More Related Content

Similar to Escaping the Mac App Store Sandbox (or at least a small part of it)

Elixir on Containers
Elixir on ContainersElixir on Containers
Elixir on Containers
Sachirou Inoue
 
Black Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS XBlack Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS X
Synack
 
RSA OSX Malware
RSA OSX MalwareRSA OSX Malware
RSA OSX Malware
Synack
 
Hexagonal architecture - message-oriented software design
Hexagonal architecture  - message-oriented software designHexagonal architecture  - message-oriented software design
Hexagonal architecture - message-oriented software design
Matthias Noback
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
Daniel Bohannon
 
Dynamic Adaptive Streaming over HTTP: From Content Creation to Consumption
Dynamic Adaptive Streaming over HTTP: From Content Creation to ConsumptionDynamic Adaptive Streaming over HTTP: From Content Creation to Consumption
Dynamic Adaptive Streaming over HTTP: From Content Creation to ConsumptionAlpen-Adria-Universität
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
Felipe Prado
 
Building Mobile Apps with Visual Studio Tools for Apache Cordova
Building Mobile Apps with Visual Studio Tools for Apache CordovaBuilding Mobile Apps with Visual Studio Tools for Apache Cordova
Building Mobile Apps with Visual Studio Tools for Apache Cordova
matthoneycutt
 
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
Ontico
 
Be a microservices hero
Be a microservices heroBe a microservices hero
Be a microservices hero
OpenRestyCon
 
Úvod do programování 7
Úvod do programování 7Úvod do programování 7
Úvod do programování 7
Karel Minarik
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
Himanshu Kumar Das
 
ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices Hero
Dragos Dascalita
 
Advanced Mac Software Deployment and Configuration: Just Make It Work!
Advanced Mac Software Deployment and Configuration: Just Make It Work!Advanced Mac Software Deployment and Configuration: Just Make It Work!
Advanced Mac Software Deployment and Configuration: Just Make It Work!
Timothy Sutton
 
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
Defcon 22-colby-moore-patrick-wardle-synack-drop camDefcon 22-colby-moore-patrick-wardle-synack-drop cam
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
Priyanka Aash
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Codemotion
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
Lindsay Holmwood
 
20160225 OWASP Atlanta Prevoty RASP
20160225 OWASP Atlanta Prevoty RASP20160225 OWASP Atlanta Prevoty RASP
20160225 OWASP Atlanta Prevoty RASP
chadtindel
 
Device deployment
Device deploymentDevice deployment
Device deployment
Angelo van der Sijpt
 

Similar to Escaping the Mac App Store Sandbox (or at least a small part of it) (20)

Elixir on Containers
Elixir on ContainersElixir on Containers
Elixir on Containers
 
Black Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS XBlack Hat '15: Writing Bad @$$ Malware for OS X
Black Hat '15: Writing Bad @$$ Malware for OS X
 
RSA OSX Malware
RSA OSX MalwareRSA OSX Malware
RSA OSX Malware
 
Hexagonal architecture - message-oriented software design
Hexagonal architecture  - message-oriented software designHexagonal architecture  - message-oriented software design
Hexagonal architecture - message-oriented software design
 
Revoke-Obfuscation
Revoke-ObfuscationRevoke-Obfuscation
Revoke-Obfuscation
 
Dynamic Adaptive Streaming over HTTP: From Content Creation to Consumption
Dynamic Adaptive Streaming over HTTP: From Content Creation to ConsumptionDynamic Adaptive Streaming over HTTP: From Content Creation to Consumption
Dynamic Adaptive Streaming over HTTP: From Content Creation to Consumption
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
 
Building Mobile Apps with Visual Studio Tools for Apache Cordova
Building Mobile Apps with Visual Studio Tools for Apache CordovaBuilding Mobile Apps with Visual Studio Tools for Apache Cordova
Building Mobile Apps with Visual Studio Tools for Apache Cordova
 
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
Climbing out from the digital mud with unikernels / Ian Eyberg (DeferPanic)
 
Be a microservices hero
Be a microservices heroBe a microservices hero
Be a microservices hero
 
Learn C Programming Language by Using GDB
Learn C Programming Language by Using GDBLearn C Programming Language by Using GDB
Learn C Programming Language by Using GDB
 
Úvod do programování 7
Úvod do programování 7Úvod do programování 7
Úvod do programování 7
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
 
ContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices HeroContainerCon 2015 - Be a Microservices Hero
ContainerCon 2015 - Be a Microservices Hero
 
Advanced Mac Software Deployment and Configuration: Just Make It Work!
Advanced Mac Software Deployment and Configuration: Just Make It Work!Advanced Mac Software Deployment and Configuration: Just Make It Work!
Advanced Mac Software Deployment and Configuration: Just Make It Work!
 
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
Defcon 22-colby-moore-patrick-wardle-synack-drop camDefcon 22-colby-moore-patrick-wardle-synack-drop cam
Defcon 22-colby-moore-patrick-wardle-synack-drop cam
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
20160225 OWASP Atlanta Prevoty RASP
20160225 OWASP Atlanta Prevoty RASP20160225 OWASP Atlanta Prevoty RASP
20160225 OWASP Atlanta Prevoty RASP
 
Device deployment
Device deploymentDevice deployment
Device deployment
 

Recently uploaded

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 

Recently uploaded (20)

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 

Escaping the Mac App Store Sandbox (or at least a small part of it)