SlideShare a Scribd company logo
1 of 65
Download to read offline
Efficient Dynamic Access Analysis
Using JavaScript Proxies
DLS’13
Matthias Keil, Peter Thiemann
Institute for Computer Science
University of Freiburg
Freiburg, Germany
October 28, 2013, Indianapolis, Indiana, USA.
Motivation
92 %
of all web sites use JavaScript
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 2 / 25
Motivation
92 %
of all web sites use JavaScript
Most important client-side language for web sites
Web-developers rely on third-party libraries
e.g. for calendars, maps, social networks
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 2 / 25
Situation of a Web-developer
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
Situation of a Web-developer
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
Situation of a Web-developer
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
Situation of a Web-developer
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
Situation of a Web-developer
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
JavaScript issues
Dynamic programming language
Code is accumulated by dynamic loading
e.g. eval, mashups
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
JavaScript issues
Dynamic programming language
Code is accumulated by dynamic loading
e.g. eval, mashups
JavaScript has no security awareness
No namespace or encapsulation management
Global scope for variables/ functions
All scripts have the same authority
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
JavaScript issues
Dynamic programming language
Code is accumulated by dynamic loading
e.g. eval, mashups
JavaScript has no security awareness
No namespace or encapsulation management
Global scope for variables/ functions
All scripts have the same authority
Problems
1 Side effects may cause unexpected behavior
2 Program understanding and maintenance is difficult
3 Libraries may get access to sensitive data
User code may be prone to injection attacks
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
JSConTest
Type and effect contracts with run-time checking
JSConTest, a tool for effect monitoring and inference
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
JSConTest
Type and effect contracts with run-time checking
JSConTest, a tool for effect monitoring and inference
Type and effect contracts
Type contracts
1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . }
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
JSConTest
Type and effect contracts with run-time checking
JSConTest, a tool for effect monitoring and inference
Type and effect contracts
Type contracts
1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . }
Effect contracts specifying access paths
1 j s : t r e e . ( ) −> i n t with [ t h i s . / l e f t | r i g h t /∗. ba l ]
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
JSConTest
Type and effect contracts with run-time checking
JSConTest, a tool for effect monitoring and inference
Type and effect contracts
Type contracts
1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . }
Effect contracts specifying access paths
1 j s : t r e e . ( ) −> i n t with [ t h i s . / l e f t | r i g h t /∗. ba l ]
Investigate effects of unfamiliar function
Monitoring its execution
Summarizing the observed traces to compact descriptions
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
Shortcomings of JSConTest
Implemented by an offline code transformation
Partial interposition (dynamic code, eval, . . . )
Tied to a particular version of JavaScript
Transformation hard to maintain
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
Shortcomings of JSConTest
Implemented by an offline code transformation
Partial interposition (dynamic code, eval, . . . )
Tied to a particular version of JavaScript
Transformation hard to maintain
Special contract syntax
Requires a special JavaScript parser
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
Shortcomings of JSConTest
Implemented by an offline code transformation
Partial interposition (dynamic code, eval, . . . )
Tied to a particular version of JavaScript
Transformation hard to maintain
Special contract syntax
Requires a special JavaScript parser
Efficiency issues
Naive representation of access paths
Wastes memory and impedes scalability
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
JSConTest2
Redesign and reimplementation of JSConTest based on
JavaScript proxies
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 7 / 25
JSConTest2
Redesign and reimplementation of JSConTest based on
JavaScript proxies
Advantages
Full interposition for the full language
Including dynamically loaded code and eval
Safe for future language extensions
No transformation to maintain
Runs faster in less memory
Efficient representation of access paths
Incremental path matching
Maintenance is simplified
No custom syntax for contracts
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 7 / 25
Effects for JavaScript
Only some parts of an object are accessible:
1 var proxy = APC. permit ( ’( a.?+b ∗) ’ , {a : { b : 5} , b : { b : 1 1 } } ) ;
2 a = proxy . a ; // APC .permit (’?’, {b:5});
3 a . b = 3;
APC encapsulates JSConTest2
permit wraps an object with a permission. Arguments:
1 Permission encoded in a string
2 Object that is protected by the permission
Contract specifies permitted access paths
Last property is readable/ writeable
Prefix is read-only
Not addressed properties are neither readable nor writeable
Read-only paths possible (@ denotes a non-existing property)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 8 / 25
Contracts on Functions
1 var func = APC. permitArgs ( ’ arguments . 0 . ( a.?+b ∗) ’ ,
2 function ( arg0 ) {
3 // do something
4 } ) ;
permitArg wraps a function with permissions
1 contract applied to function arguments
2 function
Arguments accessed by position arguments.0
No reliable way to access parameter names
Function may use unlisted parameters
Parameter names may not be unique
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 9 / 25
Interaction of Contracts
1 var x = APC. permit ( ’(( a+a . b)+b . b .@) ’ , {a : { b : 3} , b : { b : 5 } } ) ;
2 x . a = x . b ; // APC .permit (’b.@’, {b:5});
3 y = x . a ; // APC .permit (’b & b.@’, {b:5});
4 y . b = 7; // violation
Line 2 reads x.b and writes x.a
Afterwards, x.b and x.a are aliases
JSConTest2 enforces both contracts reaching x.b and x.a
x.a carries contract ’(ǫ+b)&b.@’ = ’b.@’
Thus, writing to x.a.b is not permitted
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 10 / 25
Syntax of Access Permission Contracts
Literal ∋ ℓ ::= ∅ | @ | r
Contract ∋ C ::= ǫ | ℓ | C∗ | C+C | C&C | C.C
Each literal ℓ defines a property access
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 11 / 25
Syntax of Access Permission Contracts
Literal ∋ ℓ ::= ∅ | @ | r
Contract ∋ C ::= ǫ | ℓ | C∗ | C+C | C&C | C.C
Each literal ℓ defines a property access
Access contracts are regular expressions on literals
L C denotes the language of C, that defines a set of
permitted access paths
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 11 / 25
The JSConTest2 Approach
Full interposition of contracted objects
Proxy intercepts all operations
Proxy-handler contains contract C and path set P
Forwards the operation or signals a violation
Returned object contains the remaining contract (Membrane)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 12 / 25
JavaScript Proxies
Meta-Level
Base-Level
Handler
Proxy Target
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
JavaScript Proxies
Meta-Level
Base-Level
Handler
Proxy p.foo Target
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
JavaScript Proxies
Meta-Level
Base-Level
Handler h.get(t, ’foo’, p)
Proxy p.foo Target
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
JavaScript Proxies
Meta-Level
Base-Level
Handler h.get(t, ’foo’, p)
Proxy p.foo Target t[ ’foo’]
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
JavaScript Proxies
Meta-Level
Base-Level
Handler h.set(t, ’bar’ , 4711, p)
Proxy p.bar=4711 Target t[ ’bar’]=4711
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
Membranes
Access Path: P
Contract: C
Proxy t
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
Membranes
Access Path: P
Contract: C
Proxy
p
t
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
Membranes
Access Path: P
Contract: C
Proxy
p
t
t[p]
p
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
Membranes
Access Path: P
Contract: C
Proxy
Access Path: P.p
Contract: ∂p(C) Proxy
p
t
t[p]
p
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
Membranes
Access Path: P
Contract: C
Proxy
Access Path: P.p
Contract: ∂p(C) Proxy
p
t
t[p]
p
∂p(C) is the Brzozowski derivative of C with respect to p
∂p(C) accepts the quotient language:
p−1L C = {w | pw ∈ L C }
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
Membrane issues
What if a contract is applied to a proxy?
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
Membrane issues
What if a contract is applied to a proxy?
1 The proxy is wrapped in another proxy
Tradeoff: Inefficient due to chains of proxies
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
Membrane issues
What if a contract is applied to a proxy?
1 The proxy is wrapped in another proxy
Tradeoff: Inefficient due to chains of proxies
2 The existing proxy is reused with updated information
Requires merge operations for contracts and paths
Intersection of contracts
Union of path sets
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
Reuse Updated Proxy
Access Paths
Native representations of path sets waste space
Path update becomes inefficient
Solution: Store paths in a trie structure
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 16 / 25
Reuse Updated Proxy
Access Paths
Native representations of path sets waste space
Path update becomes inefficient
Solution: Store paths in a trie structure
Access Permission Contracts
Contracts get large and may contain redundant parts
Computing derivative becomes more expensive
Solution: Contract rewriting
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 16 / 25
Contract Rewriting
Suppose that L C ⊆ L C′ . Then simplify
C+C′ to C′
C&C′ to C
Definition (Containment)
A contract C is contained in another contract C′, written as
C ⊑ C′, iff L C ⊆ L C′ .
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 17 / 25
Contract Rewriting
Suppose that L C ⊆ L C′ . Then simplify
C+C′ to C′
C&C′ to C
Definition (Containment)
A contract C is contained in another contract C′, written as
C ⊑ C′, iff L C ⊆ L C′ .
Requirement
Decide C ⊑ C′ quickly
Use Antimirov’s technique, based on derivatives
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 17 / 25
Antimirov: Deciding Containment by Rewriting
Lemma (Containment)
C ⊑ C′
⇔ ν(∂P(C′
)) for all P ∈ L C (1)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
Antimirov: Deciding Containment by Rewriting
Lemma (Containment)
C ⊑ C′
⇔ ν(∂P(C′
)) for all P ∈ L C (1)
Lemma (Containment2)
C ⊑ C′
⇔ ∂p(C) ⊑ ∂p(C′
) ∧ (ν(C) ⇒ ν(C′
))
for all p ∈ {p | pw ∈ L C }
(2)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
Antimirov: Deciding Containment by Rewriting
Lemma (Containment)
C ⊑ C′
⇔ ν(∂P(C′
)) for all P ∈ L C (1)
Lemma (Containment2)
C ⊑ C′
⇔ ∂p(C) ⊑ ∂p(C′
) ∧ (ν(C) ⇒ ν(C′
))
for all p ∈ {p | pw ∈ L C }
(2)
Drawback
Literal r leads to an infinite alphabet
Requires infinitely many test
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
Literal-based derivative
Definition (First Contract Literals)
first(ℓ) = {ℓ}
first(ǫ) = {}
first(C∗) = first(C)
first(C+C′) = first(C) ∪ first(C′)
first(C&C′) = {ℓ ⊓r ℓ′ | ℓ ∈ first(C), ℓ′ ∈ first(C′)}
first(C.C′) =
first(C) ∪ first(C′), ν(C)
first(C), otherwise
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 19 / 25
Literal-based derivative
Definition (First Contract Literals)
first(ℓ) = {ℓ}
first(ǫ) = {}
first(C∗) = first(C)
first(C+C′) = first(C) ∪ first(C′)
first(C&C′) = {ℓ ⊓r ℓ′ | ℓ ∈ first(C), ℓ′ ∈ first(C′)}
first(C.C′) =
first(C) ∪ first(C′), ν(C)
first(C), otherwise
It holds that:
{p | pw ∈ L C } = L first(C) (3)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 19 / 25
Containment with Contract Literals
∇ℓ(C) is the literal-based derivative of C with respect to ℓ
Lemma (Syntactic derivative of contracts)
L ∇ℓ(C) =
p∈L ℓ
L ∂p(C) (4)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 20 / 25
Containment with Contract Literals
∇ℓ(C) is the literal-based derivative of C with respect to ℓ
Lemma (Syntactic derivative of contracts)
L ∇ℓ(C) =
p∈L ℓ
L ∂p(C) (4)
Theorem (Containment)
C ⊑ C′
⇐ ∇ℓ(C) ⊑ ∇ℓ(C′
) ∧ (ν(C) ⇒ ν(C′
))
for all ℓ ∈ first(C)
(5)
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 20 / 25
Implementation
Implementation based on the JavaScript Proxy API
Implemented since Firefox 18.0 and Chrome 3.5
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
Implementation
Implementation based on the JavaScript Proxy API
Implemented since Firefox 18.0 and Chrome 3.5
Implementation provides an proxy-handler
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
Implementation
Implementation based on the JavaScript Proxy API
Implemented since Firefox 18.0 and Chrome 3.5
Implementation provides an proxy-handler
Two evaluation modes:
1 Observer Mode: Only path and violation logging
2 Protector Mode: Omits forbidden read and write access
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
Implementation
Implementation based on the JavaScript Proxy API
Implemented since Firefox 18.0 and Chrome 3.5
Implementation provides an proxy-handler
Two evaluation modes:
1 Observer Mode: Only path and violation logging
2 Protector Mode: Omits forbidden read and write access
Limitations
1 Cannot directly protect DOM objects
Because of the browser’s sandbox
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
Implementation
Implementation based on the JavaScript Proxy API
Implemented since Firefox 18.0 and Chrome 3.5
Implementation provides an proxy-handler
Two evaluation modes:
1 Observer Mode: Only path and violation logging
2 Protector Mode: Omits forbidden read and write access
Limitations
1 Cannot directly protect DOM objects
Because of the browser’s sandbox
2 Proxies are not transparent with respect to equality
For distinct proxies == and === returns false, even if the
target object is the same
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
Evaluation
Benchmark Programs
Google V8 Benchmark Suite
Benchmarks accompanying the TAJS system
Libraries like jQuery
Dumped web pages like youtube or twitter
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
Evaluation
Benchmark Programs
Google V8 Benchmark Suite
Benchmarks accompanying the TAJS system
Libraries like jQuery
Dumped web pages like youtube or twitter
Applied access contract inference by logging with universal
contract ?∗
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
Evaluation
Benchmark Programs
Google V8 Benchmark Suite
Benchmarks accompanying the TAJS system
Libraries like jQuery
Dumped web pages like youtube or twitter
Applied access contract inference by logging with universal
contract ?∗
Prepared customized contracts to protect objects
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
Evaluation
Benchmark Programs
Google V8 Benchmark Suite
Benchmarks accompanying the TAJS system
Libraries like jQuery
Dumped web pages like youtube or twitter
Applied access contract inference by logging with universal
contract ?∗
Prepared customized contracts to protect objects
Initial implementation: quickly ran out of memory
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
Evaluation
Benchmark Programs
Google V8 Benchmark Suite
Benchmarks accompanying the TAJS system
Libraries like jQuery
Dumped web pages like youtube or twitter
Applied access contract inference by logging with universal
contract ?∗
Prepared customized contracts to protect objects
Initial implementation: quickly ran out of memory
Final implementation: acceptable performance
Using trie structures and contract rewriting
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
Google V8 Benchmark Suite
Benchmark Baseline Contracts Without Full
only logging
RegExp 2.4sec 2.4sec 2.4sec 2.4sec
NavierStokes 2.3sec 2.3sec 2.3sec 2.3sec
EarleyBoyer 4.3sec 4.4sec 4.4sec 4.4sec
DeltaBlue 2.3sec 3.3sec 9.5sec 9.8sec
Richards 2.3sec 3.3sec 18.6min 22.5min
RayTrace 2.3sec 1.6min 1.1h 1.2h
Crypto 4.4sec 2.6min 2.5h 4.2h
Splay 2.3sec 2.3sec - -
Most time consuming parts are Path Generation and Contract
Derivation
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 23 / 25
Conclusion
Effect logging and dynamic enforcement of access contracts
with proxies
Shortcomings of previous, translation-based implementation
avoided
Support for the full JavaScript language
Guarantees full interposition
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
Conclusion
Effect logging and dynamic enforcement of access contracts
with proxies
Shortcomings of previous, translation-based implementation
avoided
Support for the full JavaScript language
Guarantees full interposition
Contract rewriting extending results by results from
Brzozowski and Antimirov to reduce memory consumption
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
Conclusion
Effect logging and dynamic enforcement of access contracts
with proxies
Shortcomings of previous, translation-based implementation
avoided
Support for the full JavaScript language
Guarantees full interposition
Contract rewriting extending results by results from
Brzozowski and Antimirov to reduce memory consumption
Practical applicability of access permission contracts
Runtime overhead of of pure contract enforcement is
negligible
Full effect logging incurs some overhead
Primarily used for program understanding and debugging
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
Efficient Dynamic Access Analysis
Using JavaScript Proxies
Questions?
Thank you for your attention.
Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 25 / 25

