Download PDFOpen PDF in browser

Towards an amortized type system for JavaScript

15 pagesPublished: December 4, 2014

Abstract

JavaScript programs have access to a wide range of resources and many of those have security implications.
Tight bounds on the consumption of those resources can give indication of the functionality provided by the
program and minimize the security risks of mobile applications. Resource consumption is typically dependent
on the input of the user.
In this paper we introduce an amortized type system for a core of JavaScript. The resulting types certify
bounds for the resource usage dependent on the input parameters. We define the amortized types and the
corresponding typing rules. Furthermore we discuss how to fully automatically infer those resource bounds for
arbitrary applications. In addition to the usual example of amortized resource, heap-space, our type system
can be applied to many phone specific resources, which we demonstrate using the example of the GPS sensor
and others.
The main result of this paper is the soundness of the core type system, proving that a valid type for a program
corresponds to a bound on the units used of the specified resource.

Keyphrases: amortized analysis, JavaScript type system, mobile applications, resource bounds, resource usage, type system

In: Temur Kutsia and Andrei Voronkov (editors). SCSS 2014. 6th International Symposium on Symbolic Computation in Software Science, vol 30, pages 12--26

Links:
BibTeX entry
@inproceedings{SCSS2014:Towards_an_amortized_type,
  author    = {Daniel Franzen and David Aspinall},
  title     = {Towards an amortized type system for JavaScript},
  booktitle = {SCSS 2014. 6th International Symposium on Symbolic Computation in Software Science},
  editor    = {Temur Kutsia and Andrei Voronkov},
  series    = {EPiC Series in Computing},
  volume    = {30},
  pages     = {12--26},
  year      = {2014},
  publisher = {EasyChair},
  bibsource = {EasyChair, https://easychair.org},
  issn      = {2398-7340},
  url       = {https://easychair.org/publications/paper/DLWj},
  doi       = {10.29007/v2f2}}
Download PDFOpen PDF in browser