Eval Begone! Semi-Automated Removal of Eval from Java']JavaScript Programs

被引:24
作者
Meawad, Fadi [1 ]
Richards, Gregor [1 ]
Morandat, Floreal [1 ]
Vitek, Jan [1 ]
机构
[1] Purdue Univ, W Lafayette, IN 47907 USA
关键词
Languages; Dynamic Languages; !text type='Java']Java[!/text]Script; Reflection; Dynamic Analysis;
D O I
10.1145/2398857.2384660
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Eval endows JavaScript developers with great power. It allows developers and end-users, by turning text into executable code, to seamlessly extend and customize the behavior of deployed applications as they are running. With great power comes great responsibility, though not in our experience. In previous work we demonstrated through a large corpus study that programmers wield that power in rather irresponsible and arbitrary ways. We showed that most calls to eval fall into a small number of very predictable patterns. We argued that those patterns could easily be recognized by an automated algorithm and that they could almost always be replaced with safer JavaScript idioms. In this paper we set out to validate our claim by designing and implementing a tool, which we call Evalorizer, that can assist programmers in getting rid of their unneeded evals. We use the tool to remove eval from a real-world website and validated our approach over logs taken from the top 100 websites with a success rate over 97% under an open world assumption.
引用
收藏
页码:607 / 620
页数:14
相关论文
共 23 条
  • [1] Anderson C., 2003, Electronic Notes in Theoretical Computer Science, V82, P53, DOI DOI 10.1016/S1571-0661(04)80802-8
  • [2] Type Checking for Java']JavaScript
    Anderson, Christopher
    Giannini, Paola
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 138 (02) : 37 - 58
  • [3] Bolin Michael, 2010, OREILLY SERIES
  • [4] Staged Information Flow for Java']JavaScript
    Chugh, Ravi
    Meister, Jeffrey A.
    Jhala, Ranjit
    Lerner, Sorin
    [J]. ACM SIGPLAN NOTICES, 2009, 44 (06) : 50 - 62
  • [5] Dewald Andreas, 2010, P S APPL COMP SAC, DOI [10.1145/1774088.1774482, DOI 10.1145/1774088.1774482]
  • [6] ECMA, 2009, ECMA262 ECMASCRIPT L
  • [7] Egele M, 2009, LECT NOTES COMPUT SC, V5587, P88, DOI 10.1007/978-3-642-02918-9_6
  • [8] Furr Michael, 2009, OOPSLA, DOI [10.1145/1640089.1640110, DOI 10.1145/1640089.1640110]
  • [9] Guarnieri S., 2009, USENIX SEC S
  • [10] Guha Arjun, 2010, LECT NOTES COMPUT SC