More Related Content

Viewers also liked

200 Days of Code, Beginner Track, Month 5
200 Days of Code, Beginner Track, Month 5200 Days of Code, Beginner Track, Month 5
200 Days of Code, Beginner Track, Month 5Ryne McCall
 
Collagen 390 Tablets
Collagen 390 TabletsCollagen 390 Tablets
Collagen 390 Tabletsirmgard374
 
Consumer making buying decison
Consumer making buying decisonConsumer making buying decison
Consumer making buying decisonSameer Agarwal
 
Type-based Dependency Analysis
Type-based Dependency AnalysisType-based Dependency Analysis
Type-based Dependency AnalysisMatthias Keil
 
13. materi 4 mendesain media berbasis ict
13. materi 4 mendesain media berbasis ict13. materi 4 mendesain media berbasis ict
13. materi 4 mendesain media berbasis ictwidytia17
 
Организационные структуры проектирования эис
Организационные структуры проектирования эисОрганизационные структуры проектирования эис
Организационные структуры проектирования эисadam93
 
A Letter to my friend
A Letter to my friendA Letter to my friend
A Letter to my friendRajan Agrawal
 
Promotie veenendaal jaarplan 2011 2012 concept 3
Promotie veenendaal jaarplan 2011 2012 concept 3Promotie veenendaal jaarplan 2011 2012 concept 3
Promotie veenendaal jaarplan 2011 2012 concept 3Roeland Tameling
 
Germer Isoladores Valores e Beneficios
Germer Isoladores Valores e BeneficiosGermer Isoladores Valores e Beneficios
Germer Isoladores Valores e BeneficiosJonas Meynaczyk
 
presentation about conceptual research
presentation about conceptual researchpresentation about conceptual research
presentation about conceptual researchali farhan
 
Top 8 regional head resume samples
Top 8 regional head resume samplesTop 8 regional head resume samples
Top 8 regional head resume samplesparrijom
 
Recommendation system
Recommendation systemRecommendation system
Recommendation system光明 赵
 
Thuoc Phong Te Thap
Thuoc Phong Te ThapThuoc Phong Te Thap
Thuoc Phong Te Thapherma124
 
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)Rolanda Islamey
 

Viewers also liked (18)

200 Days of Code, Beginner Track, Month 5
200 Days of Code, Beginner Track, Month 5200 Days of Code, Beginner Track, Month 5
200 Days of Code, Beginner Track, Month 5
 
Collagen 390 Tablets
Collagen 390 TabletsCollagen 390 Tablets
Collagen 390 Tablets
 
Consumer making buying decison
Consumer making buying decisonConsumer making buying decison
Consumer making buying decison
 
Type-based Dependency Analysis
Type-based Dependency AnalysisType-based Dependency Analysis
Type-based Dependency Analysis
 
driehandenopeenbuik
driehandenopeenbuikdriehandenopeenbuik
driehandenopeenbuik
 
13. materi 4 mendesain media berbasis ict
13. materi 4 mendesain media berbasis ict13. materi 4 mendesain media berbasis ict
13. materi 4 mendesain media berbasis ict
 
Организационные структуры проектирования эис
Организационные структуры проектирования эисОрганизационные структуры проектирования эис
Организационные структуры проектирования эис
 
A Letter to my friend
A Letter to my friendA Letter to my friend
A Letter to my friend
 
Promotie veenendaal jaarplan 2011 2012 concept 3
Promotie veenendaal jaarplan 2011 2012 concept 3Promotie veenendaal jaarplan 2011 2012 concept 3
Promotie veenendaal jaarplan 2011 2012 concept 3
 
Germer Isoladores Valores e Beneficios
Germer Isoladores Valores e BeneficiosGermer Isoladores Valores e Beneficios
Germer Isoladores Valores e Beneficios
 
presentation about conceptual research
presentation about conceptual researchpresentation about conceptual research
presentation about conceptual research
 
CATALOUGE
CATALOUGECATALOUGE
CATALOUGE
 
Top 8 regional head resume samples
Top 8 regional head resume samplesTop 8 regional head resume samples
Top 8 regional head resume samples
 
Recommendation system
Recommendation systemRecommendation system
Recommendation system
 
Thuoc Phong Te Thap
Thuoc Phong Te ThapThuoc Phong Te Thap
Thuoc Phong Te Thap
 
Komunitas internet marketer 2015
Komunitas internet marketer 2015Komunitas internet marketer 2015
Komunitas internet marketer 2015
 
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)
Presenter Tecniques / Universitas Bunda Mulia (Rolanda Bella Islamey)
 
Yourprezias
YourpreziasYourprezias
Yourprezias
 

Similar to Efficient Dynamic Access Analysis Using JavaScript Proxies

On Contracts and Sandboxes for JavaScript
On Contracts and Sandboxes for JavaScriptOn Contracts and Sandboxes for JavaScript
On Contracts and Sandboxes for JavaScriptMatthias Keil
 
Transparent Object Proxies for JavaScript
Transparent Object Proxies for JavaScriptTransparent Object Proxies for JavaScript
Transparent Object Proxies for JavaScriptMatthias Keil
 
On Contracts, Sandboxes, and Proxies for JavaScript
On Contracts, Sandboxes, and Proxies for JavaScriptOn Contracts, Sandboxes, and Proxies for JavaScript
On Contracts, Sandboxes, and Proxies for JavaScriptMatthias Keil
 
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...The MPEG-21 Multimedia Framework for Integrated Management of Environments en...
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...Alpen-Adria-Universität
 
Formal Verification of Functional Code
Formal Verification of Functional CodeFormal Verification of Functional Code
Formal Verification of Functional CodeMartin Děcký
 
BCA IPU VB.NET UNIT-II
BCA IPU VB.NET UNIT-IIBCA IPU VB.NET UNIT-II
BCA IPU VB.NET UNIT-IIVaibhavj1234
 
Fully Interoperable Streaming of Media Resources in Heterogeneous Environments
Fully Interoperable Streaming of Media Resources in Heterogeneous EnvironmentsFully Interoperable Streaming of Media Resources in Heterogeneous Environments
Fully Interoperable Streaming of Media Resources in Heterogeneous EnvironmentsAlpen-Adria-Universität
 
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...Kim Hammar
 
Jenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery PipelinesJenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery PipelinesBrent Laster
 
MLX 2018 - Thomas F. Coleman, University of Waterloo
MLX 2018 - Thomas F. Coleman, University of WaterlooMLX 2018 - Thomas F. Coleman, University of Waterloo
MLX 2018 - Thomas F. Coleman, University of WaterlooMehdi Merai Ph.D.(c)
 
Unit iii vb_study_materials
Unit iii vb_study_materialsUnit iii vb_study_materials
Unit iii vb_study_materialsgayaramesh
 
Functional Reactive Programming on Android
Functional Reactive Programming on AndroidFunctional Reactive Programming on Android
Functional Reactive Programming on AndroidSam Lee
 
Security and Trust in an Industrial Grid Project
Security and Trust in an Industrial Grid ProjectSecurity and Trust in an Industrial Grid Project
Security and Trust in an Industrial Grid ProjectAndreas Schreiber
 
Building a Dynamic Bidding system for a location based Display advertising Pl...
Building a Dynamic Bidding system for a location based Display advertising Pl...Building a Dynamic Bidding system for a location based Display advertising Pl...
Building a Dynamic Bidding system for a location based Display advertising Pl...Ekta Grover
 
Open-DO Update
Open-DO UpdateOpen-DO Update
Open-DO UpdateAdaCore
 
Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2gregoryg
 
Socket programming
Socket programmingSocket programming
Socket programmingNemiRathore
 
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Beat Signer
 
Exposing the Cost of Performance Hidden in the Cloud
Exposing the Cost of Performance Hidden in the CloudExposing the Cost of Performance Hidden in the Cloud
Exposing the Cost of Performance Hidden in the CloudNeil Gunther
 

Similar to Efficient Dynamic Access Analysis Using JavaScript Proxies (20)

On Contracts and Sandboxes for JavaScript
On Contracts and Sandboxes for JavaScriptOn Contracts and Sandboxes for JavaScript
On Contracts and Sandboxes for JavaScript
 
Fullstack Microservices
Fullstack MicroservicesFullstack Microservices
Fullstack Microservices
 
Transparent Object Proxies for JavaScript
Transparent Object Proxies for JavaScriptTransparent Object Proxies for JavaScript
Transparent Object Proxies for JavaScript
 
On Contracts, Sandboxes, and Proxies for JavaScript
On Contracts, Sandboxes, and Proxies for JavaScriptOn Contracts, Sandboxes, and Proxies for JavaScript
On Contracts, Sandboxes, and Proxies for JavaScript
 
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...The MPEG-21 Multimedia Framework for Integrated Management of Environments en...
The MPEG-21 Multimedia Framework for Integrated Management of Environments en...
 
Formal Verification of Functional Code
Formal Verification of Functional CodeFormal Verification of Functional Code
Formal Verification of Functional Code
 
BCA IPU VB.NET UNIT-II
BCA IPU VB.NET UNIT-IIBCA IPU VB.NET UNIT-II
BCA IPU VB.NET UNIT-II
 
Fully Interoperable Streaming of Media Resources in Heterogeneous Environments
Fully Interoperable Streaming of Media Resources in Heterogeneous EnvironmentsFully Interoperable Streaming of Media Resources in Heterogeneous Environments
Fully Interoperable Streaming of Media Resources in Heterogeneous Environments
 
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...
CNSM 2022 - An Online Framework for Adapting Security Policies in Dynamic IT ...
 
Jenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery PipelinesJenkins2 - Coding Continuous Delivery Pipelines
Jenkins2 - Coding Continuous Delivery Pipelines
 
MLX 2018 - Thomas F. Coleman, University of Waterloo
MLX 2018 - Thomas F. Coleman, University of WaterlooMLX 2018 - Thomas F. Coleman, University of Waterloo
MLX 2018 - Thomas F. Coleman, University of Waterloo
 
Unit iii vb_study_materials
Unit iii vb_study_materialsUnit iii vb_study_materials
Unit iii vb_study_materials
 
Functional Reactive Programming on Android
Functional Reactive Programming on AndroidFunctional Reactive Programming on Android
Functional Reactive Programming on Android
 
Security and Trust in an Industrial Grid Project
Security and Trust in an Industrial Grid ProjectSecurity and Trust in an Industrial Grid Project
Security and Trust in an Industrial Grid Project
 
Building a Dynamic Bidding system for a location based Display advertising Pl...
Building a Dynamic Bidding system for a location based Display advertising Pl...Building a Dynamic Bidding system for a location based Display advertising Pl...
Building a Dynamic Bidding system for a location based Display advertising Pl...
 
Open-DO Update
Open-DO UpdateOpen-DO Update
Open-DO Update
 
Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2Boetticher Presentation Promise 2008v2
Boetticher Presentation Promise 2008v2
 
Socket programming
Socket programmingSocket programming
Socket programming
 
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
Advanced SQL - Lecture 6 - Introduction to Databases (1007156ANR)
 
Exposing the Cost of Performance Hidden in the Cloud
Exposing the Cost of Performance Hidden in the CloudExposing the Cost of Performance Hidden in the Cloud
Exposing the Cost of Performance Hidden in the Cloud
 

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Efficient Dynamic Access Analysis Using JavaScript Proxies

  • 1. Efficient Dynamic Access Analysis Using JavaScript Proxies DLS’13 Matthias Keil, Peter Thiemann Institute for Computer Science University of Freiburg Freiburg, Germany October 28, 2013, Indianapolis, Indiana, USA.
  • 2. Motivation 92 % of all web sites use JavaScript Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 2 / 25
  • 3. Motivation 92 % of all web sites use JavaScript Most important client-side language for web sites Web-developers rely on third-party libraries e.g. for calendars, maps, social networks Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 2 / 25
  • 4. Situation of a Web-developer Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
  • 5. Situation of a Web-developer Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
  • 6. Situation of a Web-developer Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
  • 7. Situation of a Web-developer Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
  • 8. Situation of a Web-developer Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 3 / 25
  • 9. JavaScript issues Dynamic programming language Code is accumulated by dynamic loading e.g. eval, mashups Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
  • 10. JavaScript issues Dynamic programming language Code is accumulated by dynamic loading e.g. eval, mashups JavaScript has no security awareness No namespace or encapsulation management Global scope for variables/ functions All scripts have the same authority Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
  • 11. JavaScript issues Dynamic programming language Code is accumulated by dynamic loading e.g. eval, mashups JavaScript has no security awareness No namespace or encapsulation management Global scope for variables/ functions All scripts have the same authority Problems 1 Side effects may cause unexpected behavior 2 Program understanding and maintenance is difficult 3 Libraries may get access to sensitive data User code may be prone to injection attacks Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 4 / 25
  • 12. JSConTest Type and effect contracts with run-time checking JSConTest, a tool for effect monitoring and inference Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
  • 13. JSConTest Type and effect contracts with run-time checking JSConTest, a tool for effect monitoring and inference Type and effect contracts Type contracts 1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . } Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
  • 14. JSConTest Type and effect contracts with run-time checking JSConTest, a tool for effect monitoring and inference Type and effect contracts Type contracts 1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . } Effect contracts specifying access paths 1 j s : t r e e . ( ) −> i n t with [ t h i s . / l e f t | r i g h t /∗. ba l ] Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
  • 15. JSConTest Type and effect contracts with run-time checking JSConTest, a tool for effect monitoring and inference Type and effect contracts Type contracts 1 function ( x , y ) /∗c ( i nt , i n t ) −> bool ∗/ { . . . } Effect contracts specifying access paths 1 j s : t r e e . ( ) −> i n t with [ t h i s . / l e f t | r i g h t /∗. ba l ] Investigate effects of unfamiliar function Monitoring its execution Summarizing the observed traces to compact descriptions Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 5 / 25
  • 16. Shortcomings of JSConTest Implemented by an offline code transformation Partial interposition (dynamic code, eval, . . . ) Tied to a particular version of JavaScript Transformation hard to maintain Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
  • 17. Shortcomings of JSConTest Implemented by an offline code transformation Partial interposition (dynamic code, eval, . . . ) Tied to a particular version of JavaScript Transformation hard to maintain Special contract syntax Requires a special JavaScript parser Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
  • 18. Shortcomings of JSConTest Implemented by an offline code transformation Partial interposition (dynamic code, eval, . . . ) Tied to a particular version of JavaScript Transformation hard to maintain Special contract syntax Requires a special JavaScript parser Efficiency issues Naive representation of access paths Wastes memory and impedes scalability Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 6 / 25
  • 19. JSConTest2 Redesign and reimplementation of JSConTest based on JavaScript proxies Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 7 / 25
  • 20. JSConTest2 Redesign and reimplementation of JSConTest based on JavaScript proxies Advantages Full interposition for the full language Including dynamically loaded code and eval Safe for future language extensions No transformation to maintain Runs faster in less memory Efficient representation of access paths Incremental path matching Maintenance is simplified No custom syntax for contracts Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 7 / 25
  • 21. Effects for JavaScript Only some parts of an object are accessible: 1 var proxy = APC. permit ( ’( a.?+b ∗) ’ , {a : { b : 5} , b : { b : 1 1 } } ) ; 2 a = proxy . a ; // APC .permit (’?’, {b:5}); 3 a . b = 3; APC encapsulates JSConTest2 permit wraps an object with a permission. Arguments: 1 Permission encoded in a string 2 Object that is protected by the permission Contract specifies permitted access paths Last property is readable/ writeable Prefix is read-only Not addressed properties are neither readable nor writeable Read-only paths possible (@ denotes a non-existing property) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 8 / 25
  • 22. Contracts on Functions 1 var func = APC. permitArgs ( ’ arguments . 0 . ( a.?+b ∗) ’ , 2 function ( arg0 ) { 3 // do something 4 } ) ; permitArg wraps a function with permissions 1 contract applied to function arguments 2 function Arguments accessed by position arguments.0 No reliable way to access parameter names Function may use unlisted parameters Parameter names may not be unique Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 9 / 25
  • 23. Interaction of Contracts 1 var x = APC. permit ( ’(( a+a . b)+b . b .@) ’ , {a : { b : 3} , b : { b : 5 } } ) ; 2 x . a = x . b ; // APC .permit (’b.@’, {b:5}); 3 y = x . a ; // APC .permit (’b & b.@’, {b:5}); 4 y . b = 7; // violation Line 2 reads x.b and writes x.a Afterwards, x.b and x.a are aliases JSConTest2 enforces both contracts reaching x.b and x.a x.a carries contract ’(ǫ+b)&b.@’ = ’b.@’ Thus, writing to x.a.b is not permitted Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 10 / 25
  • 24. Syntax of Access Permission Contracts Literal ∋ ℓ ::= ∅ | @ | r Contract ∋ C ::= ǫ | ℓ | C∗ | C+C | C&C | C.C Each literal ℓ defines a property access Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 11 / 25
  • 25. Syntax of Access Permission Contracts Literal ∋ ℓ ::= ∅ | @ | r Contract ∋ C ::= ǫ | ℓ | C∗ | C+C | C&C | C.C Each literal ℓ defines a property access Access contracts are regular expressions on literals L C denotes the language of C, that defines a set of permitted access paths Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 11 / 25
  • 26. The JSConTest2 Approach Full interposition of contracted objects Proxy intercepts all operations Proxy-handler contains contract C and path set P Forwards the operation or signals a violation Returned object contains the remaining contract (Membrane) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 12 / 25
  • 27. JavaScript Proxies Meta-Level Base-Level Handler Proxy Target Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
  • 28. JavaScript Proxies Meta-Level Base-Level Handler Proxy p.foo Target Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
  • 29. JavaScript Proxies Meta-Level Base-Level Handler h.get(t, ’foo’, p) Proxy p.foo Target Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
  • 30. JavaScript Proxies Meta-Level Base-Level Handler h.get(t, ’foo’, p) Proxy p.foo Target t[ ’foo’] Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
  • 31. JavaScript Proxies Meta-Level Base-Level Handler h.set(t, ’bar’ , 4711, p) Proxy p.bar=4711 Target t[ ’bar’]=4711 Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 13 / 25
  • 32. Membranes Access Path: P Contract: C Proxy t Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
  • 33. Membranes Access Path: P Contract: C Proxy p t Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
  • 34. Membranes Access Path: P Contract: C Proxy p t t[p] p Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
  • 35. Membranes Access Path: P Contract: C Proxy Access Path: P.p Contract: ∂p(C) Proxy p t t[p] p Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
  • 36. Membranes Access Path: P Contract: C Proxy Access Path: P.p Contract: ∂p(C) Proxy p t t[p] p ∂p(C) is the Brzozowski derivative of C with respect to p ∂p(C) accepts the quotient language: p−1L C = {w | pw ∈ L C } Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 14 / 25
  • 37. Membrane issues What if a contract is applied to a proxy? Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
  • 38. Membrane issues What if a contract is applied to a proxy? 1 The proxy is wrapped in another proxy Tradeoff: Inefficient due to chains of proxies Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
  • 39. Membrane issues What if a contract is applied to a proxy? 1 The proxy is wrapped in another proxy Tradeoff: Inefficient due to chains of proxies 2 The existing proxy is reused with updated information Requires merge operations for contracts and paths Intersection of contracts Union of path sets Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 15 / 25
  • 40. Reuse Updated Proxy Access Paths Native representations of path sets waste space Path update becomes inefficient Solution: Store paths in a trie structure Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 16 / 25
  • 41. Reuse Updated Proxy Access Paths Native representations of path sets waste space Path update becomes inefficient Solution: Store paths in a trie structure Access Permission Contracts Contracts get large and may contain redundant parts Computing derivative becomes more expensive Solution: Contract rewriting Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 16 / 25
  • 42. Contract Rewriting Suppose that L C ⊆ L C′ . Then simplify C+C′ to C′ C&C′ to C Definition (Containment) A contract C is contained in another contract C′, written as C ⊑ C′, iff L C ⊆ L C′ . Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 17 / 25
  • 43. Contract Rewriting Suppose that L C ⊆ L C′ . Then simplify C+C′ to C′ C&C′ to C Definition (Containment) A contract C is contained in another contract C′, written as C ⊑ C′, iff L C ⊆ L C′ . Requirement Decide C ⊑ C′ quickly Use Antimirov’s technique, based on derivatives Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 17 / 25
  • 44. Antimirov: Deciding Containment by Rewriting Lemma (Containment) C ⊑ C′ ⇔ ν(∂P(C′ )) for all P ∈ L C (1) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
  • 45. Antimirov: Deciding Containment by Rewriting Lemma (Containment) C ⊑ C′ ⇔ ν(∂P(C′ )) for all P ∈ L C (1) Lemma (Containment2) C ⊑ C′ ⇔ ∂p(C) ⊑ ∂p(C′ ) ∧ (ν(C) ⇒ ν(C′ )) for all p ∈ {p | pw ∈ L C } (2) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
  • 46. Antimirov: Deciding Containment by Rewriting Lemma (Containment) C ⊑ C′ ⇔ ν(∂P(C′ )) for all P ∈ L C (1) Lemma (Containment2) C ⊑ C′ ⇔ ∂p(C) ⊑ ∂p(C′ ) ∧ (ν(C) ⇒ ν(C′ )) for all p ∈ {p | pw ∈ L C } (2) Drawback Literal r leads to an infinite alphabet Requires infinitely many test Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 18 / 25
  • 47. Literal-based derivative Definition (First Contract Literals) first(ℓ) = {ℓ} first(ǫ) = {} first(C∗) = first(C) first(C+C′) = first(C) ∪ first(C′) first(C&C′) = {ℓ ⊓r ℓ′ | ℓ ∈ first(C), ℓ′ ∈ first(C′)} first(C.C′) = first(C) ∪ first(C′), ν(C) first(C), otherwise Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 19 / 25
  • 48. Literal-based derivative Definition (First Contract Literals) first(ℓ) = {ℓ} first(ǫ) = {} first(C∗) = first(C) first(C+C′) = first(C) ∪ first(C′) first(C&C′) = {ℓ ⊓r ℓ′ | ℓ ∈ first(C), ℓ′ ∈ first(C′)} first(C.C′) = first(C) ∪ first(C′), ν(C) first(C), otherwise It holds that: {p | pw ∈ L C } = L first(C) (3) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 19 / 25
  • 49. Containment with Contract Literals ∇ℓ(C) is the literal-based derivative of C with respect to ℓ Lemma (Syntactic derivative of contracts) L ∇ℓ(C) = p∈L ℓ L ∂p(C) (4) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 20 / 25
  • 50. Containment with Contract Literals ∇ℓ(C) is the literal-based derivative of C with respect to ℓ Lemma (Syntactic derivative of contracts) L ∇ℓ(C) = p∈L ℓ L ∂p(C) (4) Theorem (Containment) C ⊑ C′ ⇐ ∇ℓ(C) ⊑ ∇ℓ(C′ ) ∧ (ν(C) ⇒ ν(C′ )) for all ℓ ∈ first(C) (5) Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 20 / 25
  • 51. Implementation Implementation based on the JavaScript Proxy API Implemented since Firefox 18.0 and Chrome 3.5 Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
  • 52. Implementation Implementation based on the JavaScript Proxy API Implemented since Firefox 18.0 and Chrome 3.5 Implementation provides an proxy-handler Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
  • 53. Implementation Implementation based on the JavaScript Proxy API Implemented since Firefox 18.0 and Chrome 3.5 Implementation provides an proxy-handler Two evaluation modes: 1 Observer Mode: Only path and violation logging 2 Protector Mode: Omits forbidden read and write access Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
  • 54. Implementation Implementation based on the JavaScript Proxy API Implemented since Firefox 18.0 and Chrome 3.5 Implementation provides an proxy-handler Two evaluation modes: 1 Observer Mode: Only path and violation logging 2 Protector Mode: Omits forbidden read and write access Limitations 1 Cannot directly protect DOM objects Because of the browser’s sandbox Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
  • 55. Implementation Implementation based on the JavaScript Proxy API Implemented since Firefox 18.0 and Chrome 3.5 Implementation provides an proxy-handler Two evaluation modes: 1 Observer Mode: Only path and violation logging 2 Protector Mode: Omits forbidden read and write access Limitations 1 Cannot directly protect DOM objects Because of the browser’s sandbox 2 Proxies are not transparent with respect to equality For distinct proxies == and === returns false, even if the target object is the same Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 21 / 25
  • 56. Evaluation Benchmark Programs Google V8 Benchmark Suite Benchmarks accompanying the TAJS system Libraries like jQuery Dumped web pages like youtube or twitter Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
  • 57. Evaluation Benchmark Programs Google V8 Benchmark Suite Benchmarks accompanying the TAJS system Libraries like jQuery Dumped web pages like youtube or twitter Applied access contract inference by logging with universal contract ?∗ Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
  • 58. Evaluation Benchmark Programs Google V8 Benchmark Suite Benchmarks accompanying the TAJS system Libraries like jQuery Dumped web pages like youtube or twitter Applied access contract inference by logging with universal contract ?∗ Prepared customized contracts to protect objects Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
  • 59. Evaluation Benchmark Programs Google V8 Benchmark Suite Benchmarks accompanying the TAJS system Libraries like jQuery Dumped web pages like youtube or twitter Applied access contract inference by logging with universal contract ?∗ Prepared customized contracts to protect objects Initial implementation: quickly ran out of memory Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
  • 60. Evaluation Benchmark Programs Google V8 Benchmark Suite Benchmarks accompanying the TAJS system Libraries like jQuery Dumped web pages like youtube or twitter Applied access contract inference by logging with universal contract ?∗ Prepared customized contracts to protect objects Initial implementation: quickly ran out of memory Final implementation: acceptable performance Using trie structures and contract rewriting Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 22 / 25
  • 61. Google V8 Benchmark Suite Benchmark Baseline Contracts Without Full only logging RegExp 2.4sec 2.4sec 2.4sec 2.4sec NavierStokes 2.3sec 2.3sec 2.3sec 2.3sec EarleyBoyer 4.3sec 4.4sec 4.4sec 4.4sec DeltaBlue 2.3sec 3.3sec 9.5sec 9.8sec Richards 2.3sec 3.3sec 18.6min 22.5min RayTrace 2.3sec 1.6min 1.1h 1.2h Crypto 4.4sec 2.6min 2.5h 4.2h Splay 2.3sec 2.3sec - - Most time consuming parts are Path Generation and Contract Derivation Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 23 / 25
  • 62. Conclusion Effect logging and dynamic enforcement of access contracts with proxies Shortcomings of previous, translation-based implementation avoided Support for the full JavaScript language Guarantees full interposition Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
  • 63. Conclusion Effect logging and dynamic enforcement of access contracts with proxies Shortcomings of previous, translation-based implementation avoided Support for the full JavaScript language Guarantees full interposition Contract rewriting extending results by results from Brzozowski and Antimirov to reduce memory consumption Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
  • 64. Conclusion Effect logging and dynamic enforcement of access contracts with proxies Shortcomings of previous, translation-based implementation avoided Support for the full JavaScript language Guarantees full interposition Contract rewriting extending results by results from Brzozowski and Antimirov to reduce memory consumption Practical applicability of access permission contracts Runtime overhead of of pure contract enforcement is negligible Full effect logging incurs some overhead Primarily used for program understanding and debugging Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 24 / 25
  • 65. Efficient Dynamic Access Analysis Using JavaScript Proxies Questions? Thank you for your attention. Matthias Keil, Peter Thiemann Dynamic Access Analysis October 28, 2013 25 / 25